]> git.ipfire.org Git - thirdparty/Python/cpython.git/log
thirdparty/Python/cpython.git
4 years agobpo-42425: Fix possible leak in initialization of errmap for OSError (GH-23446)
Serhiy Storchaka [Sat, 21 Nov 2020 17:17:46 +0000 (19:17 +0200)] 
bpo-42425: Fix possible leak in initialization of errmap for OSError (GH-23446)

4 years agobpo-42232: mmap module add Darwin specific madvise options. (GH-23076)
David CARLIER [Sat, 21 Nov 2020 11:39:56 +0000 (11:39 +0000)] 
bpo-42232: mmap module add Darwin specific madvise options. (GH-23076)

4 years agobpo-42412: Fix possible leaks and check arguments in PyType_FromModuleAndSpec() ...
Serhiy Storchaka [Sat, 21 Nov 2020 10:02:53 +0000 (12:02 +0200)] 
bpo-42412: Fix possible leaks and check arguments in PyType_FromModuleAndSpec() (GH-23410)

* There were leaks if Py_tp_bases is used more than once or if some call is
  failed before setting tp_bases.
* There was a crash if the bases argument or the Py_tp_bases slot is not a tuple.
* The documentation was not accurate.

4 years agobpo-40550: Fix time-of-check/time-of-action issue in subprocess.Popen.send_signal...
Filipe Laíns [Sat, 21 Nov 2020 09:22:08 +0000 (09:22 +0000)] 
bpo-40550: Fix time-of-check/time-of-action issue in subprocess.Popen.send_signal. (GH-20010)

send_signal() now swallows the exception if the process it thought was still alive winds up not to exist anymore (always a plausible race condition despite the checks).

Co-authored-by: Gregory P. Smith <greg@krypto.org>
4 years agobpo-40791: Make compare_digest more constant-time. (GH-20444)
Devin Jeanpierre [Sat, 21 Nov 2020 08:55:23 +0000 (01:55 -0700)] 
bpo-40791: Make compare_digest more constant-time. (GH-20444)

* bpo-40791: Make compare_digest more constant-time.

The existing volatile `left`/`right` pointers guarantee that the reads will all occur, but does not guarantee that they will be _used_. So a compiler can still short-circuit the loop, saving e.g. the overhead of doing the xors and especially the overhead of the data dependency between `result` and the reads. That would change performance depending on where the first unequal byte occurs. This change removes that optimization.

