]> git.ipfire.org Git - thirdparty/Python/cpython.git/log
thirdparty/Python/cpython.git
5 years agobpo-41009: fix requires_OS_version() class decorator (GH-20942)
Christian Heimes [Wed, 17 Jun 2020 17:09:10 +0000 (19:09 +0200)] 
bpo-41009: fix requires_OS_version() class decorator (GH-20942)

Signed-off-by: Christian Heimes <christian@python.org>
Automerge-Triggered-By: @tiran
5 years agobpo-41003: Fix test_copyreg when numpy is installed (GH-20935)
Victor Stinner [Wed, 17 Jun 2020 16:07:13 +0000 (18:07 +0200)] 
bpo-41003: Fix test_copyreg when numpy is installed (GH-20935)

Fix test_copyreg when numpy is installed: test.pickletester now
saves/restores warnings.filters when importing numpy, to ignore
filters installed by numpy.

Add the save_restore_warnings_filters() function to the
test.support.warnings_helper module.

5 years agobpo-36346: Make unicodeobject.h C89 compatible (GH-20934)
Inada Naoki [Wed, 17 Jun 2020 14:43:01 +0000 (23:43 +0900)] 
bpo-36346: Make unicodeobject.h C89 compatible (GH-20934)

5 years agobpo-35059: Enhance _PyObject_GC_TRACK() macros (GH-20931)
Victor Stinner [Wed, 17 Jun 2020 12:23:04 +0000 (14:23 +0200)] 
bpo-35059: Enhance _PyObject_GC_TRACK() macros (GH-20931)

* Rename _PyObject_GC_TRACK_impl() to _PyObject_GC_TRACK()
* Rename _PyObject_GC_UNTRACK_impl() to _PyObject_GC_UNTRACK()
* Omit filename and lineno parameters if NDEBUG is defined.

5 years agobpo-36346: Add Py_DEPRECATED to deprecated unicode APIs (GH-20878)
Inada Naoki [Wed, 17 Jun 2020 11:09:44 +0000 (20:09 +0900)] 
bpo-36346: Add Py_DEPRECATED to deprecated unicode APIs (GH-20878)

Co-authored-by: Kyle Stanley <aeros167@gmail.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
5 years agobpo-32604: Clean up test.support.interpreters. (gh-20926)
Eric Snow [Wed, 17 Jun 2020 00:24:40 +0000 (18:24 -0600)] 
bpo-32604: Clean up test.support.interpreters. (gh-20926)

There were some minor adjustments needed and a few tests were missing.

https://bugs.python.org/issue32604

5 years agobpo-1635741: Port _gdbm module to multiphase initialization (GH-20920)
Dong-hee Na [Tue, 16 Jun 2020 16:41:23 +0000 (01:41 +0900)] 
bpo-1635741: Port _gdbm module to multiphase initialization (GH-20920)

