]> granicus.if.org Git - python/log
python
5 years agoCorrect overflow check in PyTuple_New() (GH-14838)
Sergey Fedoseev [Mon, 9 Sep 2019 20:40:58 +0000 (01:40 +0500)]
Correct overflow check in PyTuple_New() (GH-14838)

5 years agobpo-38049: Add command-line interface for the ast module. (GH-15724)
Serhiy Storchaka [Mon, 9 Sep 2019 20:36:13 +0000 (23:36 +0300)]
bpo-38049: Add command-line interface for the ast module. (GH-15724)

5 years agobpo-37383: Updates docs to reflect AsyncMock call_count after await. (#15761)
Lisa Roach [Mon, 9 Sep 2019 16:54:13 +0000 (17:54 +0100)]
bpo-37383: Updates docs to reflect AsyncMock call_count after await. (#15761)

* bpo-351428: Updates documentation to reflect AsyncMock call_count after await.

* Adds skip and fixes warning.

* Removes extra >>>.

* Adds ... in front of await mock().

5 years agobpo-38018: Increase code coverage for multiprocessing.shared_memory (GH-15662)
Vinay Sharma [Mon, 9 Sep 2019 16:48:55 +0000 (22:18 +0530)]
bpo-38018: Increase code coverage for multiprocessing.shared_memory (GH-15662)

5 years agobpo-36502: Update link to UAX #44, the Unicode doc on the UCD. (GH-15301)
Greg Price [Mon, 9 Sep 2019 16:37:13 +0000 (09:37 -0700)]
bpo-36502: Update link to UAX #44, the Unicode doc on the UCD. (GH-15301)

The link we have points to the version from Unicode 6.0.0, dated 2010.
There have been numerous updates to it since then:
  https://www.unicode.org/reports/tr44/#Modifications

Change the link to one that points to the current version. Also, use HTTPS.

5 years agobpo-37995: Add an option to ast.dump() to produce a multiline output. (GH-15631)
Serhiy Storchaka [Mon, 9 Sep 2019 16:33:13 +0000 (19:33 +0300)]
bpo-37995: Add an option to ast.dump() to produce a multiline output. (GH-15631)

5 years agobpo-37840: Fix handling of negative indices in bytearray_getitem() (GH-15250)
Sergey Fedoseev [Mon, 9 Sep 2019 16:28:34 +0000 (21:28 +0500)]
bpo-37840: Fix handling of negative indices in bytearray_getitem() (GH-15250)

5 years agobpo-35941: Fix performance regression in new code (GH-12610)
Christian Heimes [Mon, 9 Sep 2019 16:06:55 +0000 (18:06 +0200)]
bpo-35941: Fix performance regression in new code (GH-12610)

Accumulate certificates in a set instead of doing a costly list contain
operation. A Windows cert store can easily contain over hundred
certificates. The old code would result in way over 5,000 comparison
operations

Signed-off-by: Christian Heimes <christian@python.org>
5 years agobpo-37649: Fix exec_prefix check (GH-14897)
Orivej Desh [Mon, 9 Sep 2019 16:05:21 +0000 (16:05 +0000)]
bpo-37649: Fix exec_prefix check (GH-14897)

5 years agoFix punctuation in `os.execvpe` docstring. (GH-15051)
Hasan Ramezani [Mon, 9 Sep 2019 15:58:21 +0000 (17:58 +0200)]
Fix punctuation in `os.execvpe` docstring. (GH-15051)

5 years agobpo-35803: Document and test dir=PathLike for tempfile (GH-11644)
Anthony Sottile [Mon, 9 Sep 2019 15:54:34 +0000 (08:54 -0700)]
bpo-35803: Document and test dir=PathLike for tempfile (GH-11644)

Co-Authored-By: Ammar Askar <ammar_askar@hotmail.com>
5 years agoClarify that shutil's copy functions can accept path-like values (GH-15141)
Boris Verhovsky [Mon, 9 Sep 2019 15:51:56 +0000 (09:51 -0600)]
Clarify that shutil's copy functions can accept path-like values (GH-15141)

5 years agoFix docs bz.open default mode (GH-15100)
Richard Sanger [Mon, 9 Sep 2019 15:49:47 +0000 (03:49 +1200)]
Fix docs bz.open default mode (GH-15100)

bz2.open()'s default mode is rb, not r

5 years agobpo-36279: Ensure os.wait3() rusage is initialized (GH-15111)
Zackery Spytz [Mon, 9 Sep 2019 15:48:32 +0000 (09:48 -0600)]
bpo-36279: Ensure os.wait3() rusage is initialized (GH-15111)

Co-Authored-By: David Wilson <dw@botanicus.net>
5 years agobpo-38070: visit_decref() calls _PyObject_IsFreed() (GH-15782)
Victor Stinner [Mon, 9 Sep 2019 15:44:59 +0000 (17:44 +0200)]
bpo-38070: visit_decref() calls _PyObject_IsFreed() (GH-15782)

In debug mode, visit_decref() now calls _PyObject_IsFreed() to ensure
that the object is not freed. If it's freed, the program fails with
an assertion error and Python dumps informations about the freed
object.

5 years agobpo-37758: Cut always-constant conditionals on sys.maxunicode. (GH-15302)
Greg Price [Mon, 9 Sep 2019 15:20:40 +0000 (08:20 -0700)]
bpo-37758: Cut always-constant conditionals on sys.maxunicode. (GH-15302)

Since PEP 393 in Python 3.3, this value is always 0x10ffff, the
maximum codepoint in Unicode; there's no longer such a thing as a
UCS-2 build of Python, which couldn't properly represent some
characters.

There are a couple of spots left where we still condition on the value
of this constant.  Take them out.

5 years agobpo-20490: Improve circular import error message (GH-15308)
Anthony Sottile [Mon, 9 Sep 2019 15:17:50 +0000 (08:17 -0700)]
bpo-20490: Improve circular import error message (GH-15308)

5 years agoMinor changes in Doc/faq/library. (#15449)
Antoine [Mon, 9 Sep 2019 15:00:44 +0000 (17:00 +0200)]
Minor changes in Doc/faq/library. (#15449)

* Minor changes.

* Update Doc/faq/library.rst

Co-Authored-By: Kyle Stanley <aeros167@gmail.com>
* Apply suggestions from aeros167.

* Update Doc/faq/library.rst

Co-Authored-By: Kyle Stanley <aeros167@gmail.com>
* Apply suggestions from aeros167 + re-add a "a" that was accidentally deleted.

5 years agobpo-38006: Avoid closure in weakref.WeakValueDictionary (GH-15641)
Victor Stinner [Mon, 9 Sep 2019 14:55:58 +0000 (16:55 +0200)]
bpo-38006: Avoid closure in weakref.WeakValueDictionary (GH-15641)

weakref.WeakValueDictionary defines a local remove() function used as
callback for weak references. This function was created with a
closure.  Modify the implementation to avoid the closure.

5 years agobpo-37876: Tests for ROT-13 codec (GH-15314)
Zeth [Mon, 9 Sep 2019 14:50:36 +0000 (15:50 +0100)]
bpo-37876: Tests for ROT-13 codec (GH-15314)

The Rot-13 codec is for educational use but does not have unit tests,
dragging down test coverage. This adds a few very simple tests.

5 years agodocs: Add references to AsyncMock in unittest.mock.patch (#13681)
Mario Corchero [Mon, 9 Sep 2019 14:18:06 +0000 (15:18 +0100)]
docs: Add references to AsyncMock in unittest.mock.patch (#13681)

Update the docs as patch can now return an AsyncMock if the patched
object is an async function.

5 years agoMark files as executable that are meant as scripts. (GH-15354)
Greg Price [Mon, 9 Sep 2019 14:16:33 +0000 (07:16 -0700)]
Mark files as executable that are meant as scripts. (GH-15354)

This is the converse of GH-15353 -- in addition to plenty of
scripts in the tree that are marked with the executable bit
(and so can be directly executed), there are a few that have
a leading `#!` which could let them be executed, but it doesn't
do anything because they don't have the executable bit set.

Here's a command which finds such files and marks them.  The
first line finds files in the tree with a `#!` line *anywhere*;
the next-to-last step checks that the *first* line is actually of
that form.  In between we filter out files that already have the
bit set, and some files that are meant as fragments to be
consumed by one or another kind of preprocessor.

    $ git grep -l '^#!' \
      | grep -vxFf <( \
          git ls-files --stage \
          | perl -lane 'print $F[3] if (!/^100644/)' \
        ) \
      | grep -ve '\.in$' -e '^Doc/includes/' \
      | while read f; do
          head -c2 "$f" | grep -qxF '#!' \
          && chmod a+x "$f"; \
        done

5 years agobpo-38059: Using sys.exit() over exit() in inspect.py (GH-15666)
Alan Yee [Mon, 9 Sep 2019 14:15:43 +0000 (07:15 -0700)]
bpo-38059: Using sys.exit() over exit() in inspect.py (GH-15666)

Constants added by the site module like exit() "should not be used in programs"

5 years agobpo-38053 Update documentation for plistlib (GH-15727)
Jon Janzen [Mon, 9 Sep 2019 14:13:43 +0000 (09:13 -0500)]
bpo-38053 Update documentation for plistlib (GH-15727)

* Update documentation for plistlib

-  Update "Mac OS X" to "Apple" since plists are used more widely than just macOS
-  Re-add the UID class documentation (oops, removed in GH-15615)

5 years agoFix typo in the algorithm description (GH-15774)
Pablo Galindo [Mon, 9 Sep 2019 14:08:23 +0000 (15:08 +0100)]
Fix typo in the algorithm description (GH-15774)

5 years agobpo-34596: Fallback to a default reason when @unittest.skip is uncalled (#9082)
Naitree Zhu [Mon, 9 Sep 2019 14:06:48 +0000 (22:06 +0800)]
bpo-34596: Fallback to a default reason when @unittest.skip is uncalled (#9082)

* bpo-34596: Fallback to a default reason when @unittest.skip is uncalled

* Change default reason to empty string

* Fix rst formatting of NEWS entry

5 years agobpo-37662: Documented venv.EnvBuilder.upgrade_dependencies(). (GH-15768)
Vinay Sajip [Mon, 9 Sep 2019 13:50:38 +0000 (14:50 +0100)]
bpo-37662: Documented venv.EnvBuilder.upgrade_dependencies(). (GH-15768)

5 years agobpo-38037: Fix reference counters in signal module (GH-15753)
animalize [Mon, 9 Sep 2019 13:46:26 +0000 (21:46 +0800)]
bpo-38037: Fix reference counters in signal module (GH-15753)

5 years agobpo-32587: Fixes unsafe downcast in PC/winreg.c (GH-15766)
Steve Dower [Mon, 9 Sep 2019 13:24:15 +0000 (06:24 -0700)]
bpo-32587: Fixes unsafe downcast in PC/winreg.c (GH-15766)

5 years agobpo-26185: Fix repr() on empty ZipInfo object (#13441)
Mickaël Schoentgen [Mon, 9 Sep 2019 13:08:54 +0000 (15:08 +0200)]
bpo-26185: Fix repr() on empty ZipInfo object (#13441)

* bpo-26185: Fix repr() on empty ZipInfo object

It was failing on AttributeError due to inexistant
but required attributes file_size and compress_size.
They are now initialized to 0 in ZipInfo.__init__().

* Remove useless hasattr() in ZipInfo._open_to_write()

* Completely remove file_size setting in _open_to_write().

5 years agoFix typo in math.prod example (GH-15614)
Ashwin Vishnu [Mon, 9 Sep 2019 12:42:27 +0000 (14:42 +0200)]
Fix typo in math.prod example (GH-15614)

5 years agobpo-37702: Fix SSL's certificate-store leak on Windows (GH-15632)
neonene [Mon, 9 Sep 2019 12:33:43 +0000 (21:33 +0900)]
bpo-37702: Fix SSL's certificate-store leak on Windows (GH-15632)

ssl_collect_certificates function in _ssl.c has a memory leak.
Calling CertOpenStore() and CertAddStoreToCollection(), a store's refcnt gets incremented by 2.
But CertCloseStore() is called only once and the refcnt leaves 1.

5 years agobpo-37589: Add a few missing dependencies on .h files in the Makefile. (GH-15757)
T. Wouters [Mon, 9 Sep 2019 12:17:18 +0000 (05:17 -0700)]
bpo-37589: Add a few missing dependencies on .h files in the Makefile. (GH-15757)

The missing dependencies prevented incremental builds from working when you touched any
of these files. Based on GH-14758 by @vemakereporter.

5 years agobpo-37283: Ensure command-line and unattend.xml setting override previously detected...
Steve Dower [Mon, 9 Sep 2019 12:15:07 +0000 (05:15 -0700)]
bpo-37283: Ensure command-line and unattend.xml setting override previously detected states in Windows installer (GH-15759)

5 years agobpo-34652 again: Remove lchmod from the default AC_CHECK_FUNCS list. (GH-15758)
Benjamin Peterson [Mon, 9 Sep 2019 12:13:00 +0000 (05:13 -0700)]
bpo-34652 again: Remove lchmod from the default AC_CHECK_FUNCS list. (GH-15758)

5 years agologging.Formatter docs: Add missing `validate` parameter, clarify `style` parameter...
David Röthlisberger [Mon, 9 Sep 2019 11:29:54 +0000 (12:29 +0100)]
logging.Formatter docs: Add missing `validate` parameter, clarify `style` parameter (GH-15222)

5 years agobpo-37212: Preserve keyword argument order in unittest.mock.call and error messages...
Xtreak [Mon, 9 Sep 2019 10:55:22 +0000 (16:25 +0530)]
bpo-37212: Preserve keyword argument order in unittest.mock.call and error messages (GH-14310)

5 years agoDoc: Fix PDF build (NoUri). (GH-15739)
Julien Palard [Mon, 9 Sep 2019 10:54:56 +0000 (12:54 +0200)]
Doc: Fix PDF build (NoUri). (GH-15739)

5 years agoFuture-proof .travis.yml for Python 3.10 (GH-14831)
Anthony Sottile [Mon, 9 Sep 2019 10:49:33 +0000 (03:49 -0700)]
Future-proof .travis.yml for Python 3.10 (GH-14831)

5 years agobpo-36250: ignore ValueError from signal in non-main thread (GH-12251)
Daniel Hahler [Mon, 9 Sep 2019 10:45:58 +0000 (12:45 +0200)]
bpo-36250: ignore ValueError from signal in non-main thread (GH-12251)

Authored-By: blueyed <github@thequod.de>
5 years agobpo-37705: Improve the implementation of winerror_to_errno() (GH-15623)
Zackery Spytz [Mon, 9 Sep 2019 09:35:08 +0000 (03:35 -0600)]
bpo-37705: Improve the implementation of winerror_to_errno() (GH-15623)

winerror_to_errno() is no longer automatically generated.
Do not rely on the old _dosmapperr() function.
Add ERROR_NO_UNICODE_TRANSLATION (1113) -> EILSEQ.

5 years agobpo-37936: Avoid ignoring files that we actually do track. (GH-15451)
Greg Price [Mon, 9 Sep 2019 09:34:50 +0000 (02:34 -0700)]
bpo-37936: Avoid ignoring files that we actually do track. (GH-15451)

There were about 14 files that are actually in the repo but that are
covered by the rules in .gitignore.

Git itself takes no notice of what .gitignore says about files that
it's already tracking... but the discrepancy can be confusing to a
human that adds a new file unexpectedly covered by these rules, as
well as to non-Git software that looks at .gitignore but doesn't
implement this wrinkle in its semantics.  (E.g., `rg`.)

Several of these are from rules that apply more broadly than
intended: for example, `Makefile` applies to `Doc/Makefile` and
`Tools/freeze/test/Makefile`, whereas `/Makefile` means only the
`Makefile` at the repo's root.

And the `Modules/Setup` rule simply wasn't updated after 961d54c5c.

https://bugs.python.org/issue37936

5 years agobpo-32587: Make winreg.REG_MULTI_SZ support zero-length strings (#13239)
Zackery Spytz [Mon, 9 Sep 2019 09:26:15 +0000 (03:26 -0600)]
bpo-32587: Make winreg.REG_MULTI_SZ support zero-length strings (#13239)

* bpo-32587: Make winreg.REG_MULTI_SZ support PendingFileRenameOperations

* Address review comments.

5 years agobpo-37445: Include FORMAT_MESSAGE_IGNORE_INSERTS in FormatMessageW() calls (GH-14462)
Zackery Spytz [Mon, 9 Sep 2019 09:20:39 +0000 (03:20 -0600)]
bpo-37445: Include FORMAT_MESSAGE_IGNORE_INSERTS in FormatMessageW() calls (GH-14462)

If FormatMessageW() is passed the FORMAT_MESSAGE_FROM_SYSTEM flag without FORMAT_MESSAGE_IGNORE_INSERTS, it will fail if there are insert sequences in the message definition.

5 years agobpo-38043: Use `bool` for boolean flags on is_normalized_quickcheck. (GH-15711)
Greg Price [Mon, 9 Sep 2019 09:16:31 +0000 (02:16 -0700)]
bpo-38043: Use `bool` for boolean flags on is_normalized_quickcheck. (GH-15711)

5 years agobpo-11953: Extend table of Windows WSA* error codes (GH-15004)
Ngalim Siregar [Mon, 9 Sep 2019 09:15:14 +0000 (16:15 +0700)]
bpo-11953: Extend table of Windows WSA* error codes (GH-15004)

5 years agobpo-15817: gdbinit: Document commands after defining them (GH-15021)
Florian Bruhin [Mon, 9 Sep 2019 09:06:37 +0000 (11:06 +0200)]
bpo-15817: gdbinit: Document commands after defining them (GH-15021)

The gdb manual[1] says the following for "document":

  The command commandname must already be defined.

[1] https://sourceware.org/gdb/current/onlinedocs/gdb/Define.html

And indeed when trying to use the gdbinit file with gdb 8.3, I get:

  .../cpython/Misc/gdbinit:17: Error in sourced command file:
  Undefined command: "pyo".  Try "help".

Fix this by moving all documentation blocks after the define blocks.

This was introduced in GH-6384.

5 years agoFix assertions regarding magic methods function body that was not executed (GH-14154)
Xtreak [Mon, 9 Sep 2019 09:04:57 +0000 (14:34 +0530)]
Fix assertions regarding magic methods function body that was not executed (GH-14154)

5 years agobpo-34410: Fix a crash in the tee iterator when re-enter it. (GH-15625)
Serhiy Storchaka [Mon, 9 Sep 2019 08:47:14 +0000 (11:47 +0300)]
bpo-34410: Fix a crash in the tee iterator when re-enter it. (GH-15625)

RuntimeError is now raised in this case.

5 years agoRevert "Raise a RuntimeError when tee iterator is consumed from different threads...
Serhiy Storchaka [Mon, 9 Sep 2019 08:18:16 +0000 (11:18 +0300)]
Revert "Raise a RuntimeError when tee iterator is consumed from different threads (GH-15567)" (GH-15736)

This reverts commit fa220ec7633e9674baccc28dde987f29d7f65141.

5 years agobpo-36018: Address more reviewer feedback (GH-15733)
Raymond Hettinger [Sun, 8 Sep 2019 23:57:58 +0000 (16:57 -0700)]
bpo-36018: Address more reviewer feedback (GH-15733)

5 years agobpo-36946:Fix possible signed integer overflow when handling slices. (GH-15639)
HongWeipeng [Sun, 8 Sep 2019 10:15:56 +0000 (18:15 +0800)]
bpo-36946:Fix possible signed integer overflow when handling slices. (GH-15639)

This is a complement to PR 13375.

5 years agoCorrect Roman-numeral example in Unicode HOWTO. (GH-15541)
Greg Price [Sun, 8 Sep 2019 09:42:13 +0000 (02:42 -0700)]
Correct Roman-numeral example in Unicode HOWTO. (GH-15541)

5 years agobpo-38038: Remove urllib.parse._splittype from xmlrpc.client. (GH-15703)
Dong-hee Na [Sun, 8 Sep 2019 08:54:02 +0000 (17:54 +0900)]
bpo-38038: Remove urllib.parse._splittype from xmlrpc.client. (GH-15703)

5 years agoRemove some unused defines in multiprocessing.h. (GH-15661)
Sergey Fedoseev [Sat, 7 Sep 2019 07:44:36 +0000 (12:44 +0500)]
Remove some unused defines in multiprocessing.h. (GH-15661)

It looks like they are unused since
87cf220972c9cb400ddcd577962883dcc5dca51a.

5 years agobpo-20806: Reference both times(2) and times(3) and link to MSDN. (GH-15479)
Joannah Nanjekye [Sat, 7 Sep 2019 07:05:29 +0000 (04:05 -0300)]
bpo-20806: Reference both times(2) and times(3) and link to MSDN. (GH-15479)

5 years ago bpo-38041: Refine IDLE Shell restart lines. (GH-15709)
Terry Jan Reedy [Fri, 6 Sep 2019 17:54:45 +0000 (13:54 -0400)]
 bpo-38041: Refine IDLE Shell restart lines.  (GH-15709)

 Restart lines now always start with '=' and never end with ' ' and fill the width of the window unless that would require ending with ' ', which could be wrapped by itself and possible confusing the user.

5 years agobpo-15088 : Remove PyGen_NeedsFinalizing() (GH-15702)
Joannah Nanjekye [Fri, 6 Sep 2019 15:41:38 +0000 (12:41 -0300)]
bpo-15088 : Remove PyGen_NeedsFinalizing() (GH-15702)

Remove PyGen_NeedsFinalizing(): it was not
documented, tested or used anywhere within CPython after
the implementation of PEP 442.

5 years agoMore refinements to the statistics docs (GH-15713)
Raymond Hettinger [Fri, 6 Sep 2019 06:02:27 +0000 (23:02 -0700)]
More refinements to the statistics docs (GH-15713)

5 years agoreplace inline function `is_small_int` with a macro version (GH-15710)
animalize [Fri, 6 Sep 2019 06:00:56 +0000 (14:00 +0800)]
replace inline function `is_small_int` with a macro version (GH-15710)

5 years agobpo-37064: Skip test_tools.test_pathfix if installed (GH-15705)
Victor Stinner [Thu, 5 Sep 2019 16:09:46 +0000 (18:09 +0200)]
bpo-37064: Skip test_tools.test_pathfix if installed (GH-15705)

If Python is installed, skip test_tools.test_pathfix test because
Tools/scripts/pathfix.py script is not installed.

5 years agobpo-37878: Remove PyThreadState_DeleteCurrent() function (GH-15315)
Joannah Nanjekye [Thu, 5 Sep 2019 16:06:49 +0000 (13:06 -0300)]
bpo-37878: Remove PyThreadState_DeleteCurrent() function (GH-15315)

* Rename PyThreadState_DeleteCurrent()
  to _PyThreadState_DeleteCurrent()
* Move it to the internal C API

Co-Authored-By: Carol Willing <carolcode@willingconsulting.com>
5 years agobpo-36797: Fix a dead link in Doc/distutils/apiref (GH-15700)
Miro Hrončok [Thu, 5 Sep 2019 15:06:45 +0000 (17:06 +0200)]
bpo-36797: Fix a dead link in  Doc/distutils/apiref (GH-15700)

https://bugs.python.org/issue36797

5 years agobpo-37064: Add option -k to Tools/scripts/pathfix.py (GH-15548)
PatrikKopkan [Thu, 5 Sep 2019 14:54:54 +0000 (16:54 +0200)]
bpo-37064: Add option -k to Tools/scripts/pathfix.py (GH-15548)

Add flag -k to pathscript.py script: preserve shebang flags.

5 years agoCorrect minor gramatical mistake in sys.settrace doc (GH-15637)
Andre Delfino [Thu, 5 Sep 2019 11:10:37 +0000 (08:10 -0300)]
Correct minor gramatical mistake in sys.settrace doc (GH-15637)

5 years agobpo-36409: Remove old plistlib API deprecated in 3.4 (GH-15615)
Jon Janzen [Thu, 5 Sep 2019 08:11:35 +0000 (03:11 -0500)]
bpo-36409: Remove old plistlib API deprecated in 3.4 (GH-15615)

* Remove implementation for old plistlib API deprecated in 3.4

5 years agobpo-36324: Apply review comment from Jake Vanderplas (GH-15695)
Raymond Hettinger [Thu, 5 Sep 2019 08:03:14 +0000 (01:03 -0700)]
bpo-36324:  Apply review comment from Jake Vanderplas (GH-15695)

5 years agobpo-36324: Apply review comments from Allen Downey (GH-15693)
Raymond Hettinger [Thu, 5 Sep 2019 07:18:47 +0000 (00:18 -0700)]
bpo-36324:  Apply review comments from Allen Downey (GH-15693)

5 years agobpo-38026: fix inspect.getattr_static (GH-15676)
Inada Naoki [Thu, 5 Sep 2019 04:07:08 +0000 (13:07 +0900)]
bpo-38026: fix inspect.getattr_static (GH-15676)

It should avoid dynamic lookup including `isinstance`.

This is a regression caused by GH-5351.

5 years agobpo-37902: IDLE: Add scrolling for IDLE browsers. (#15368)
GeeTransit [Thu, 5 Sep 2019 01:33:34 +0000 (21:33 -0400)]
bpo-37902: IDLE: Add scrolling for IDLE browsers. (#15368)

Modify the wheel event handler so it can also be used for module, path, and stack browsers.
Patch by George Zhang.

5 years agobpo-22347: Update mimetypes.guess_type to allow proper parsing of URLs (GH-15522)
Dong-hee Na [Thu, 5 Sep 2019 00:34:35 +0000 (09:34 +0900)]
bpo-22347: Update mimetypes.guess_type to allow proper parsing of URLs (GH-15522)

https://bugs.python.org/issue22347

5 years agoFix idlelib.help comments (GH-15669)
Terry Jan Reedy [Thu, 5 Sep 2019 00:20:08 +0000 (20:20 -0400)]
Fix idlelib.help comments (GH-15669)

5 years agobpo-38030: Fix os.stat failures on block devices on Windows (GH-15681)
Steve Dower [Wed, 4 Sep 2019 21:42:54 +0000 (14:42 -0700)]
bpo-38030: Fix os.stat failures on block devices on Windows (GH-15681)

5 years agobpo-36030: Fix a possible segfault in PyTuple_New() (GH-15670)
Zackery Spytz [Wed, 4 Sep 2019 13:58:05 +0000 (07:58 -0600)]
bpo-36030: Fix a possible segfault in PyTuple_New() (GH-15670)

5 years agoFix grammar in asyncio-dev.rst (GH-15672)
Roger Iyengar [Wed, 4 Sep 2019 06:04:09 +0000 (02:04 -0400)]
Fix grammar in asyncio-dev.rst (GH-15672)

Automerge-Triggered-By: @ned-deily
5 years agocloses bpo-37966: Fully implement the UAX #15 quick-check algorithm. (GH-15558)
Greg Price [Wed, 4 Sep 2019 02:45:44 +0000 (19:45 -0700)]
closes bpo-37966: Fully implement the UAX #15 quick-check algorithm. (GH-15558)

The purpose of the `unicodedata.is_normalized` function is to answer
the question `str == unicodedata.normalized(form, str)` more
efficiently than writing just that, by using the "quick check"
optimization described in the Unicode standard in UAX #15.

However, it turns out the code doesn't implement the full algorithm
from the standard, and as a result we often miss the optimization and
end up having to compute the whole normalized string after all.

Implement the standard's algorithm.  This greatly speeds up
`unicodedata.is_normalized` in many cases where our partial variant
of quick-check had been returning MAYBE and the standard algorithm
returns NO.

At a quick test on my desktop, the existing code takes about 4.4 ms/MB
(so 4.4 ns per byte) when the partial quick-check returns MAYBE and it
has to do the slow normalize-and-compare:

  $ build.base/python -m timeit -s 'import unicodedata; s = "\uf900"*500000' \
      -- 'unicodedata.is_normalized("NFD", s)'
  50 loops, best of 5: 4.39 msec per loop

With this patch, it gets the answer instantly (58 ns) on the same 1 MB
string:

  $ build.dev/python -m timeit -s 'import unicodedata; s = "\uf900"*500000' \
      -- 'unicodedata.is_normalized("NFD", s)'
  5000000 loops, best of 5: 58.2 nsec per loop

This restores a small optimization that the original version of this
code had for the `unicodedata.normalize` use case.

With this, that case is actually faster than in master!

$ build.base/python -m timeit -s 'import unicodedata; s = "\u0338"*500000' \
    -- 'unicodedata.normalize("NFD", s)'
500 loops, best of 5: 561 usec per loop

$ build.dev/python -m timeit -s 'import unicodedata; s = "\u0338"*500000' \
    -- 'unicodedata.normalize("NFD", s)'
500 loops, best of 5: 512 usec per loop

5 years agobpo-38022: IDLE: upgrade help.html to sphinx 2.x HTML5 output (GH-15664)
Tal Einat [Tue, 3 Sep 2019 20:52:58 +0000 (23:52 +0300)]
bpo-38022: IDLE: upgrade help.html to sphinx 2.x HTML5 output (GH-15664)

The HTML5 output from Sphinx 2.x adds  '<p>' tags within list elements.  Using a new prevtag attribute, ignore these instead of emitting unwanted '\n\n'.

Also stop looking for 'first' classes on tags (no longer present) and fix the bug of double-spacing instead of single spacing after <pre> blocks.

5 years agobpo-38020: Fixes crash in os.readlink() on Windows (GH-15663)
Steve Dower [Tue, 3 Sep 2019 19:50:51 +0000 (12:50 -0700)]
bpo-38020: Fixes crash in os.readlink() on Windows (GH-15663)

5 years agobpo-37798: Fix _statistics module doc (GH-15546)
Dong-hee Na [Tue, 3 Sep 2019 09:21:45 +0000 (18:21 +0900)]
bpo-37798: Fix _statistics module doc (GH-15546)

5 years agobpo-35771: IDLE: Fix flaky tool-tip hover delay tests (GH-15634)
Tal Einat [Tue, 3 Sep 2019 05:17:00 +0000 (08:17 +0300)]
bpo-35771: IDLE: Fix flaky tool-tip hover delay tests (GH-15634)

Extending the hover delay in test_tooltip should avoid spurious test_idle failures.
One longer delay instead of two shorter delays results in a net speedup.

5 years agoEnforce PEP 257 conventions in ftplib.py (GH-15604)
Alan Yee [Tue, 3 Sep 2019 04:21:33 +0000 (21:21 -0700)]
Enforce PEP 257 conventions in ftplib.py  (GH-15604)

-`"""` over `'''`
-no blank line either before or after the docstring.
-place the closing quotes on a line by themselves

5 years agobpo-36853: Fix suspicious.py to actually print the unused rules (#13579)
Anthony Sottile [Mon, 2 Sep 2019 16:01:23 +0000 (09:01 -0700)]
bpo-36853: Fix suspicious.py to actually print the unused rules (#13579)

* Fix suspicious.py to actually print the unused rules

* Fix the other `self.warn` calls

5 years agobpo-38010 Sync importlib.metadata with importlib_metadata 0.20. (GH-15646)
Jason R. Coombs [Mon, 2 Sep 2019 15:08:03 +0000 (11:08 -0400)]
bpo-38010 Sync importlib.metadata with importlib_metadata 0.20. (GH-15646)

Sync importlib.metadata with importlib_metadata 0.20.

5 years agobpo-15999: Clean up of handling boolean arguments. (GH-15610)
Serhiy Storchaka [Sun, 1 Sep 2019 09:16:51 +0000 (12:16 +0300)]
bpo-15999: Clean up of handling boolean arguments. (GH-15610)

* Use the 'p' format unit instead of manually called PyObject_IsTrue().
* Pass boolean value instead 0/1 integers to functions that needs boolean.
* Convert some arguments to boolean only once.

5 years agobpo-15999: Always pass bool instead of int to socket.setblocking(). (GH-15621)
Serhiy Storchaka [Sun, 1 Sep 2019 09:12:52 +0000 (12:12 +0300)]
bpo-15999: Always pass bool instead of int to socket.setblocking(). (GH-15621)

5 years agobpo-15999: Always pass bool instead of int to the expat parser. (GH-15622)
Serhiy Storchaka [Sun, 1 Sep 2019 09:11:43 +0000 (12:11 +0300)]
bpo-15999: Always pass bool instead of int to the expat parser. (GH-15622)

5 years agobpo-37994: Fix silencing all errors if an attribute lookup fails. (GH-15630)
Serhiy Storchaka [Sun, 1 Sep 2019 09:03:39 +0000 (12:03 +0300)]
bpo-37994: Fix silencing all errors if an attribute lookup fails. (GH-15630)

Only AttributeError should be silenced.

5 years agobpo-36543: Remove old-deprecated ElementTree features. (GH-12707)
Serhiy Storchaka [Sun, 1 Sep 2019 08:18:35 +0000 (11:18 +0300)]
bpo-36543: Remove old-deprecated ElementTree features. (GH-12707)

Remove methods Element.getchildren(), Element.getiterator() and
ElementTree.getiterator() and the xml.etree.cElementTree module.

5 years agobpo-37764: Fix infinite loop when parsing unstructured email headers. (GH-15239)
Ashwin Ramaswami [Sat, 31 Aug 2019 15:25:35 +0000 (10:25 -0500)]
bpo-37764: Fix infinite loop when parsing unstructured email headers. (GH-15239)

Fixes a case in which email._header_value_parser.get_unstructured hangs the system for some invalid headers. This covers the cases in which the header contains either:
- a case without trailing whitespace
- an invalid encoded word

https://bugs.python.org/issue37764

This fix should also be backported to 3.7 and 3.8

https://bugs.python.org/issue37764

5 years agobpo-37977: Warn more strongly and clearly about pickle security (GH-15595)
Daniel Pope [Sat, 31 Aug 2019 05:51:33 +0000 (06:51 +0100)]
bpo-37977: Warn more strongly and clearly about pickle security (GH-15595)

5 years agobpo-37990: fix gc stats (GH-15626)
Inada Naoki [Sat, 31 Aug 2019 00:13:42 +0000 (09:13 +0900)]
bpo-37990: fix gc stats (GH-15626)

5 years agobpo-37781: use "z" for PY_FORMAT_SIZE_T (GH-15156)
Inada Naoki [Fri, 30 Aug 2019 23:48:12 +0000 (08:48 +0900)]
bpo-37781: use "z" for PY_FORMAT_SIZE_T (GH-15156)

MSVC 2015 supports %zd / %zu.  "z" is portable enough nowadays.

5 years agoFix typos mostly in comments, docs and test names (GH-15209)
Min ho Kim [Fri, 30 Aug 2019 20:21:19 +0000 (06:21 +1000)]
Fix typos mostly in comments, docs and test names (GH-15209)

5 years agoIDLE: Fix 2 typos found by Min ho Kim. (GH-15617)
Terry Jan Reedy [Fri, 30 Aug 2019 20:16:37 +0000 (16:16 -0400)]
IDLE: Fix 2 typos found by Min ho Kim. (GH-15617)

5 years agobpo-37140: Fix StructUnionType_paramfunc() (GH-15612)
Victor Stinner [Fri, 30 Aug 2019 12:30:33 +0000 (14:30 +0200)]
bpo-37140: Fix StructUnionType_paramfunc() (GH-15612)

Fix a ctypes regression of Python 3.8. When a ctypes.Structure is
passed by copy to a function, ctypes internals created a temporary
object which had the side effect of calling the structure finalizer
(__del__) twice. The Python semantics requires a finalizer to be
called exactly once. Fix ctypes internals to no longer call the
finalizer twice.

Create a new internal StructParam_Type which is only used by
_ctypes_callproc() to call PyMem_Free(ptr) on Py_DECREF(argument).
StructUnionType_paramfunc() creates such object.

5 years agobpo-37976: Prevent shadowing of TypeError in zip() (GH-15592)
Sergey Fedoseev [Fri, 30 Aug 2019 04:25:48 +0000 (09:25 +0500)]
bpo-37976: Prevent shadowing of TypeError in zip() (GH-15592)

5 years agoSteven Bethard designated a new maintainer for argparse (GH-15605)
Raymond Hettinger [Fri, 30 Aug 2019 04:04:37 +0000 (21:04 -0700)]
Steven Bethard designated a new maintainer for argparse (GH-15605)

5 years agobpo-37834: Prevent shutil.rmtree exception (GH-15602)
Ned Deily [Thu, 29 Aug 2019 21:20:03 +0000 (17:20 -0400)]
bpo-37834: Prevent shutil.rmtree exception (GH-15602)

when built on non-Windows system without fd system call support,
like older versions of macOS.

5 years agobpo-37933: Fix faulthandler.cancel_dump_traceback_later() (GH-15440)
Thomas A Caswell [Thu, 29 Aug 2019 16:30:04 +0000 (12:30 -0400)]
bpo-37933: Fix faulthandler.cancel_dump_traceback_later() (GH-15440)

Fix faulthandler.cancel_dump_traceback_later() call
if cancel_dump_traceback_later() was not called previously.

5 years agobpo-8425: Fast path for set inplace difference when the second set is large (GH-15590)
Raymond Hettinger [Thu, 29 Aug 2019 16:02:58 +0000 (09:02 -0700)]
bpo-8425: Fast path for set inplace difference when the second set is large (GH-15590)