(This is change #1 from https://bugs.python.org/issue40791 .)

4 years agobpo-42419: Correct 'deprecatations' is What's New 3.9 (GH-23421)
Quentin Hibon [Sat, 21 Nov 2020 04:07:22 +0000 (05:07 +0100)] 
bpo-42419: Correct 'deprecatations' is What's New 3.9 (GH-23421)

4 years agobpo-42407: Use possessive appostrophe in multiprocessing doc (GH-23400)
ArioA [Sat, 21 Nov 2020 02:37:54 +0000 (02:37 +0000)] 
bpo-42407: Use possessive appostrophe in multiprocessing doc (GH-23400)

4 years agobpo-36876: [c-analyzer tool] Tighten up the results and output. (GH-23431)
Eric Snow [Fri, 20 Nov 2020 22:39:28 +0000 (15:39 -0700)] 
bpo-36876: [c-analyzer tool] Tighten up the results and output. (GH-23431)

We also update the "ignored" file with a temporary list of all known globals.

4 years agobpo-28002: Roundtrip f-strings with ast.unparse better (#19612)
Shantanu [Fri, 20 Nov 2020 21:16:42 +0000 (13:16 -0800)] 
bpo-28002: Roundtrip f-strings with ast.unparse better (#19612)

By attempting to avoid backslashes in f-string expressions.
We also now proactively raise errors for some backslashes we can't
avoid while unparsing FormattedValues

Co-authored-by: hauntsaninja <>
Co-authored-by: Shantanu <hauntsaninja@users.noreply.github.com>
Co-authored-by: Batuhan Taskaya <isidentical@gmail.com>
4 years agobpo-42360: Add advice to help avoid pickling issues. (GH-23305)
Raymond Hettinger [Fri, 20 Nov 2020 20:49:32 +0000 (12:49 -0800)] 
bpo-42360: Add advice to help avoid pickling issues. (GH-23305)

4 years agoFix wrong availability for signal.SIGCHLD (#23285)
Zhang Maiyun [Fri, 20 Nov 2020 18:16:46 +0000 (02:16 +0800)] 
Fix wrong availability for signal.SIGCHLD (#23285)

I believe this is a mistake. SIGCHLD is only available on Unix systems, not Windows.

4 years agobpo-35498: Added slice support to PathLib parents attribute. (GH-11165)
Joshua Cannon [Fri, 20 Nov 2020 15:40:39 +0000 (09:40 -0600)] 
bpo-35498: Added slice support to PathLib parents attribute. (GH-11165)

Added slice support to the `pathlib.Path.parents` sequence. For a `Path` `p`, slices of `p.parents` should return the same thing as slices of `tuple(p.parents)`.

4 years agobpo-42212: Check if generated files are up-to-date in GitHub Actions (GH-23042)
Filipe Laíns [Fri, 20 Nov 2020 14:14:16 +0000 (14:14 +0000)] 
bpo-42212: Check if generated files are up-to-date in GitHub Actions (GH-23042)

See https: //github.com/python/core-workflow/issues/380

Signed-off-by: Filipe Laíns <lains@archlinux.org>
4 years agobpo-42403: Use @staticmethod in importlib (GH-23395)
Victor Stinner [Fri, 20 Nov 2020 13:44:02 +0000 (14:44 +0100)] 
bpo-42403: Use @staticmethod in importlib (GH-23395)

Use @staticmethod on methods using @classmethod but don't use their
cls parameter on the following classes:

* BuiltinImporter
* FrozenImporter
* WindowsRegistryFinder
* PathFinder

Leave methods using @_requires_builtin or @_requires_frozen unchanged,
since this decorator requires the wrapped method to have an extra parameter
(cls or self).

4 years agobpo-1635741: Convert _sre types to heap types and establish module state (PEP 384...
Erlend Egeberg Aasland [Fri, 20 Nov 2020 12:36:23 +0000 (13:36 +0100)] 
bpo-1635741: Convert _sre types to heap types and establish module state (PEP 384) (GH-23393)

4 years agobpo-1635741: Enhance _datetime error handling (GH-23139)
Mohamed Koubaa [Fri, 20 Nov 2020 10:39:40 +0000 (04:39 -0600)] 
bpo-1635741: Enhance _datetime error handling (GH-23139)

4 years agobpo-42333: Port _ssl extension module to heap types (GH-23392)
Christian Heimes [Fri, 20 Nov 2020 08:40:12 +0000 (09:40 +0100)] 
bpo-42333: Port _ssl extension module to heap types (GH-23392)

All types in _ssl module are now heap types.

4 years agobpo-42413: socket.timeout is now an alias of TimeoutError (GH-23413)
Christian Heimes [Fri, 20 Nov 2020 08:26:07 +0000 (09:26 +0100)] 
bpo-42413: socket.timeout is now an alias of TimeoutError (GH-23413)

Signed-off-by: Christian Heimes <christian@python.org>
4 years agobpo-42416: Use inspect.getdoc for IDLE calltips (GH-23416)
Terry Jan Reedy [Fri, 20 Nov 2020 06:59:11 +0000 (01:59 -0500)] 
bpo-42416: Use inspect.getdoc for IDLE calltips (GH-23416)

Inspect.getdoc(ob) sometimes gets docstrings when ob.__doc__ is None.

4 years agobpo-42345: Add whatsnew and versionchanged for typing.Literal in 3.9 (GH-23386)
kj [Thu, 19 Nov 2020 17:37:26 +0000 (00:37 +0700)] 
bpo-42345: Add whatsnew and versionchanged for typing.Literal in 3.9 (GH-23386)

* Whatsnew entry in 3.9 same as the one in 3.10.
* versionchanged for typing.Literal docs

Needs backport to 3.9.

4 years agobpo-42345: Fix hash implementation of typing.Literal (GH-23383)
Yurii Karabas [Thu, 19 Nov 2020 16:17:38 +0000 (18:17 +0200)] 
bpo-42345: Fix hash implementation of typing.Literal (GH-23383)

Fix hash implementation of `typing.Literal`.

Update docs regarding `typing.Litaral` caching.

Base implementation was done in PR #23294.

4 years agobpo-1635741: Port _posixshmem extension module to multiphase initialization (GH-23404)
Christian Heimes [Thu, 19 Nov 2020 15:20:42 +0000 (16:20 +0100)] 
bpo-1635741: Port _posixshmem extension module to multiphase initialization (GH-23404)

Signed-off-by: Christian Heimes <christian@python.org>
4 years agobpo-1635741: Fix _struct for build bot error (GH-23402)
Dong-hee Na [Thu, 19 Nov 2020 14:14:34 +0000 (23:14 +0900)] 
bpo-1635741: Fix _struct for build bot error (GH-23402)

Automerge-Triggered-By: GH:tiran
4 years agobpo-1635741: Port gc module to multiphase initialization (GH-23377)
Christian Heimes [Thu, 19 Nov 2020 14:08:34 +0000 (15:08 +0100)] 
bpo-1635741: Port gc module to multiphase initialization (GH-23377)

Signed-off-by: Christian Heimes <christian@python.org>
Automerge-Triggered-By: GH:tiran
4 years agobpo-1635741: Port _struct to multiphase initialization (GH-23398)
Christian Heimes [Thu, 19 Nov 2020 13:36:23 +0000 (14:36 +0100)] 
bpo-1635741: Port _struct to multiphase initialization (GH-23398)

Signed-off-by: Christian Heimes <christian@python.org>
4 years agobpo-42403: Simplify importlib external bootstrap (GH-23397)
Victor Stinner [Thu, 19 Nov 2020 12:43:43 +0000 (13:43 +0100)] 
bpo-42403: Simplify importlib external bootstrap (GH-23397)

Simplify the importlib external bootstrap code:
importlib._bootstrap_external now uses regular imports to import
builtin modules. When it is imported, the builtin __import__()
function is already fully working and so can be used to import
builtin modules like sys.

4 years agobpo-42403: Fix pyflakes warnings in importlib (GH-23396)
Victor Stinner [Thu, 19 Nov 2020 10:20:57 +0000 (11:20 +0100)] 
bpo-42403: Fix pyflakes warnings in importlib (GH-23396)

Remove unused imports and unused local variables.

4 years agobpo-1635741: Port spwd to multiphase initialization (GH-23390)
Christian Heimes [Thu, 19 Nov 2020 09:54:03 +0000 (10:54 +0100)] 
bpo-1635741: Port spwd to multiphase initialization (GH-23390)

Signed-off-by: Christian Heimes <christian@python.org>
4 years agobpo-1635741: Port _queue to multiphase initialization (GH-23376)
Christian Heimes [Thu, 19 Nov 2020 08:24:37 +0000 (09:24 +0100)] 
bpo-1635741: Port _queue to multiphase initialization (GH-23376)

Signed-off-by: Christian Heimes <christian@python.org>
Automerge-Triggered-By: GH:tiran
4 years agobpo-1635741: Port grp and pwd to multiphase initialization (GH-23360)
Christian Heimes [Thu, 19 Nov 2020 07:47:32 +0000 (08:47 +0100)] 
bpo-1635741: Port grp and pwd to multiphase initialization (GH-23360)

Signed-off-by: Christian Heimes <christian@python.org>
4 years agobpo-1635741: Port _random to multiphase initialization (GH-23359)
Christian Heimes [Thu, 19 Nov 2020 07:46:29 +0000 (08:46 +0100)] 
bpo-1635741: Port _random to multiphase initialization (GH-23359)

Signed-off-by: Christian Heimes <christian@python.org>
4 years agobpo-42375: subprocess DragonFlyBSD build update. (GH-23320)
David CARLIER [Thu, 19 Nov 2020 07:24:15 +0000 (07:24 +0000)] 
bpo-42375: subprocess DragonFlyBSD build update. (GH-23320)

Same as FreeBSD, file descriptors in /dev/fd id from 0 to 63.

4 years agobpo-42345: Add whatsnew for typing.Literal in 3.10 (GH-23385)
kj [Thu, 19 Nov 2020 04:44:24 +0000 (11:44 +0700)] 
bpo-42345: Add whatsnew for typing.Literal in 3.10 (GH-23385)

4 years agobpo-42381: Document walrus-related syntax changes in whatsnew (GH-23382)
Lysandros Nikolaou [Wed, 18 Nov 2020 23:49:28 +0000 (01:49 +0200)] 
bpo-42381: Document walrus-related syntax changes in whatsnew (GH-23382)

Automerge-Triggered-By: GH:lysnikolaou
4 years agobpo-1635741: Port _warnings to the multi-phase init (GH-23379)
Victor Stinner [Wed, 18 Nov 2020 23:19:06 +0000 (00:19 +0100)] 
bpo-1635741: Port _warnings to the multi-phase init (GH-23379)

Port the _warnings extension module to the multi-phase initialization
API (PEP 489).

4 years ago[doc] Fix smtplib and xml.dom.minidom mark-up (GH-22769)
Andre Delfino [Wed, 18 Nov 2020 22:45:17 +0000 (19:45 -0300)] 
[doc] Fix smtplib and xml.dom.minidom mark-up (GH-22769)

4 years agobpo-1635741: Convert _imp to multi-phase init (GH-23378)
Victor Stinner [Wed, 18 Nov 2020 22:18:29 +0000 (23:18 +0100)] 
bpo-1635741: Convert _imp to multi-phase init (GH-23378)

Convert the _imp extension module to the multi-phase initialization
API (PEP 489).

* Add _PyImport_BootstrapImp() which fix a bootstrap issue: import
  the _imp module before importlib is initialized.
* Add create_builtin() sub-function, used by _imp_create_builtin().
* Initialize PyInterpreterState.import_func earlier, in
  pycore_init_builtins().
* Remove references to _PyImport_Cleanup(). This function has been
  renamed to finalize_modules() and moved to pylifecycle.c.

4 years agobpo-39573: Remove What's new entry for Py_SIZE() (GH-23375)
Miro Hrončok [Wed, 18 Nov 2020 21:39:03 +0000 (22:39 +0100)] 
bpo-39573: Remove What's new entry for Py_SIZE() (GH-23375)

A follow up for 0e2ac21dd4960574e89561243763eabba685296a

4 years agobpo-42085: Add documentation for Py_TPFLAGS_HAVE_AM_SEND (GH-23374)
Vladimir Matveev [Wed, 18 Nov 2020 18:58:38 +0000 (10:58 -0800)] 
bpo-42085: Add documentation for Py_TPFLAGS_HAVE_AM_SEND (GH-23374)

Updated docs to include `Py_TPFLAGS_HAVE_AM_SEND`. News section should not be necessary.

Automerge-Triggered-By: GH:asvetlov
4 years agobpo-39573: Convert Py_TYPE() and Py_SIZE() back to macros (GH-23366)
Victor Stinner [Wed, 18 Nov 2020 17:48:06 +0000 (18:48 +0100)] 
bpo-39573: Convert Py_TYPE() and Py_SIZE() back to macros (GH-23366)

This change partically reverts
commit ad3252bad905d41635bcbb4b76db30d570cf0087
and the commit fe2978b3b940fe2478335e3a2ca5ad22338cdf9c.

Many third party C extension modules rely on the ability of using
Py_TYPE() to set an object type: "Py_TYPE(obj) = type;" or to set an
object type using: "Py_SIZE(obj) = size;".

4 years agobpo-42336: Improve PCbuild batch files (GH-23275)
Steve Dower [Wed, 18 Nov 2020 17:24:36 +0000 (17:24 +0000)] 
bpo-42336: Improve PCbuild batch files (GH-23275)

4 years agobpo-40998: Address compiler warnings found by ubsan (GH-20929)
Christian Heimes [Wed, 18 Nov 2020 15:38:53 +0000 (16:38 +0100)] 
bpo-40998: Address compiler warnings found by ubsan (GH-20929)

Signed-off-by: Christian Heimes <christian@python.org>
Automerge-Triggered-By: GH:tiran
4 years agobpo-1635741: Port _hashlib to multiphase initialization (GH-23358)
Christian Heimes [Wed, 18 Nov 2020 15:12:13 +0000 (16:12 +0100)] 
bpo-1635741: Port _hashlib to multiphase initialization (GH-23358)

Signed-off-by: Christian Heimes <christian@python.org>
4 years agobpo-1635741: Port symtable module to multiphase initialization (GH-23361)
Christian Heimes [Wed, 18 Nov 2020 15:03:51 +0000 (16:03 +0100)] 
bpo-1635741: Port symtable module to multiphase initialization (GH-23361)

Signed-off-by: Christian Heimes <christian@python.org>
4 years agobpo-40998: Fix a refleak in create_filter() (GH-23365)
Victor Stinner [Wed, 18 Nov 2020 14:57:10 +0000 (15:57 +0100)] 
bpo-40998: Fix a refleak in create_filter() (GH-23365)

4 years agobpo-42398: Fix "make regen-all" race condition (GH-23362)
Victor Stinner [Wed, 18 Nov 2020 14:36:27 +0000 (15:36 +0100)] 
bpo-42398: Fix "make regen-all" race condition (GH-23362)

Fix a race condition in "make regen-all" when make -jN option is used
to run jobs in parallel. The clinic.py script now only use atomic
write to write files. Moveover, generated files are now left
unchanged if the content does not change, to not change the file
modification time.

The "make regen-all" command runs "make clinic" and "make
regen-importlib" targets:

* "make regen-importlib" builds object files (ex: Modules/_weakref.o)
  from source files (ex: Modules/_weakref.c) and clinic files (ex:
  Modules/clinic/_weakref.c.h)
* "make clinic" always rewrites all clinic files
  (ex: Modules/clinic/_weakref.c.h)

Since there is no dependency between "clinic" and "regen-importlib"
Makefile targets, these two targets can be run in parallel. Moreover,
half of clinic.py file writes are not atomic and so there is a race
condition when "make regen-all" runs jobs in parallel using make -jN
option (which can be passed in MAKEFLAGS environment variable).

Fix clinic.py to make all file writes atomic:

* Add write_file() function to ensure that all file writes are
  atomic: write into a temporary file and then use os.replace().
* Moreover, write_file() doesn't recreate or modify the file if the
  content does not change to avoid modifying the file modification
  file.
* Update test_clinic to verify these assertions with a functional
  test.
* Remove Clinic.force attribute which was no longer used, whereas
  Clinic.verify remains useful.

4 years agobpo-41561: skip test_min_max_version_mismatch (GH-22308)
Christian Heimes [Wed, 18 Nov 2020 12:10:53 +0000 (13:10 +0100)] 
bpo-41561: skip test_min_max_version_mismatch (GH-22308)

skip test_min_max_version_mismatch when TLS 1.0 is not available

Signed-off-by: Christian Heimes <christian@python.org>
4 years agobpo-40656: Clean up detect_socket() (GH-20148)
Erlend Egeberg Aasland [Wed, 18 Nov 2020 00:08:58 +0000 (01:08 +0100)] 
bpo-40656: Clean up detect_socket() (GH-20148)

4 years agobpo-42395: Add aclosing to __all__ (GH-23356)
Tom Gringauz [Tue, 17 Nov 2020 23:18:05 +0000 (01:18 +0200)] 
bpo-42395: Add aclosing to __all__ (GH-23356)

Automerge-Triggered-By: GH:asvetlov
4 years agobpo-42396: Add a whatsnew entry about async contextlib.nullcontext (GH-23357)
Tom Gringauz [Tue, 17 Nov 2020 22:58:35 +0000 (00:58 +0200)] 
bpo-42396: Add a whatsnew entry about async contextlib.nullcontext (GH-23357)

Automerge-Triggered-By: GH:asvetlov
4 years agobpo-41713: Port _signal module to multi-phase init (GH-23355)
Victor Stinner [Tue, 17 Nov 2020 22:28:25 +0000 (23:28 +0100)] 
bpo-41713: Port _signal module to multi-phase init (GH-23355)

Port the _signal extension module to the multi-phase initialization
API (PEP 489).

Co-Authored-By: Mohamed Koubaa <koubaa.m@gmail.com>
4 years agobpo-41625: Skip os.splice() tests on AIX (GH-23354)
Victor Stinner [Tue, 17 Nov 2020 22:08:10 +0000 (23:08 +0100)] 
bpo-41625: Skip os.splice() tests on AIX (GH-23354)

On AIX, splice() only works with a socket, whereas the test uses a
pipe.

4 years agobpo-41686: Move _Py_RestoreSignals() to signalmodule.c (GH-23353)
Victor Stinner [Tue, 17 Nov 2020 21:55:30 +0000 (22:55 +0100)] 
bpo-41686: Move _Py_RestoreSignals() to signalmodule.c (GH-23353)

4 years agoFix: Docstrings hidden by slots. (GH-23352)
Julien Palard [Tue, 17 Nov 2020 21:50:23 +0000 (22:50 +0100)] 
Fix: Docstrings hidden by slots. (GH-23352)

Some `__slots__` where before the docstring, hiding them.

4 years agobpo-41625: Add a guard for Linux for splice() constants in the os module (GH-23350)
Pablo Galindo [Tue, 17 Nov 2020 19:57:49 +0000 (19:57 +0000)] 
bpo-41625: Add a guard for Linux for splice() constants in the os module (GH-23350)

4 years agobpo-41625: Specify that Linux >= 2.6.17 *and* glibc >= 2.5 are requir… (GH-23351)
Pablo Galindo [Tue, 17 Nov 2020 19:57:03 +0000 (19:57 +0000)] 
bpo-41625: Specify that Linux >= 2.6.17 *and* glibc >= 2.5 are requir… (GH-23351)

…ed for splice()

4 years agobpo-42349: Compiler clean up. More yak-shaving for PEP 626. (GH-23267)
Mark Shannon [Tue, 17 Nov 2020 19:30:14 +0000 (19:30 +0000)] 
bpo-42349: Compiler clean up. More yak-shaving for PEP 626. (GH-23267)

Make sure that CFG from compiler front-end is correct. Be a bit more aggressive in the compiler back-end.

4 years agobpo-41625: Add versionadded to os.splice() constants (GH-23340)
Pablo Galindo [Tue, 17 Nov 2020 18:13:50 +0000 (18:13 +0000)] 
bpo-41625: Add versionadded to os.splice() constants (GH-23340)

4 years agobpo-41686: Refactor signal_exec() (GH-23346)
Victor Stinner [Tue, 17 Nov 2020 17:57:32 +0000 (18:57 +0100)] 
bpo-41686: Refactor signal_exec() (GH-23346)

* Add signal_add_constants() function and add ADD_INT_MACRO macro.
* The Python SIGINT handler is now installed at the end of
  signal_exec().
* Use Py_NewRef().

4 years agobpo-41686: Always create the SIGINT event on Windows (GH-23344)
Victor Stinner [Tue, 17 Nov 2020 17:15:20 +0000 (18:15 +0100)] 
bpo-41686: Always create the SIGINT event on Windows (GH-23344)

bpo-41686, bpo-41713: On Windows, the SIGINT event,
_PyOS_SigintEvent(), is now created even if Python is configured to
not install signal handlers (PyConfig.install_signal_handlers=0 or
Py_InitializeEx(0)).

Changes:

* Move global variables initialization from signal_exec() to
  _PySignal_Init() to clarify that they are global variables cleared
  by _PySignal_Fini().
* _PySignal_Fini() now closes sigint_event.
* IntHandler is no longer a global variable.

4 years agobpo-42264: Deprecate sqlite3.OptimizedUnicode (GH-23163)
Erlend Egeberg Aasland [Tue, 17 Nov 2020 15:55:12 +0000 (16:55 +0100)] 
bpo-42264: Deprecate sqlite3.OptimizedUnicode (GH-23163)

4 years agobpo-41713: Remove PyOS_InitInterrupts() function (GH-23342)
Victor Stinner [Tue, 17 Nov 2020 15:22:23 +0000 (16:22 +0100)] 
bpo-41713: Remove PyOS_InitInterrupts() function (GH-23342)

Remove the undocumented PyOS_InitInterrupts() C function.

* Rename PyOS_InitInterrupts() to _PySignal_Init(). It now installs
  other signal handlers, not only SIGINT.
* Rename PyOS_FiniInterrupts() to _PySignal_Fini()

4 years agobpo-40637: Don't test builtin PBKDF2 without builtin hashes (GH-20980)
Christian Heimes [Tue, 17 Nov 2020 14:40:35 +0000 (15:40 +0100)] 
bpo-40637: Don't test builtin PBKDF2 without builtin hashes (GH-20980)

Skip testing of pure Python PBKDF2 when one or more builtin hash module
is not available. Otherwise the import of hashlib prints noise on
stderr.

Signed-off-by: Christian Heimes <christian@python.org>
4 years agobpo-41861, _sqlite3 : Add NEWS entry and rename variables (GH-23337)
Erlend Egeberg Aasland [Tue, 17 Nov 2020 12:52:54 +0000 (13:52 +0100)] 
bpo-41861, _sqlite3 : Add NEWS entry and rename variables (GH-23337)

4 years agobpo-42345: Fix three issues with typing.Literal parameters (GH-23294)
Yurii Karabas [Tue, 17 Nov 2020 02:23:19 +0000 (04:23 +0200)] 
bpo-42345: Fix three issues with typing.Literal parameters (GH-23294)

Literal equality no longer depends on the order of arguments.

Fix issue related to `typing.Literal` caching by adding `typed` parameter to `typing._tp_cache` function.

Add deduplication of `typing.Literal` arguments.

4 years agobpo-42381: Allow walrus in set literals and set comprehensions (GH-23332)
Pablo Galindo [Tue, 17 Nov 2020 01:17:12 +0000 (01:17 +0000)] 
bpo-42381: Allow walrus in set literals and set comprehensions (GH-23332)

Currently walruses are not allowerd in set literals and set comprehensions:

>>> {y := 4, 4**2, 3**3}
  File "<stdin>", line 1
    {y := 4, 4**2, 3**3}
       ^
SyntaxError: invalid syntax

but they should be allowed as well per PEP 572

4 years agobpo-41625: Expose the splice() system call in the os module (GH-21947)
Pablo Galindo [Tue, 17 Nov 2020 00:00:38 +0000 (00:00 +0000)] 
bpo-41625: Expose the splice() system call in the os module (GH-21947)

4 years agoAdd GCC pragmas to silence compiler warning about ffi_prep_closure (GH-23327)
Pablo Galindo [Mon, 16 Nov 2020 23:59:55 +0000 (23:59 +0000)] 
Add GCC pragmas to silence compiler warning about ffi_prep_closure (GH-23327)

4 years agobpo-42120: Remove macro defining copysign to _copysign on Windows (GH-23326)
Steve Dower [Mon, 16 Nov 2020 23:22:42 +0000 (23:22 +0000)] 
bpo-42120: Remove macro defining copysign to _copysign on Windows (GH-23326)

4 years agobpo-42316: Allow unparenthesized walrus operator in indexes (GH-23317)
Lysandros Nikolaou [Mon, 16 Nov 2020 23:09:35 +0000 (01:09 +0200)] 
bpo-42316: Allow unparenthesized walrus operator in indexes (GH-23317)

4 years agobpo-42374: Allow unparenthesized walrus in genexps (GH-23319)
Lysandros Nikolaou [Mon, 16 Nov 2020 23:08:35 +0000 (01:08 +0200)] 
bpo-42374: Allow unparenthesized walrus in genexps (GH-23319)

This fixes a regression that was introduced by the new parser.

Automerge-Triggered-By: GH:lysnikolaou
4 years agobpo-38506: Fix the Windows py.exe launcher's misordering of 3.10 (GH-18307)
Zackery Spytz [Mon, 16 Nov 2020 21:32:35 +0000 (14:32 -0700)] 
bpo-38506: Fix the Windows py.exe launcher's misordering of 3.10 (GH-18307)

4 years agobpo-40939: Document removal of the old parser in 3.10 whatsnew (GH-23321)
Lysandros Nikolaou [Mon, 16 Nov 2020 18:46:37 +0000 (20:46 +0200)] 
bpo-40939: Document removal of the old parser in 3.10 whatsnew (GH-23321)

Automerge-Triggered-By: GH:lysnikolaou
4 years agobpo-42087: Remove support for AIX 5.3 and below (GH-22830)
Kevin Adler [Mon, 16 Nov 2020 15:16:10 +0000 (09:16 -0600)] 
bpo-42087: Remove support for AIX 5.3 and below (GH-22830)

As AIX 5.3 and below do not support thread_cputime, it was decided in
https://bugs.python.org/issue40680 to require AIX 6.1 and above. This
commit removes workarounds for — and references to — older, unsupported
AIX versions.

4 years agobpo-37205: time.time() cannot fail with fatal error (GH-23314)
Victor Stinner [Mon, 16 Nov 2020 15:08:05 +0000 (16:08 +0100)] 
bpo-37205: time.time() cannot fail with fatal error (GH-23314)

time.time(), time.perf_counter() and time.monotonic() functions can
no longer fail with a Python fatal error, instead raise a regular
Python exception on failure.

Remove _PyTime_Init(): don't check system, monotonic and perf counter
clocks at startup anymore.

On error, _PyTime_GetSystemClock(), _PyTime_GetMonotonicClock() and
_PyTime_GetPerfCounter() now silently ignore the error and return 0.
They cannot fail with a Python fatal error anymore.

Add py_mach_timebase_info() and win_perf_counter_frequency()
sub-functions.

4 years agobpo-42350: Fix Thread._reset_internal_locks() (GH-23268)
Victor Stinner [Mon, 16 Nov 2020 14:20:34 +0000 (15:20 +0100)] 
bpo-42350: Fix Thread._reset_internal_locks() (GH-23268)

Fix the threading.Thread class at fork: do nothing if the thread is
already stopped (ex: fork called at Python exit). Previously, an
error was logged in the child process.

4 years agobpo-37205: time.perf_counter() and time.monotonic() are system-wide (GH-23284)
Victor Stinner [Mon, 16 Nov 2020 12:21:45 +0000 (13:21 +0100)] 
bpo-37205: time.perf_counter() and time.monotonic() are system-wide (GH-23284)

time.perf_counter() on Windows and time.monotonic() on macOS are now
system-wide. Previously, they used an offset computed at startup to
reduce the precision loss caused by the float type. Use
time.perf_counter_ns() and time.monotonic_ns() added in Python 3.7 to
avoid this precision loss.

4 years agobpo-42153 Fix link to IMAP documents in imaplib.rst (GH-23297)
Yash Shete [Mon, 16 Nov 2020 05:02:35 +0000 (10:32 +0530)] 
bpo-42153 Fix link to IMAP documents in imaplib.rst (GH-23297)

The University of Washington stopped hosting the IMAP documents. Link to a rescued copy on GitHub.

4 years agobpo-42332: Add weakref slot to types.GenericAlias (GH-23250)
kj [Mon, 16 Nov 2020 03:27:23 +0000 (11:27 +0800)] 
bpo-42332: Add weakref slot to types.GenericAlias (GH-23250)

Automerge-Triggered-By: GH:gvanrossum
4 years agoMore updates to the descriptor howto guide (GH-23238)
Raymond Hettinger [Mon, 16 Nov 2020 01:44:28 +0000 (17:44 -0800)] 
More updates to the descriptor howto guide (GH-23238)

4 years agobpo-42317: Improve docs of typing.get_args concerning Union (GH-23254)
Dominik1123 [Mon, 16 Nov 2020 01:30:55 +0000 (02:30 +0100)] 
bpo-42317: Improve docs of typing.get_args concerning Union (GH-23254)

4 years agobpo-42318: Fix support of non-BMP characters in Tkinter on macOS (GH-23281)
Serhiy Storchaka [Sun, 15 Nov 2020 16:16:59 +0000 (18:16 +0200)] 
bpo-42318: Fix support of non-BMP characters in Tkinter on macOS (GH-23281)

4 years agobpo-42351: Avoid error when opening header with non-UTF8 encoding (GH-23279)
Ronald Oussoren [Sat, 14 Nov 2020 15:07:47 +0000 (16:07 +0100)] 
bpo-42351: Avoid error when opening header with non-UTF8 encoding (GH-23279)

grep_headers_for() would error out when a header contained
text that cannot be interpreted as UTF-8.

4 years agobpo-41832: Restore note about NULL in PyType_Slot.pfunc (GH-23243)
Hai Shi [Sat, 14 Nov 2020 12:03:42 +0000 (20:03 +0800)] 
bpo-41832: Restore note about NULL in PyType_Slot.pfunc (GH-23243)

4 years agofix typo in ThreadedChildWatcher docs (GH-23277)
Thomas Grainger [Sat, 14 Nov 2020 12:02:15 +0000 (12:02 +0000)] 
fix typo in ThreadedChildWatcher docs (GH-23277)

4 years agobpo-42131: Add PEP 451-related methods to zipimport (GH-23187)
Brett Cannon [Fri, 13 Nov 2020 23:14:58 +0000 (15:14 -0800)] 
bpo-42131: Add PEP 451-related methods to zipimport (GH-23187)

Specifically, find_spec(), create_module(), and exec_module().

Co-authored-by: Nick Coghlan <ncoghlan@gmail.com>
4 years agobpo-40754: Adds _testinternalcapi to Windows installer for test suite (GH-23271)
Steve Dower [Fri, 13 Nov 2020 22:24:36 +0000 (22:24 +0000)] 
bpo-40754: Adds _testinternalcapi to Windows installer for test suite (GH-23271)

4 years agobpo-41001: Add os.eventfd() (#20930)
Christian Heimes [Fri, 13 Nov 2020 18:48:52 +0000 (19:48 +0100)] 
bpo-41001: Add os.eventfd() (#20930)

Co-authored-by: Kyle Stanley <aeros167@gmail.com>
4 years agobpo-42344: Improve pseudo implementation for SimpleNamespace (GH-23264)
Jürgen Gmach [Fri, 13 Nov 2020 18:15:37 +0000 (19:15 +0100)] 
bpo-42344: Improve pseudo implementation for SimpleNamespace (GH-23264)

4 years agobpo-40968: Send http/1.1 ALPN extension (#20959)
Christian Heimes [Fri, 13 Nov 2020 15:37:52 +0000 (16:37 +0100)] 
bpo-40968: Send http/1.1 ALPN extension (#20959)

Signed-off-by: Christian Heimes <christian@python.org>
4 years agobpo-42042: Use ids attribute instead of names attribute (GH-22739)
Dong-hee Na [Fri, 13 Nov 2020 15:15:17 +0000 (00:15 +0900)] 
bpo-42042: Use ids attribute instead of names attribute (GH-22739)

4 years agobpo-41617: Add _Py__has_builtin() macro (GH-23260)
Victor Stinner [Fri, 13 Nov 2020 14:38:17 +0000 (15:38 +0100)] 
bpo-41617: Add _Py__has_builtin() macro (GH-23260)

Fix building pycore_bitutils.h internal header on old clang version
without __builtin_bswap16() (ex: Xcode 4.6.3 on Mac OS X 10.7).

Add a new private _Py__has_builtin() macro to check for availability
of a preprocessor builtin function.

Co-Authored-By: Joshua Root <jmr@macports.org>
Co-authored-by: Joshua Root <jmr@macports.org>
4 years agobpo-42296: On Windows, fix CTRL+C regression (GH-23257)
Victor Stinner [Fri, 13 Nov 2020 13:44:42 +0000 (14:44 +0100)] 
bpo-42296: On Windows, fix CTRL+C regression (GH-23257)

On Windows, fix a regression in signal handling which prevented to
interrupt a program using CTRL+C. The signal handler can be run in a
thread different than the Python thread, in which case the test
deciding if the thread can handle signals is wrong.

On Windows, _PyEval_SignalReceived() now always sets eval_breaker to
1 since it cannot test _Py_ThreadCanHandleSignals(), and
  eval_frame_handle_pending() always calls
  _Py_ThreadCanHandleSignals() to recompute eval_breaker.

4 years agobpo-38823: Fix compiler warning in _ctypes on Windows (GH-23258)
Victor Stinner [Fri, 13 Nov 2020 13:44:11 +0000 (14:44 +0100)] 
bpo-38823: Fix compiler warning in _ctypes on Windows (GH-23258)

Explicitly cast PyExc_Exception to PyTypeObject* to fix the warning:

    modules\_ctypes\_ctypes.c(5748): warning C4133: '=':
    incompatible types - from 'PyObject *' to '_typeobject *'

4 years agobpo-42246: Fix memory leak in compiler (GH-23256)
Mark Shannon [Fri, 13 Nov 2020 12:53:53 +0000 (12:53 +0000)] 
bpo-42246: Fix memory leak in compiler (GH-23256)

* Fix potential memory leak in assembler init.

* Fix reference leak when encountering error during compilation of function body.

4 years agobpo-42246: Eliminate jumps to exit blocks by copying those blocks. (#23251)
Mark Shannon [Thu, 12 Nov 2020 19:49:33 +0000 (19:49 +0000)] 
bpo-42246: Eliminate jumps to exit blocks by copying those blocks. (#23251)

* Compiler: eliminate jumps to short exit blocks by copying.

4 years agobpo-42308: Add threading.__excepthook__ (GH-23218)
Mario Corchero [Thu, 12 Nov 2020 17:27:44 +0000 (18:27 +0100)] 
bpo-42308: Add threading.__excepthook__ (GH-23218)

Add threading.__excepthook__ to allow retrieving the original value
of threading.excepthook in case it is set to a broken or a different
value.

4 years agobpo-38823: Always build _ctypes with wchar_t (GH-23248)
Victor Stinner [Thu, 12 Nov 2020 14:38:13 +0000 (15:38 +0100)] 
bpo-38823: Always build _ctypes with wchar_t (GH-23248)

It is no longer possible to build the _ctypes extension module
without wchar_t type: remove CTYPES_UNICODE macro. Anyway, the
wchar_t type is required to build Python.

4 years agobpo-42260: Initialize time and warnings earlier at startup (GH-23249)
Victor Stinner [Thu, 12 Nov 2020 14:14:13 +0000 (15:14 +0100)] 
bpo-42260: Initialize time and warnings earlier at startup (GH-23249)

* Call _PyTime_Init() and _PyWarnings_InitState() earlier during the
  Python initialization.
* Inline _PyImportHooks_Init() into _PySys_InitCore().
* The _warnings initialization function no longer call
  _PyWarnings_InitState() to prevent resetting filters_version to 0.
* _PyWarnings_InitState() now returns an int and no longer clear the
  state in case of error (it's done anyway at Python exit).
* Rework init_importlib(), fix refleaks on errors.

4 years agobpo-38823: Fix refleaks in _ctypes extension init (GH-23247)
Victor Stinner [Thu, 12 Nov 2020 13:09:57 +0000 (14:09 +0100)] 
bpo-38823: Fix refleaks in _ctypes extension init (GH-23247)

Fix reference leaks in the error path of the initialization function
the _ctypes extension module: call Py_DECREF(mod) on error.

Change PyCFuncPtr_Type name from _ctypes.PyCFuncPtr to
_ctypes.CFuncPtr to be consistent with the name exposed in the
_ctypes namespace (_ctypes.CFuncPtr).

Split PyInit__ctypes() function into sub-functions and add macros for
readability.