5 years agobpo-40958: Avoid buffer overflow in the parser when indexing the current line (GH...
Pablo Galindo [Tue, 16 Jun 2020 15:49:43 +0000 (16:49 +0100)] 
bpo-40958: Avoid buffer overflow in the parser when indexing the current line (GH-20875)

5 years agobpo-40989: Make _PyTraceMalloc_NewReference() internal (GH-20915)
Victor Stinner [Tue, 16 Jun 2020 15:29:50 +0000 (17:29 +0200)] 
bpo-40989: Make _PyTraceMalloc_NewReference() internal (GH-20915)

Make the _PyTraceMalloc_NewReference() function fully internal:
remove it from the public C API and don't export it anymore.

5 years agobpo-40993: Don't run Travis CI coverage on PRs (GH-20916)
Victor Stinner [Tue, 16 Jun 2020 15:27:30 +0000 (17:27 +0200)] 
bpo-40993: Don't run Travis CI coverage on PRs (GH-20916)

C and Python coverage jobs of Travis CI are no longer run on pull
requests, only on branches like master.

5 years agoRemove old comment in string_parser.c (GH-20906)
Pablo Galindo [Tue, 16 Jun 2020 01:13:33 +0000 (02:13 +0100)] 
Remove old comment in string_parser.c (GH-20906)

5 years agobpo-19569: Add a macro to suppress deprecation warnings (GH-9004)
Zackery Spytz [Tue, 16 Jun 2020 00:56:27 +0000 (18:56 -0600)] 
bpo-19569: Add a macro to suppress deprecation warnings (GH-9004)

Co-authored-by: Arfrever Frehtes Taifersar Arahesis <arfrever.fta@gmail.com>
5 years agobpo-40985: Show correct SyntaxError text when last line has a LINECONT (GH-20888)
Lysandros Nikolaou [Tue, 16 Jun 2020 00:27:33 +0000 (03:27 +0300)] 
bpo-40985: Show correct SyntaxError text when last line has a LINECONT (GH-20888)

When a file ends with a line that contains a line continuation character
the text of the emitted SyntaxError is empty, contrary to the old
parser, where the error text contained the text of the last line.

5 years agocloses bpo-28557: error message for bad raw readinto (GH-7496)
David Szotten [Mon, 15 Jun 2020 23:53:57 +0000 (00:53 +0100)] 
closes bpo-28557: error message for bad raw readinto (GH-7496)

Co-authored-by: Benjamin Peterson <benjamin@python.org>
5 years agobpo-40989: PyObject_INIT() becomes an alias to PyObject_Init() (GH-20901)
Victor Stinner [Mon, 15 Jun 2020 23:28:07 +0000 (01:28 +0200)] 
bpo-40989: PyObject_INIT() becomes an alias to PyObject_Init() (GH-20901)

The PyObject_INIT() and PyObject_INIT_VAR() macros become aliases to,
respectively, PyObject_Init() and PyObject_InitVar() functions.

Rename _PyObject_INIT() and _PyObject_INIT_VAR() static inline
functions to, respectively, _PyObject_Init() and _PyObject_InitVar(),
and move them to pycore_object.h. Remove their return value:
their return type becomes void.

The _datetime module is now built with the Py_BUILD_CORE_MODULE macro
defined.

Remove an outdated comment on _Py_tracemalloc_config.

5 years agobpo-36020: Require vsnprintf() to build Python (GH-20899)
Victor Stinner [Mon, 15 Jun 2020 22:54:44 +0000 (00:54 +0200)] 
bpo-36020: Require vsnprintf() to build Python (GH-20899)

The C99 functions snprintf() and vsnprintf() are now required
to build Python.

PyOS_snprintf() and PyOS_vsnprintf() no longer call Py_FatalError().
Previously, they called Py_FatalError() on a buffer overflow on platforms
which don't provide vsnprintf().

5 years agobpo-36020: Remove snprintf macro in pyerrors.h (GH-20889)
Victor Stinner [Mon, 15 Jun 2020 19:59:47 +0000 (21:59 +0200)] 
bpo-36020: Remove snprintf macro in pyerrors.h (GH-20889)

On Windows, #include "pyerrors.h" no longer defines "snprintf" and
"vsnprintf" macros.

PyOS_snprintf() and PyOS_vsnprintf() should be used to get portable
behavior.

Replace snprintf() calls with PyOS_snprintf() and replace vsnprintf()
calls with PyOS_vsnprintf().

5 years agobpo-38488: Upgrade bundled versions of pip & setuptools (GH-20491)
Xavier Fernandez [Mon, 15 Jun 2020 19:16:48 +0000 (21:16 +0200)] 
bpo-38488: Upgrade bundled versions of pip & setuptools (GH-20491)

5 years agobpo-40448: ensurepip: Do not use cache (GH-19812)
Krzysztof Konopko [Mon, 15 Jun 2020 17:28:46 +0000 (19:28 +0200)] 
bpo-40448: ensurepip: Do not use cache (GH-19812)

ensurepip optionally installs or upgrades 'pip' and 'setuptools' using
the version of those modules bundled with Python.  The internal PIP
installation routine by default temporarily uses its cache, if it
exists.  This is undesirable as Python builds and installations may be
independent of the user running the build, whilst PIP cache location
is dependent on the user's environment and outside of the build
environment.

At the same time, there's no value in using the cache while installing
bundled modules.

This change disables PIP caching when used in ensurepip.

5 years agobpo-1635741: Port _dbm module to multiphase initialization (GH-20848)
Dong-hee Na [Mon, 15 Jun 2020 16:20:54 +0000 (01:20 +0900)] 
bpo-1635741: Port _dbm module to multiphase initialization (GH-20848)

5 years agobpo-34226: fix cgi.parse_multipart without content_length (GH-8530)
roger [Mon, 15 Jun 2020 14:58:54 +0000 (16:58 +0200)] 
bpo-34226: fix cgi.parse_multipart without content_length (GH-8530)

In Python 3.7 the behavior of parse_multipart changed requiring CONTENT-LENGTH
header, this fix remove this header as required and fix FieldStorage
read_lines_to_outerboundary, by not using limit when it's negative,
since by default it's -1 if not content-length and keeps substracting what
was read from the file object.

Also added a test case for this problem.

5 years agobpo-40910: PyConfig_Clear() clears _orig_argv (GH-20886)
Victor Stinner [Mon, 15 Jun 2020 14:27:47 +0000 (16:27 +0200)] 
bpo-40910: PyConfig_Clear() clears _orig_argv (GH-20886)

bpo-40910, bpo-40953: PyConfig_Clear() clears _orig_argv.

5 years agoImprove readability and style in parser files (GH-20884)
Pablo Galindo [Mon, 15 Jun 2020 13:23:43 +0000 (14:23 +0100)] 
Improve readability and style in parser files (GH-20884)

5 years agobpo-29782: Consolidate _Py_Bit_Length() (GH-20739)
Niklas Fiekas [Mon, 15 Jun 2020 12:33:48 +0000 (14:33 +0200)] 
bpo-29782: Consolidate _Py_Bit_Length() (GH-20739)

In GH-2866, _Py_Bit_Length() was added to pymath.h for lack of a better
location. GH-20518 added a more appropriate header file for bit utilities. It
also shows how to properly use intrinsics. This allows reconsidering bpo-29782.

* Move the function to the new header.
* Changed return type to match __builtin_clzl() and reviewed usage.
* Use intrinsics where available.
* Pick a fallback implementation suitable for inlining.

5 years agobpo-40836: Add docstring to logging.fatal() and logging.Logger.fatal() (GH-20563)
Rémi Lapeyre [Mon, 15 Jun 2020 08:03:07 +0000 (10:03 +0200)] 
bpo-40836: Add docstring to logging.fatal() and logging.Logger.fatal() (GH-20563)

Automerge-Triggered-By: @vsajip
5 years agoFix trailing whitespace in keyword.py (GH-20881)
Pablo Galindo [Mon, 15 Jun 2020 03:33:33 +0000 (04:33 +0100)] 
Fix trailing whitespace in keyword.py (GH-20881)

5 years agoInclude soft keywords in keyword.py (GH-20877)
Pablo Galindo [Mon, 15 Jun 2020 02:55:15 +0000 (03:55 +0100)] 
Include soft keywords in keyword.py (GH-20877)

5 years agobpo-40890: Fix compiler warning in dictobject.c (GH-20876)
Pablo Galindo [Mon, 15 Jun 2020 01:05:20 +0000 (02:05 +0100)] 
bpo-40890: Fix compiler warning in dictobject.c (GH-20876)

5 years agoFixes dead links to Django's logging config docs (GH-20823)
kevin seelbach [Sun, 14 Jun 2020 17:23:47 +0000 (12:23 -0500)] 
Fixes dead links to Django's logging config docs (GH-20823)

Fixes two outdated URLs to point at the current "stable" version of Django's logging documentation.

Automerge-Triggered-By: @vsajip
5 years agobpo-30064: Fix slow asyncio sock test (GH-20868)
Fantix King [Sun, 14 Jun 2020 07:43:57 +0000 (02:43 -0500)] 
bpo-30064: Fix slow asyncio sock test (GH-20868)

Using a log2n way to fill a much smaller buffer, and receiving in a cleaner way with EOF.

The failing test was reproducible using the following command thanks to @aeros :

```bash
./python -m test test_asyncio.test_sock_lowlevel --match test_sock_client_racing -j100 -F -v
```

According to test results, we may still need to bump the timeout:

https://github.com/python/cpython/blob/5aad027db9618f22f6fa2274e05dd50f928d2ed7/Lib/test/test_asyncio/test_sock_lowlevel.py#L256-L257

5 years agoSome reformatting (suggested by Black) and minor factoring. (GH-20865)
Raymond Hettinger [Sun, 14 Jun 2020 02:17:28 +0000 (19:17 -0700)] 
Some reformatting (suggested by Black) and minor factoring. (GH-20865)

5 years agobpo-40855: Fix ignored mu and xbar parameters (GH-20835)
Raymond Hettinger [Sat, 13 Jun 2020 22:55:52 +0000 (15:55 -0700)] 
bpo-40855: Fix ignored mu and xbar parameters (GH-20835)

5 years agobpo-37674: Tweak imp module deprecation note in the docs (GH-20480)
Zackery Spytz [Sat, 13 Jun 2020 17:35:08 +0000 (11:35 -0600)] 
bpo-37674: Tweak imp module deprecation note in the docs (GH-20480)

5 years agoMinor code clean-ups (GH-20838)
Raymond Hettinger [Sat, 13 Jun 2020 16:46:47 +0000 (09:46 -0700)] 
Minor code clean-ups (GH-20838)

5 years agobpo-40957: Fix refleak in _Py_fopen_obj() (GH-20827)
Christian Heimes [Sat, 13 Jun 2020 15:57:22 +0000 (17:57 +0200)] 
bpo-40957: Fix refleak in _Py_fopen_obj() (GH-20827)

Signed-off-by: Christian Heimes <christian@python.org>
5 years agobpo-40834: Fix truncate when sending str object with channel (GH-20555)
An Long [Sat, 13 Jun 2020 12:26:01 +0000 (20:26 +0800)] 
bpo-40834: Fix truncate when sending str object with channel (GH-20555)

5 years agoRemove redundant var in PyErr_NewException() (GH-20850)
Hai Shi [Sat, 13 Jun 2020 06:58:12 +0000 (14:58 +0800)] 
Remove redundant var in PyErr_NewException() (GH-20850)

5 years agobpo-37556 Extend help to include latest overrides (GH-14701)
Steve (Gadget) Barnes [Fri, 12 Jun 2020 23:19:34 +0000 (00:19 +0100)] 
bpo-37556 Extend help to include latest overrides (GH-14701)

Modify the help in cpython/PC/launcher.c to show users that "latest" can be overridden by shebang, PY_PYTHON[n] or py.ini files. Also show that script [args] is optional by enclosing in square brackets.

Automerge-Triggered-By: @zooba
5 years agoMinor change on threading.Thread.native_id documentation. (GH-18129)
Antoine [Fri, 12 Jun 2020 22:50:18 +0000 (00:50 +0200)] 
Minor change on threading.Thread.native_id documentation. (GH-18129)

Remove duplication in `threading.Thread.native_id` documentation, so resulting documentation is more consistent with the `threading.Thread.ident`.

Issue initially raised [here](https://github.com/python/python-docs-fr/pull/1122#discussion_r369236634) (in French).

No issue associated to this PR.

Automerge-Triggered-By: @csabella
5 years agobpo-40164: Update Windows OpenSSL to 1.1.1g (GH-20834)
Srinivas Reddy Thatiparthy (శ్రీనివాస్ రెడ్డి తాటిపర్తి) [Fri, 12 Jun 2020 20:46:36 +0000 (02:16 +0530)] 
bpo-40164: Update Windows OpenSSL to 1.1.1g (GH-20834)

5 years agobpo-40964: disable remote IMAP tests (GH-20836)
Christian Heimes [Fri, 12 Jun 2020 18:54:03 +0000 (20:54 +0200)] 
bpo-40964: disable remote IMAP tests (GH-20836)

Remote host cyrus.andrew.cmu.edu is blocking incoming connections and is
causing test suite to fail.

Signed-off-by: Christian Heimes <christian@python.org>
5 years agobpo-40890: Add `mapping` property to dict views (GH-20749)
Dennis Sweeney [Fri, 12 Jun 2020 17:19:25 +0000 (13:19 -0400)] 
bpo-40890: Add `mapping` property to dict views (GH-20749)

5 years agobpo-40955: Fix memory leak in subprocess module (GH-20825)
Christian Heimes [Fri, 12 Jun 2020 16:18:43 +0000 (18:18 +0200)] 
bpo-40955: Fix memory leak in subprocess module (GH-20825)

```
Direct leak of 8 byte(s) in 1 object(s) allocated from:
    #0 0x7f008bf19667 in __interceptor_malloc (/lib64/libasan.so.6+0xb0667)
    #1 0x7f007a0bee4a in subprocess_fork_exec /home/heimes/dev/python/cpython/Modules/_posixsubprocess.c:774
    #2 0xe0305b in cfunction_call Objects/methodobject.c:546
```

Signed-off-by: Christian Heimes <christian@python.org>
5 years agoUpdate lexical_analysis.rst (GH-17508)
Géry Ogam [Fri, 12 Jun 2020 12:54:29 +0000 (14:54 +0200)] 
Update lexical_analysis.rst (GH-17508)

Use Sphinx role markup for `str.format`.

Automerge-Triggered-By: @csabella
5 years agobpo-33944: site: Add site-packages tracing in verbose mode (GH-12110)
native-api [Fri, 12 Jun 2020 06:20:11 +0000 (09:20 +0300)] 
bpo-33944: site: Add site-packages tracing in verbose mode (GH-12110)

5 years agobpo-40950: Port nis module to multiphase initialization (GH-20811)
Dong-hee Na [Fri, 12 Jun 2020 02:26:00 +0000 (11:26 +0900)] 
bpo-40950: Port nis module to multiphase initialization (GH-20811)

5 years agobpo-40939: Clean and adapt the peg_generator directory after deleting the old parser...
Pablo Galindo [Fri, 12 Jun 2020 00:55:35 +0000 (01:55 +0100)] 
bpo-40939: Clean and adapt the peg_generator directory after deleting the old parser (GH-20822)

5 years agoRemove unnecessary grammar decorations and change header (GH-20819)
Pablo Galindo [Thu, 11 Jun 2020 23:51:44 +0000 (00:51 +0100)] 
Remove unnecessary grammar decorations and change header (GH-20819)

5 years agobpo-40626: Support HDF5 in mimetypes (GH-20042)
MARK SCHWAB [Thu, 11 Jun 2020 19:04:13 +0000 (13:04 -0600)] 
bpo-40626: Support HDF5 in mimetypes (GH-20042)

Add hdf5 with .h5 file extension

See 'Recommendations' section for mime types from the HDF group:  https://www.hdfgroup.org/2018/06/citations-for-hdf-data-and-software/

Patch by Mark Schwab.

5 years agobpo-29620: iterate over a copy of sys.modules (GH-4800)
kernc [Thu, 11 Jun 2020 18:03:29 +0000 (20:03 +0200)] 
bpo-29620: iterate over a copy of sys.modules (GH-4800)

unittest.TestCase.assertWarns no longer raises a RuntimeException
when accessing a module's ``__warningregistry__`` causes importation of a new
module, or when a new module is imported in another thread.

Patch by Kernc.

5 years agobpo-40939: Remove some extra references to PYTHONOLDPARSER (GH-20815)
Pablo Galindo [Thu, 11 Jun 2020 17:08:05 +0000 (18:08 +0100)] 
bpo-40939: Remove some extra references to PYTHONOLDPARSER (GH-20815)

Automerge-Triggered-By: @pablogsal
5 years agobpo-40939: Remove the old parser (GH-20768)
Pablo Galindo [Thu, 11 Jun 2020 16:30:46 +0000 (17:30 +0100)] 
bpo-40939: Remove the old parser (GH-20768)

This commit removes the old parser, the deprecated parser module, the old parser compatibility flags and environment variables and all associated support code and documentation.

5 years agobpo-40275: Move TransientResource to test_urllib2net (GH-20812)
Victor Stinner [Thu, 11 Jun 2020 16:26:23 +0000 (18:26 +0200)] 
bpo-40275: Move TransientResource to test_urllib2net (GH-20812)

Move TransientResource, time_out, socket_peer_reset and
ioerror_peer_reset from test.support to test_urllib2net.

Remove "import errno" from test.support.

5 years agobpo-40939: Remove PEG parser easter egg (__new_parser__) (#20802)
Lysandros Nikolaou [Thu, 11 Jun 2020 16:09:21 +0000 (19:09 +0300)] 
bpo-40939: Remove PEG parser easter egg (__new_parser__) (#20802)

It no longer serves a purpose (there's only one parser) and having "new" in any name will eventually look odd. Also, it impinges on a potential sub-namespace, `__new_...__`.

5 years agobpo-40275: Add warnings_helper submodule in test.support (GH-20797)
Hai Shi [Thu, 11 Jun 2020 15:36:06 +0000 (23:36 +0800)] 
bpo-40275: Add warnings_helper submodule in test.support (GH-20797)

5 years agobpo-40275: test.supports imports lazily fnmatch, glob, struct (GH-20810)
Victor Stinner [Thu, 11 Jun 2020 15:30:57 +0000 (17:30 +0200)] 
bpo-40275: test.supports imports lazily fnmatch, glob, struct (GH-20810)

5 years agobpo-40947: getpath.c uses PyConfig.platlibdir (GH-20807)
Victor Stinner [Thu, 11 Jun 2020 15:28:52 +0000 (17:28 +0200)] 
bpo-40947: getpath.c uses PyConfig.platlibdir (GH-20807)

Followup of bpo-40854, there is one remaining usage of PLATLIBDIR
which should be replaced by config->platlibdir.

test_sys checks that sys.platlibdir attribute exists and is a string.

Update Makefile: getpath.c and sysmodule.c no longer need PLATLIBDIR
macro, PyConfig.platlibdir member is used instead.

Co-authored-by: Sandro Mani <manisandro@gmail.com>
5 years agobpo-34401: Fix test_gdb for HP GDB version string (GH-20804)
Victor Stinner [Thu, 11 Jun 2020 13:48:03 +0000 (15:48 +0200)] 
bpo-34401: Fix test_gdb for HP GDB version string (GH-20804)

The GDB provided by HPE on HP-UX contains a modified version string. Therefore
the tests fail. Adapt the regex to match that string.

Patch by Michael Osipov.

Co-Authored-by: Michael Osipov <michael.osipov@siemens.com>
5 years agobpo-40939: Generate keyword.py using the new parser (GH-20800)
Lysandros Nikolaou [Thu, 11 Jun 2020 12:45:15 +0000 (15:45 +0300)] 
bpo-40939: Generate keyword.py using the new parser (GH-20800)

5 years agobpo-40925: Remove unused stack macro SET_VALUE (GH-20783)
Dong-hee Na [Thu, 11 Jun 2020 09:39:18 +0000 (18:39 +0900)] 
bpo-40925: Remove unused stack macro SET_VALUE (GH-20783)

5 years agoCollections module reformatting and minor code refactoring (GH-20772)
Raymond Hettinger [Thu, 11 Jun 2020 06:17:58 +0000 (23:17 -0700)] 
Collections module reformatting and minor code refactoring (GH-20772)

5 years agobpo-40847: Consider a line with only a LINECONT a blank line (GH-20769)
Lysandros Nikolaou [Wed, 10 Jun 2020 23:56:08 +0000 (02:56 +0300)] 
bpo-40847: Consider a line with only a LINECONT a blank line (GH-20769)

A line with only a line continuation character should be considered
a blank line at tokenizer level so that only a single NEWLINE token
gets emitted. The old parser was working around the issue, but the
new parser threw a `SyntaxError` for valid input. For example,
an empty line following a line continuation character was interpreted
as a `SyntaxError`.

Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
5 years agobpo-40275: Add import_helper submodule in test.support (GH-20794)
Hai Shi [Wed, 10 Jun 2020 23:51:18 +0000 (07:51 +0800)] 
bpo-40275: Add import_helper submodule in test.support (GH-20794)

5 years agoRestrict co_code to be under INT_MAX in codeobject (GH-20628)
Ammar Askar [Wed, 10 Jun 2020 23:31:22 +0000 (23:31 +0000)] 
Restrict co_code to be under INT_MAX in codeobject (GH-20628)

5 years agobpo-40895: Update weakref documentation to remove old warnings (GH-20687)
Daniel Fortunov [Wed, 10 Jun 2020 20:26:49 +0000 (21:26 +0100)] 
bpo-40895: Update weakref documentation to remove old warnings (GH-20687)

The doccumentation at https://docs.python.org/3.10/library/weakref.html cautions that the `WeakKeyDictionary` and `WeakValueDictionary` are susceptible to the problem of dictionary mutation during iteration.

These notes present the user with a problem that has no easy solution.

I dug into the implementation and found that fortunately, Antoine Pitrou already addressed this challenge (10 years ago!) by introducing an `_IterationGuard` context manager to the implementation, which delays mutation while an iteration is in progress.

I asked for confirmation and @pitrou agreed that these notes could be removed:
https://github.com/python/cpython/commit/c1baa601e2b558deb690edfdf334fceee3b03327#commitcomment-39514438

5 years agobpo-39465: Use _PyInterpreterState_GET() (GH-20788)
Victor Stinner [Wed, 10 Jun 2020 18:08:26 +0000 (20:08 +0200)] 
bpo-39465: Use _PyInterpreterState_GET() (GH-20788)

Replace _PyThreadState_GET() with _PyInterpreterState_GET() in:

* get_small_int()
* gcmodule.c: add also get_gc_state() function
* _PyTrash_deposit_object()
* _PyTrash_destroy_chain()
* warnings_get_state()
* Py_GetRecursionLimit()

Cleanup listnode.c: add 'parser' variable.

5 years agobpo-40927: Fix test_binhex when run twice (GH-20764)
Victor Stinner [Wed, 10 Jun 2020 17:54:29 +0000 (19:54 +0200)] 
bpo-40927: Fix test_binhex when run twice (GH-20764)

test_binhex now uses import_fresh_module() to ensure that it raises
DeprecationWarning each time.

5 years ago_PyPreConfig_Read() decodes argv at each iteration (GH-20786)
Victor Stinner [Wed, 10 Jun 2020 17:33:11 +0000 (19:33 +0200)] 
_PyPreConfig_Read() decodes argv at each iteration (GH-20786)

_PyPreConfig_Read() now calls _PyPreCmdline_SetArgv() at each
iteration, so bytes strings are decoded from the new encoding.

5 years agobpo-40826: Fix test_repl.test_close_stdin() on Windows (GH-20779)
Victor Stinner [Wed, 10 Jun 2020 16:49:23 +0000 (18:49 +0200)] 
bpo-40826: Fix test_repl.test_close_stdin() on Windows (GH-20779)

test_repl.test_close_stdin() now calls
support.suppress_msvcrt_asserts() to fix the test on Windows.

* Move suppress_msvcrt_asserts() from test.libregrtest.setup to
  test.support. Make its verbose parameter optional: verbose=False by
  default.
* Add msvcrt.GetErrorMode().
* SuppressCrashReport now uses GetErrorMode() and SetErrorMode() of
  the msvcrt module, rather than using ctypes.
* Remove also an unused variable (deadline) in wait_process().

5 years agobpo-40943: Replace PY_FORMAT_SIZE_T with "z" (GH-20781)
Victor Stinner [Wed, 10 Jun 2020 16:38:05 +0000 (18:38 +0200)] 
bpo-40943: Replace PY_FORMAT_SIZE_T with "z" (GH-20781)

The PEP 353, written in 2005, introduced PY_FORMAT_SIZE_T. Python no
longer supports macOS 10.4 and Visual Studio 2010, but requires more
recent macOS and Visual Studio versions. In 2020 with Python 3.10, it
is now safe to use directly "%zu" to format size_t and "%zi" to
format Py_ssize_t.

5 years agobpo-40703: Let PyType_FromSpec() set "type.__module__" only if it is not set yet...
scoder [Wed, 10 Jun 2020 16:09:01 +0000 (18:09 +0200)] 
bpo-40703: Let PyType_FromSpec() set "type.__module__" only if it is not set yet. (GH-20273)

5 years agobpo-36543: Revert "bpo-36543: Remove the xml.etree.cElementTree module." (GH-20117)
Serhiy Storchaka [Wed, 10 Jun 2020 15:39:12 +0000 (18:39 +0300)] 
bpo-36543: Revert "bpo-36543: Remove the xml.etree.cElementTree module." (GH-20117)

* Revert "bpo-36543: Remove the xml.etree.cElementTree module. (GH-19108)"

This reverts commit b33e52511a59c6da7132c226b7f7489b092a33eb.

5 years agoRaise specialised syntax error for invalid lambda parameters (GH-20776)
Pablo Galindo [Wed, 10 Jun 2020 13:07:06 +0000 (14:07 +0100)] 
Raise specialised syntax error for invalid lambda parameters (GH-20776)

5 years agobpo-40275: Add os_helper submodule in test.support (GH-20765)
Hai Shi [Wed, 10 Jun 2020 12:29:02 +0000 (20:29 +0800)] 
bpo-40275: Add os_helper submodule in test.support (GH-20765)

5 years agobpo-40889: Optimize dict.items() ^ dict.items() (GH-20718)
Dennis Sweeney [Wed, 10 Jun 2020 05:56:56 +0000 (01:56 -0400)] 
bpo-40889: Optimize dict.items() ^ dict.items() (GH-20718)

5 years agobpo-32604: Recommit "bpo-32604: PEP 554 for use in test suite (GH-19985)" (GH-20611)
Joannah Nanjekye [Wed, 10 Jun 2020 03:53:23 +0000 (00:53 -0300)] 
bpo-32604: Recommit "bpo-32604: PEP 554 for use in test suite (GH-19985)" (GH-20611)

* PEP 554 for use in test suite

* 📜🤖 Added by blurb_it.

* Fix space

* Add doc to doc tree

* Move to modules doc tree

* Fix suspicious doc errors

* Fix test__all

* Docs docs docs

* Support isolated and fix wait

* Fix white space

* Remove undefined from __all__

* Fix recv and add exceptions

* Remove unused exceptions, fix pep 8 formatting errors and fix _NOT_SET in recv_nowait()

* Update Lib/test/support/interpreters.py

Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
* Remove documentation (module is for internal use)

Co-authored-by: nanjekyejoannah <joannah.nanjekye@ibm.com>
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
5 years agobpo-34003: Re-add versionchanged entry in csv docs (GH-20657)
Éric Araujo [Wed, 10 Jun 2020 01:02:11 +0000 (21:02 -0400)] 
bpo-34003: Re-add versionchanged entry in csv docs (GH-20657)

Follow-up to GH-8014

5 years agoRemove usesless function from csv module (GH-20762)
Dong-hee Na [Tue, 9 Jun 2020 15:33:43 +0000 (00:33 +0900)] 
Remove usesless function from csv module (GH-20762)

5 years agobpo-40684: Fix make install for platlibdir=lib64 (GH-20736)
Victor Stinner [Tue, 9 Jun 2020 13:32:43 +0000 (15:32 +0200)] 
bpo-40684: Fix make install for platlibdir=lib64 (GH-20736)

"make install" now uses the PLATLIBDIR variable for the destination
lib-dynload/ directory when ./configure --with-platlibdir is used.

Update --with-platlibdir comment in configure.

5 years agoRemove reference to 3.7 and 3.8 backports. (GH-20754)
Stefan Krah [Tue, 9 Jun 2020 08:27:45 +0000 (10:27 +0200)] 
Remove reference to 3.7 and 3.8 backports. (GH-20754)

5 years agoMinor improvement to the namedtuple implementation (GH-20741)
Raymond Hettinger [Mon, 8 Jun 2020 19:38:41 +0000 (12:38 -0700)] 
Minor improvement to the namedtuple implementation (GH-20741)

* Cleaner way to build the arg list with a trailing comma when required

* Fix appearance of __new__ in help()

5 years agobpo-24914: mention Python supports multiple paradigms in the FAQ (#20658)
Brett Cannon [Mon, 8 Jun 2020 18:07:29 +0000 (11:07 -0700)] 
bpo-24914: mention Python supports multiple paradigms in the FAQ (#20658)

5 years agobpo-40854: PYTHONPLATLIBDIR env var added to 3.9 (GH-20735)
Victor Stinner [Mon, 8 Jun 2020 18:04:47 +0000 (20:04 +0200)] 
bpo-40854: PYTHONPLATLIBDIR env var added to 3.9 (GH-20735)

5 years agoAdd multicore support to deccheck.py. (GH-20731)
Stefan Krah [Mon, 8 Jun 2020 17:33:12 +0000 (19:33 +0200)] 
Add multicore support to deccheck.py. (GH-20731)

5 years agoRemove deleted libmpdec header from the Visual Studio build machinery. (GH-20730)
Stefan Krah [Mon, 8 Jun 2020 17:31:29 +0000 (19:31 +0200)] 
Remove deleted libmpdec header from the Visual Studio build machinery. (GH-20730)

5 years agobpo-40861: Enable optimizations when building liblzma (GH-20724)
Steve Dower [Mon, 8 Jun 2020 16:48:43 +0000 (17:48 +0100)] 
bpo-40861: Enable optimizations when building liblzma (GH-20724)

5 years agobpo-40910: Export Py_GetArgcArgv() function (GH-20721)
Victor Stinner [Mon, 8 Jun 2020 16:12:59 +0000 (18:12 +0200)] 
bpo-40910: Export Py_GetArgcArgv() function (GH-20721)

Export explicitly the Py_GetArgcArgv() function to the C API and
document the function. Previously, it was exported implicitly which
no longer works since Python is built with -fvisibility=hidden.

* Add PyConfig._orig_argv member.
* Py_InitializeFromConfig() no longer calls _PyConfig_Write() twice.
* PyConfig_Read() no longer initializes Py_GetArgcArgv(): it is now
  _PyConfig_Write() responsibility.
* _PyConfig_Write() result type becomes PyStatus instead of void.
* Write an unit test on Py_GetArgcArgv().

5 years agobpo-40854: Allow overriding sys.platlibdir via PYTHONPLATLIBDIR env-var (GH-20605)
Sandro Mani [Mon, 8 Jun 2020 15:28:11 +0000 (17:28 +0200)] 
bpo-40854: Allow overriding sys.platlibdir via PYTHONPLATLIBDIR env-var (GH-20605)

5 years agobpo-29882: Add _Py_popcount32() function (GH-20518)
Victor Stinner [Mon, 8 Jun 2020 14:30:33 +0000 (16:30 +0200)] 
bpo-29882: Add _Py_popcount32() function (GH-20518)

* Rename pycore_byteswap.h to pycore_bitutils.h.
* Move popcount_digit() to pycore_bitutils.h as _Py_popcount32().
* _Py_popcount32() uses GCC and clang builtin function if available.
* Add unit tests to _Py_popcount32().

5 years agobpo-33187: Document 3.9 changes to xml.etree.ElementInclude.include (GH-20438)
Shantanu [Mon, 8 Jun 2020 14:11:44 +0000 (07:11 -0700)] 
bpo-33187: Document 3.9 changes to xml.etree.ElementInclude.include (GH-20438)

Looks like the merging of bpo-33187 and bpo-20928 was racy, resulting in
this change going undocumented.

5 years agoallow macOS installer builds to package pre-built html docs (GH-20715)
Ned Deily [Mon, 8 Jun 2020 07:52:43 +0000 (03:52 -0400)] 
allow macOS installer builds to package pre-built html docs (GH-20715)

build-installer now looks in its directory of source tarballs
for a suitable html tarball of the same version.  If so, it
will unpack and use it rather than rebuilding the html format
documentation set from the source repo.  This is intended as
a speedup for test builds of the installer.  Files names must
be in the same format as produced by the docs build for download,
for example, `python-3.9.0b1-docs-html.tar.bz2`.

5 years agoDeny eval() direct access to builtins (GH-20713)
Raymond Hettinger [Mon, 8 Jun 2020 06:51:40 +0000 (23:51 -0700)] 
Deny eval() direct access to builtins (GH-20713)

5 years agobpo-22021: Update root_dir and base_dir documentation in shutil (GH-10367)
Lysandros Nikolaou [Mon, 8 Jun 2020 05:01:21 +0000 (08:01 +0300)] 
bpo-22021: Update root_dir and base_dir documentation in shutil (GH-10367)

Also added an example in shutil in order to make more clear how they are to be used.

Initially reported by Weinan Li on bpo.

5 years agobpo-40741: Update macOS installer to use SQLite 3.32.2. (GH-20705)
Ned Deily [Mon, 8 Jun 2020 02:24:33 +0000 (22:24 -0400)] 
bpo-40741: Update macOS installer to use SQLite 3.32.2. (GH-20705)

5 years agobpo-40903: Handle multiple '=' in invalid assignment rules in the PEG parser (GH...
Pablo Galindo [Mon, 8 Jun 2020 01:57:00 +0000 (02:57 +0100)] 
bpo-40903: Handle multiple '=' in invalid assignment rules in the PEG parser (GH-20697)

Automerge-Triggered-By: @pablogsal
5 years agobpo-39791 native hooks for importlib.resources.files (GH-20576)
Jason R. Coombs [Mon, 8 Jun 2020 01:00:51 +0000 (21:00 -0400)] 
bpo-39791 native hooks for importlib.resources.files (GH-20576)

* Provide native .files support on SourceFileLoader.

* Add native importlib.resources.files() support to zipimporter. Remove fallback support.

* make regen-all

* 📜🤖 Added by blurb_it.

* Move 'files' into the ResourceReader so it can carry the relevant module name context.

* Create 'importlib.readers' module and add FileReader to it.

* Add zip reader and rely on it for a TraversableResources object on zipimporter.

* Remove TraversableAdapter, no longer needed.

* Update blurb.

* Replace backslashes with forward slashes.

* Incorporate changes from importlib_metadata 2.0, finalizing the interface for extension via get_resource_reader.

Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
5 years agobpo-40904: Fix segfault in the new parser with f-string containing yield statements...
Pablo Galindo [Mon, 8 Jun 2020 00:47:37 +0000 (01:47 +0100)] 
bpo-40904: Fix segfault in the new parser with f-string containing yield statements with no value (GH-20701)

5 years agobpo-40887: Don't use finalized free lists (GH-20700)
Victor Stinner [Mon, 8 Jun 2020 00:14:47 +0000 (02:14 +0200)] 
bpo-40887: Don't use finalized free lists (GH-20700)

In debug mode, ensure that free lists are no longer used after being
finalized. Set numfree to -1 in finalization functions
(eg. _PyList_Fini()), and then check that numfree is not equal to -1
before using a free list (e.g list_dealloc()).

5 years agobpo-40881: Fix unicode_release_interned() (GH-20699)
Victor Stinner [Sun, 7 Jun 2020 23:39:47 +0000 (01:39 +0200)] 
bpo-40881: Fix unicode_release_interned() (GH-20699)

Use Py_SET_REFCNT() in unicode_release_interned().

5 years agobpo-40887: Fix finalize_interp_clear() for free lists (GH-20698)
Victor Stinner [Sun, 7 Jun 2020 23:22:36 +0000 (01:22 +0200)] 
bpo-40887: Fix finalize_interp_clear() for free lists (GH-20698)

Reorganize code to ensure that free lists are cleared in the right
order. Call _PyWarnings_Fini() before _PyList_Fini().