]> git.ipfire.org Git - thirdparty/Python/cpython.git/log
thirdparty/Python/cpython.git
2 years agoGH-96764: rewrite `asyncio.wait_for` to use `asyncio.timeout` (#98518)
Kumar Aditya [Thu, 16 Feb 2023 18:48:21 +0000 (00:18 +0530)] 
GH-96764: rewrite `asyncio.wait_for` to use `asyncio.timeout` (#98518)

Changes `asyncio.wait_for` to use `asyncio.timeout` as its underlying implementation.

2 years agogh-99942: correct the pkg-config/python-config flags for cygwin/android
Eli Schwartz [Thu, 16 Feb 2023 17:57:59 +0000 (12:57 -0500)] 
gh-99942: correct the pkg-config/python-config flags for cygwin/android

2 years agogh-101952: Fix possible segfault in `BUILD_SET` opcode (#101958)
Eclips4 [Thu, 16 Feb 2023 17:46:43 +0000 (20:46 +0300)] 
gh-101952: Fix possible segfault in `BUILD_SET` opcode (#101958)

2 years agogh-93573: Replace wrong example domains in configparser doc (GH-93574)
sblondon [Thu, 16 Feb 2023 15:13:21 +0000 (16:13 +0100)] 
gh-93573: Replace wrong example domains in configparser doc (GH-93574)

* Replace bitbucket.org domain by forge.example
* Update example to python.org
* Use explicitly invalid domain

topsecret.server.com domain is not controled by PSF. It's replaced by invalid topsecret.server.example domain. It follows RFC 2606, which advise .example as TLD for documentation.

2 years agogh-101881: Support (non-)blocking read/write functions on Windows pipes (GH-101882)
Rayyan Ansari [Thu, 16 Feb 2023 14:52:24 +0000 (14:52 +0000)] 
gh-101881: Support (non-)blocking read/write functions on Windows pipes (GH-101882)

* fileutils: handle non-blocking pipe IO on Windows

Handle erroring operations on non-blocking pipes by reading the _doserrno code.
Limit writes on non-blocking pipes that are too large.

* Support blocking functions on Windows

Use the GetNamedPipeHandleState and SetNamedPipeHandleState Win32 API functions to add support for os.get_blocking and os.set_blocking.

2 years agogh-101951: use textwrap.dedent in compiler tests to make them more readable (GH-101950)
Irit Katriel [Thu, 16 Feb 2023 12:31:59 +0000 (12:31 +0000)] 
gh-101951: use textwrap.dedent in compiler tests to make them more readable (GH-101950)

Fixes #101951.

Automerge-Triggered-By: GH:iritkatriel
2 years agogh-101928: fix crash in compiler on multi-line lambda in function call (#101933)
penguin_wwy [Thu, 16 Feb 2023 11:31:41 +0000 (19:31 +0800)] 
gh-101928: fix crash in compiler on multi-line lambda in function call (#101933)

2 years agogh-99108: Refactor _sha256 & _sha512 into _sha2. (#101924)
Gregory P. Smith [Thu, 16 Feb 2023 06:08:20 +0000 (22:08 -0800)] 
gh-99108: Refactor _sha256 & _sha512 into _sha2. (#101924)

This merges their code. They're backed by the same single HACL* static library, having them be a single module simplifies maintenance.

This should unbreak the wasm enscripten builds that currently fail due to linking in --whole-archive mode and the HACL* library appearing twice.

Long unnoticed error fixed: _sha512.SHA384Type was doubly assigned and was actually SHA512Type. Nobody depends on those internal names.

Also rename LIBHACL_ make vars to LIBHACL_SHA2_ in preperation for other future HACL things.

2 years agogh-98627: Add an Optional Check for Extension Module Subinterpreter Compatibility...
Eric Snow [Thu, 16 Feb 2023 01:16:00 +0000 (18:16 -0700)] 
gh-98627: Add an Optional Check for Extension Module Subinterpreter Compatibility (gh-99040)

Enforcing (optionally) the restriction set by PEP 489 makes sense. Furthermore, this sets the stage for a potential restriction related to a per-interpreter GIL.

This change includes the following:

* add tests for extension module subinterpreter compatibility
* add _PyInterpreterConfig.check_multi_interp_extensions
* add Py_RTFLAGS_MULTI_INTERP_EXTENSIONS
* add _PyImport_CheckSubinterpIncompatibleExtensionAllowed()
* fail iff the module does not implement multi-phase init and the current interpreter is configured to check

https://github.com/python/cpython/issues/98627

2 years agogh-101758: Fix the wasm Buildbots (gh-101943)
Eric Snow [Thu, 16 Feb 2023 00:54:05 +0000 (17:54 -0700)] 
gh-101758: Fix the wasm Buildbots (gh-101943)

They were broken by gh-101920.

https://github.com/python/cpython/issues/101758

2 years agogh-101758: Add a Test For Single-Phase Init Modules in Multiple Interpreters (gh...
Eric Snow [Wed, 15 Feb 2023 23:05:07 +0000 (16:05 -0700)] 
gh-101758: Add a Test For Single-Phase Init Modules in Multiple Interpreters (gh-101920)

The test verifies the behavior of single-phase init modules when loaded in multiple interpreters.

https://github.com/python/cpython/issues/101758

2 years agogh-101758: Clean Up Uses of Import State (gh-101919)
Eric Snow [Wed, 15 Feb 2023 22:32:31 +0000 (15:32 -0700)] 
gh-101758: Clean Up Uses of Import State (gh-101919)

This change is almost entirely moving code around and hiding import state behind internal API.  We introduce no changes to behavior, nor to non-internal API.  (Since there was already going to be a lot of churn, I took this as an opportunity to re-organize import.c into topically-grouped sections of code.)  The motivation is to simplify a number of upcoming changes.

Specific changes:

* move existing import-related code to import.c, wherever possible
* add internal API for interacting with import state (both global and per-interpreter)
* use only API outside of import.c (to limit churn there when changing the location, etc.)
* consolidate the import-related state of PyInterpreterState into a single struct field (this changes layout slightly)
* add macros for import state in import.c (to simplify changing the location)
* group code in import.c into sections
*remove _PyState_AddModule()

https://github.com/python/cpython/issues/101758

2 years agogh-99138: Isolate _zoneinfo (#99218)
Erlend E. Aasland [Wed, 15 Feb 2023 21:58:48 +0000 (22:58 +0100)] 
gh-99138: Isolate _zoneinfo (#99218)

* Convert zone info type to heap type and add it to module state
* Add global variables to module state

2 years agogh-101819: Remove _PyWindowsConsoleIO_Type from the Windows DLL (GH-101904)
Erlend E. Aasland [Wed, 15 Feb 2023 13:07:59 +0000 (14:07 +0100)] 
gh-101819: Remove _PyWindowsConsoleIO_Type from the Windows DLL (GH-101904)

Automerge-Triggered-By: GH:erlend-aasland
2 years agoGH-87849: Fix refleak in SEND instruction. (GH-101908)
Mark Shannon [Wed, 15 Feb 2023 12:21:40 +0000 (12:21 +0000)] 
GH-87849: Fix refleak in SEND instruction. (GH-101908)

Fix refleak in SEND instruction.

2 years agogh-101819: Remove _testcapi dependencies on specific _io symbols (#101918)
Erlend E. Aasland [Wed, 15 Feb 2023 10:18:27 +0000 (11:18 +0100)] 
gh-101819: Remove _testcapi dependencies on specific _io symbols (#101918)

2 years agogh-101693: In sqlite3, deprecate using named placeholders with parameters supplied...
Erlend E. Aasland [Wed, 15 Feb 2023 05:27:16 +0000 (06:27 +0100)] 
gh-101693: In sqlite3, deprecate using named placeholders with parameters supplied as a sequence (#101698)

2 years agogh-99108: Build the hashlib HACL* code as a static library. (#101917)
Gregory P. Smith [Tue, 14 Feb 2023 23:57:01 +0000 (15:57 -0800)] 
gh-99108: Build the hashlib HACL* code as a static library. (#101917)

This builds HACL* as a library in one place.

A followup to #101707 which broke some WASM builds. This fixes 2/4 of them, but the enscripten toolchain in the others don't deduplicate linker arguments and error out. A follow-on PR will address those.

2 years agogh-101758: Add a Test For Single-Phase Init Module Variants (gh-101891)
Eric Snow [Tue, 14 Feb 2023 21:26:03 +0000 (14:26 -0700)] 
gh-101758: Add a Test For Single-Phase Init Module Variants (gh-101891)

The new test exercises the most important variants for single-phase init extension modules. We also add some explanation about those variants to import.c.

https://github.com/python/cpython/issues/101758

2 years agogh-101799: implement PREP_RERAISE_STAR as an intrinsic function (#101800)
Irit Katriel [Tue, 14 Feb 2023 11:54:13 +0000 (11:54 +0000)] 
gh-101799: implement PREP_RERAISE_STAR as an intrinsic function (#101800)

2 years agoGH-101898: Fix missing term references for hashable definition (#101899)
Furkan Onder [Tue, 14 Feb 2023 10:20:11 +0000 (10:20 +0000)] 
GH-101898: Fix missing term references for hashable definition (#101899)

Fix missing term references for hashable definition

2 years agogh-99108: Import SHA2-384/512 from HACL* (#101707)
Jonathan Protzenko [Tue, 14 Feb 2023 09:25:16 +0000 (01:25 -0800)] 
gh-99108: Import SHA2-384/512 from HACL* (#101707)

Replace the builtin hashlib implementations of SHA2-384 and SHA2-512
originally from LibTomCrypt with formally verified, side-channel resistant
code from the [HACL*](https://github.com/hacl-star/hacl-star/) project.
The builtins remain a fallback only used when OpenSSL does not provide them.

2 years agogh-101857: Allow xattr detection on musl libc (#101858)
Sam James [Tue, 14 Feb 2023 07:21:58 +0000 (07:21 +0000)] 
gh-101857: Allow xattr detection on musl libc (#101858)

Previously, we checked exclusively for `__GLIBC__` (AND'd with some other
conditions). Checking for `__linux__` instead should be fine.

This fixes using e.g. `os.listxattr()` on systems using musl libc.

Bug: https://bugs.gentoo.org/894130

Co-authored-by: Gregory P. Smith <greg@krypto.org>
2 years agogh-74895: getaddrinfo no longer raises OverflowError (#2435)
Radek Smejkal [Tue, 14 Feb 2023 01:37:34 +0000 (02:37 +0100)] 
gh-74895: getaddrinfo no longer raises OverflowError (#2435)

`socket.getaddrinfo()` no longer raises `OverflowError` based on the **port** argument. Error reporting (or not) for its value is left up to the underlying C library `getaddrinfo()` implementation.

2 years agogh-101849: Add upgrade codes for old versions of launcher that ended up with later...
Steve Dower [Mon, 13 Feb 2023 20:33:48 +0000 (20:33 +0000)] 
gh-101849: Add upgrade codes for old versions of launcher that ended up with later version numbers (GH-101877)

2 years agogh-101810: Remove duplicated st_ino calculation (GH-101811)
James Lee [Mon, 13 Feb 2023 13:49:44 +0000 (05:49 -0800)] 
gh-101810: Remove duplicated st_ino calculation (GH-101811)

2 years agogh-92547: Purge sqlite3_enable_shared_cache() detection from configure (#101873)
Erlend E. Aasland [Mon, 13 Feb 2023 12:36:42 +0000 (13:36 +0100)] 
gh-92547: Purge sqlite3_enable_shared_cache() detection from configure (#101873)

2 years agoGH-100987: Refactor `_PyInterpreterFrame` a bit, to assist generator improvement...
Mark Shannon [Mon, 13 Feb 2023 11:31:15 +0000 (11:31 +0000)] 
GH-100987: Refactor `_PyInterpreterFrame` a bit, to assist generator improvement. (GH-100988)

Refactor _PyInterpreterFrame a bit, to assist generator improvement.

2 years agoGH-87849: Simplify stack effect of SEND and specialize it for generators and coroutin...
Mark Shannon [Mon, 13 Feb 2023 11:24:55 +0000 (11:24 +0000)] 
GH-87849: Simplify stack effect of SEND and specialize it for generators and coroutines. (GH-101788)

2 years agoCorrect trivial grammar in reset_mock docs (#101861)
Steve Kowalik [Mon, 13 Feb 2023 09:11:43 +0000 (20:11 +1100)] 
Correct trivial grammar in reset_mock docs (#101861)

2 years agogh-101845: pyspecific: Fix i18n for availability directive (GH-101846)
Jean Abou-Samra [Sun, 12 Feb 2023 14:20:11 +0000 (15:20 +0100)] 
gh-101845: pyspecific: Fix i18n for availability directive (GH-101846)

pyspecific: Fix i18n for availability directive

If the directive has content, the previous code would nest paragraph
nodes from that content inside a general paragraph node, which confuses
Sphinx and leads it to drop the content when translating. Instead, use a
container node for the body.

Also use set_source_info so that any warnings have location info.

2 years agogh-89792: Limit test_tools freeze test build parallelism based on the number of cores...
Gregory P. Smith [Sun, 12 Feb 2023 06:07:52 +0000 (22:07 -0800)] 
gh-89792: Limit test_tools freeze test build parallelism based on the number of cores (#101841)

unhardcode freeze test build parallelism. base it on the number of cpus, don't use more than max(2, os.cpu_count()/3).

2 years agogh-85984: Utilize new "winsize" functions from termios in pty tests. (#101831)
Soumendra Ganguly [Sun, 12 Feb 2023 05:24:43 +0000 (23:24 -0600)] 
gh-85984: Utilize new "winsize" functions from termios in pty tests. (#101831)

Utilize new functions termios.tcgetwinsize() and termios.tcsetwinsize in test_pty.py.

Signed-off-by: Soumendra Ganguly <soumendraganguly@gmail.com>
Co-authored-by: Gregory P. Smith <greg@krypto.org>
2 years agogh-89792: Prevent test_tools from copying 1000M of "source" in freeze test (#101837)
Gregory P. Smith [Sun, 12 Feb 2023 04:54:28 +0000 (20:54 -0800)] 
gh-89792: Prevent test_tools from copying 1000M of "source" in freeze test (#101837)

Prevent test_tools from copying 1000M of "source"

It doesn't need a git repo, just the checkout.  We skip .git metadata, Doc/build, Doc/venv, and `__pycache__` subdirs, that developers often have in their clients to reduce the size of the source tree copy ten-fold.

This should significantly reduce IO and presumably time on buildbots during this long test.

2 years agoFix typo in test_fstring.py (#101823)
mjoerg [Sat, 11 Feb 2023 15:34:15 +0000 (16:34 +0100)] 
Fix typo in test_fstring.py (#101823)

2 years agoGH-101797: allocate `PyExpat_CAPI` capsule on heap (#101798)
Kumar Aditya [Sat, 11 Feb 2023 08:37:39 +0000 (14:07 +0530)] 
GH-101797: allocate `PyExpat_CAPI` capsule on heap (#101798)

2 years agogh-101390: Fix docs for `imporlib.util.LazyLoader.factory` to properly call it a...
busywhitespace [Fri, 10 Feb 2023 23:29:24 +0000 (00:29 +0100)] 
gh-101390: Fix docs for `imporlib.util.LazyLoader.factory` to properly call it a class method (GH-101391)

2 years agoDocs: Fix getstatus() -> getcode() typos (#101296)
Hugo van Kemenade [Fri, 10 Feb 2023 18:46:12 +0000 (20:46 +0200)] 
Docs: Fix getstatus() -> getcode() typos (#101296)

2 years agoDocs: use parameter list for sqlite3.Cursor.execute* (#101782)
Erlend E. Aasland [Fri, 10 Feb 2023 17:54:04 +0000 (18:54 +0100)] 
Docs: use parameter list for sqlite3.Cursor.execute* (#101782)

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2 years agogh-101763: Update bundled copy of libffi to 3.4.4 on Windows (GH-101784)
Steve Dower [Fri, 10 Feb 2023 16:57:30 +0000 (16:57 +0000)] 
gh-101763: Update bundled copy of libffi to 3.4.4 on Windows (GH-101784)

2 years agogh-101517: make bdb avoid looking up in linecache with lineno=None (#101787)
Irit Katriel [Fri, 10 Feb 2023 16:49:29 +0000 (16:49 +0000)] 
gh-101517: make bdb avoid looking up in linecache with lineno=None (#101787)

2 years agogh-101759: Update Windows installer to SQLite 3.40.1 (#101762)
Erlend E. Aasland [Fri, 10 Feb 2023 16:38:26 +0000 (17:38 +0100)] 
gh-101759: Update Windows installer to SQLite 3.40.1 (#101762)

2 years agogh-101277: Finalise isolating itertools (GH-101305)
Erlend E. Aasland [Fri, 10 Feb 2023 11:58:14 +0000 (12:58 +0100)] 
gh-101277: Finalise isolating itertools (GH-101305)

Add repeat, islice, chain, tee, teedataobject, and batched types to module state.

Automerge-Triggered-By: GH:erlend-aasland
2 years agogh-101759: Update macOS installer to SQLite 3.40.1 (#101761)
Erlend E. Aasland [Fri, 10 Feb 2023 07:25:02 +0000 (08:25 +0100)] 
gh-101759: Update macOS installer to SQLite 3.40.1 (#101761)

2 years agoFix some typos in asdl_c.py (GH-101757)
abel1502 [Fri, 10 Feb 2023 03:10:46 +0000 (06:10 +0300)] 
Fix some typos in asdl_c.py (GH-101757)

2 years agogh-101747: Fix refleak in new `OrderedDict` repr (GH-101748)
Nikita Sobolev [Fri, 10 Feb 2023 03:00:58 +0000 (06:00 +0300)] 
gh-101747: Fix refleak in new `OrderedDict` repr (GH-101748)

2 years agogh-101430: Update tracemalloc to handle presize properly. (gh-101745)
Dong-hee Na [Thu, 9 Feb 2023 23:30:03 +0000 (08:30 +0900)] 
gh-101430: Update tracemalloc to handle presize properly. (gh-101745)

2 years agoGH-101228: Fix typo in docstring for read method of `_io.TextIOWrapper` class (#101227)
Partha P. Mukherjee [Thu, 9 Feb 2023 17:46:40 +0000 (12:46 -0500)] 
GH-101228: Fix typo in docstring for read method of `_io.TextIOWrapper` class (#101227)

2 years agoFix typo in `test_fstring.py` (#101600)
Ikko Eltociear Ashimine [Thu, 9 Feb 2023 17:45:58 +0000 (02:45 +0900)] 
Fix typo in `test_fstring.py` (#101600)

2 years agogh-101726: Update the OpenSSL version to 1.1.1t (GH-101727)
Gregory P. Smith [Thu, 9 Feb 2023 17:40:51 +0000 (09:40 -0800)] 
gh-101726: Update the OpenSSL version to 1.1.1t (GH-101727)

Fixes CVE-2023-0286 (High) and a couple of Medium security issues.
https://www.openssl.org/news/secadv/20230207.txt

2 years agogh-101283: Fix 'versionchanged' for the shell=True fallback on Windows in 3.12 (GH...
Oleg Iarygin [Thu, 9 Feb 2023 17:36:24 +0000 (21:36 +0400)] 
gh-101283: Fix 'versionchanged' for the shell=True fallback on Windows in 3.12 (GH-101728)

2 years agoLibFFI build requires x64 Cygwin, and skip the ARM build (GH-101743)
Steve Dower [Thu, 9 Feb 2023 17:15:19 +0000 (17:15 +0000)] 
LibFFI build requires x64 Cygwin, and skip the ARM build (GH-101743)

2 years agogh-101670: typo fix in PyImport_ExtendInittab() (#101723)
Sergey B Kirpichev [Thu, 9 Feb 2023 16:49:02 +0000 (19:49 +0300)] 
gh-101670: typo fix in PyImport_ExtendInittab() (#101723)

Co-authored-by: Eric Snow <ericsnowcurrently@gmail.com>
2 years agoGH-99293: Document that `Py_TPFLAGS_VALID_VERSION_TAG` shouldn't be used. (#GH-101736)
Mark Shannon [Thu, 9 Feb 2023 13:05:53 +0000 (13:05 +0000)] 
GH-99293: Document that `Py_TPFLAGS_VALID_VERSION_TAG` shouldn't be used. (#GH-101736)

Document that Py_TPFLAGS_VALID_VERSION_TAG shouldn't be used.

2 years agono-issue: Add Dong-hee Na as the cjkcodecs codeowner (gh-101731)
Dong-hee Na [Thu, 9 Feb 2023 12:01:32 +0000 (21:01 +0900)] 
no-issue: Add Dong-hee Na as the cjkcodecs codeowner (gh-101731)

2 years agogh-101678: Merge math_1_to_whatever() and math_1() (#101730)
Sergey B Kirpichev [Thu, 9 Feb 2023 09:40:13 +0000 (12:40 +0300)] 
gh-101678: Merge math_1_to_whatever() and math_1() (#101730)

`math_1_to_whatever()` is no longer useful, since all existing uses of it convert to `float`.
Earlier versions of Python used `math_1_to_whatever` with an integer target; see
gh-16991 for the PR where that use was removed.

2 years agogh-101678: refactor the math module to use special functions from c11 (GH-101679)
Sergey B Kirpichev [Thu, 9 Feb 2023 08:40:52 +0000 (11:40 +0300)] 
gh-101678: refactor the math module to use special functions from c11 (GH-101679)

Shouldn't affect users, hence no news.

Automerge-Triggered-By: GH:mdickinson
2 years agogh-85984: Remove legacy Lib/pty.py code. (#92365)
Soumendra Ganguly [Thu, 9 Feb 2023 01:00:17 +0000 (19:00 -0600)] 
gh-85984: Remove legacy Lib/pty.py code. (#92365)

Refactored the implementation of pty.fork to use os.login_tty.

A DeprecationWarning is now raised by pty.master_open() and pty.slave_open(). They were
undocumented and deprecated long long ago in the docstring in favor of pty.openpty.

Signed-off-by: Soumendra Ganguly <soumendraganguly@gmail.com>
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Co-authored-by: Gregory P. Smith <greg@krypto.org>
2 years agogh-98831: Use opcode metadata for stack_effect() (#101704)
Guido van Rossum [Thu, 9 Feb 2023 00:23:19 +0000 (16:23 -0800)] 
gh-98831: Use opcode metadata for stack_effect() (#101704)

* Write output and metadata in a single run
  This halves the time to run the cases generator
  (most of the time goes into parsing the input).
* Declare or define opcode metadata based on NEED_OPCODE_TABLES
* Use generated metadata for stack_effect()
* compile.o depends on opcode_metadata.h
* Return -1 from _PyOpcode_num_popped/pushed for unknown opcode

2 years agogh-101283: Version was just released, so should be changed in 3.11.3 (GH-101719)
Steve Dower [Wed, 8 Feb 2023 23:52:03 +0000 (23:52 +0000)] 
gh-101283: Version was just released, so should be changed in 3.11.3 (GH-101719)

2 years agogh-101283: Fix use of unbound variable (GH-101712)
Steve Dower [Wed, 8 Feb 2023 23:38:56 +0000 (23:38 +0000)] 
gh-101283: Fix use of unbound variable (GH-101712)

2 years agogh-101283: Improved fallback logic for subprocess with shell=True on Windows (GH...
Oleg Iarygin [Wed, 8 Feb 2023 22:12:19 +0000 (02:12 +0400)] 
gh-101283: Improved fallback logic for subprocess with shell=True on Windows (GH-101286)

2 years agogh-101277: Port more itertools static types to heap types (#101304)
Erlend E. Aasland [Wed, 8 Feb 2023 20:25:42 +0000 (21:25 +0100)] 
gh-101277: Port more itertools static types to heap types (#101304)

Add accumulate, compress, count, filterfalse, pairwise, product,
and zip_longest types to module state.

2 years agogh-98831: Modernize CALL and family (#101508)
Guido van Rossum [Wed, 8 Feb 2023 19:40:10 +0000 (11:40 -0800)] 
gh-98831: Modernize CALL and family (#101508)

Includes a slight improvement to `DECREF_INPUTS()`.

2 years agoGH-101696: invalidate type version tag in `_PyStaticType_Dealloc` (#101697)
Kumar Aditya [Wed, 8 Feb 2023 18:02:15 +0000 (23:32 +0530)] 
GH-101696: invalidate type version tag in `_PyStaticType_Dealloc` (#101697)

2 years agogh-100221: Fix creating dirs in `make sharedinstall` (GH-100329)
Michał Górny [Wed, 8 Feb 2023 16:50:43 +0000 (17:50 +0100)] 
gh-100221: Fix creating dirs in `make sharedinstall` (GH-100329)

Fix creating install directories in `make sharedinstall` if they exist already outside `DESTDIR`.  The previous make rules assumed that the directories would be created via a dependency on a rule for `$(DESTSHARED)` that did not fire if the directory did exist outside `$(DESTDIR)`.

While technically `$(DESTDIR)` could be prepended to the rule name, moving the rules for creating directories straight into the `sharedinstall` rule seems to fit the common practices better. Since the rule explicitly checks whether the individual directories exist anyway, there seems to be no reason to rely on make determining that implicitly as well.

2 years agogh-101670: typo fix in PyImport_AppendInittab() (GH-101672)
Sergey B Kirpichev [Wed, 8 Feb 2023 15:49:04 +0000 (18:49 +0300)] 
gh-101670: typo fix in PyImport_AppendInittab() (GH-101672)

2 years agogh-101196: Make isdir/isfile/exists faster on Windows (GH-101324)
Michael Droettboom [Wed, 8 Feb 2023 14:34:24 +0000 (09:34 -0500)] 
gh-101196: Make isdir/isfile/exists faster on Windows (GH-101324)

Co-authored-by: Eryk Sun <eryksun@gmail.com>
2 years agogh-101614: Don't treat python3_d.dll as a Python DLL when checking extension modules...
David Hewitt [Wed, 8 Feb 2023 14:23:57 +0000 (14:23 +0000)] 
gh-101614: Don't treat python3_d.dll as a Python DLL when checking extension modules for incompatibility (GH-101615)

2 years agogh-100933: Improve `check_element` helper in `test_xml_etree` (#100934)
Nikita Sobolev [Wed, 8 Feb 2023 10:13:43 +0000 (13:13 +0300)] 
gh-100933: Improve `check_element` helper in `test_xml_etree` (#100934)

Items checked by this test are always `str` and `dict` instances.

2 years agoGH-101578: Normalize the current exception (GH-101607)
Mark Shannon [Wed, 8 Feb 2023 09:31:12 +0000 (09:31 +0000)] 
GH-101578: Normalize the current exception (GH-101607)

* Make sure that the current exception is always normalized.

* Remove redundant type and traceback fields for the current exception.

* Add new API functions: PyErr_GetRaisedException, PyErr_SetRaisedException

* Add new API functions: PyException_GetArgs, PyException_SetArgs

2 years agogh-47937: Note that Popen attributes are read-only (#93070)
Stanley [Wed, 8 Feb 2023 08:12:46 +0000 (00:12 -0800)] 
gh-47937: Note that Popen attributes are read-only (#93070)

* Note that Popen attributes aren't meant to be set by users by rewording the text about the attributes.
* Also update some universal_newlines references to mention the modern text parameter name while in the area.

Co-authored-by: Gregory P. Smith <greg@krypto.org>
2 years agogh-98831: Modernize CALL_FUNCTION_EX (#101627)
Guido van Rossum [Wed, 8 Feb 2023 04:03:22 +0000 (20:03 -0800)] 
gh-98831: Modernize CALL_FUNCTION_EX (#101627)

New generator feature: Move CHECK_EVAL_BREAKER() call to just before DISPATCH().

2 years agogh-101446: Change `repr` of `collections.OrderedDict` (#101661)
Nikita Sobolev [Wed, 8 Feb 2023 02:01:10 +0000 (05:01 +0300)] 
gh-101446: Change `repr` of `collections.OrderedDict` (#101661)

2 years agogh-98831: Modernize FORMAT_VALUE (#101628)
Guido van Rossum [Wed, 8 Feb 2023 01:35:55 +0000 (17:35 -0800)] 
gh-98831: Modernize FORMAT_VALUE (#101628)

Generator update: support balanced parentheses and brackets in conditions and size expressions.

2 years agogh-98831: Finish the UNPACK_SEQUENCE family (#101666)
Guido van Rossum [Tue, 7 Feb 2023 23:44:37 +0000 (15:44 -0800)] 
gh-98831: Finish the UNPACK_SEQUENCE family (#101666)

New generator feature: Generate useful glue for output arrays, so you can just write values to the output array (no bounds checking). Rewrote UNPACK_SEQUENCE_TWO_TUPLE to use this, and also UNPACK_SEQUENCE_{TUPLE,LIST}.

2 years agogh-101632: Add the new RETURN_CONST opcode (#101633)
penguin_wwy [Tue, 7 Feb 2023 22:32:21 +0000 (06:32 +0800)] 
gh-101632: Add the new RETURN_CONST opcode (#101633)

2 years agoMerge branch 'main' of https://github.com/python/cpython into main
Thomas Wouters [Tue, 7 Feb 2023 22:13:53 +0000 (23:13 +0100)] 
Merge branch 'main' of https://github.com/python/cpython into main

2 years agoPost 3.12.0a5
Thomas Wouters [Tue, 7 Feb 2023 22:13:10 +0000 (23:13 +0100)] 
Post 3.12.0a5

2 years agogh-101656: Fix "conversion from Py_ssize_t to int" warning in `_testcapimodule` ...
Nikita Sobolev [Tue, 7 Feb 2023 21:43:33 +0000 (00:43 +0300)] 
gh-101656: Fix "conversion from Py_ssize_t to int" warning in `_testcapimodule` (#101657)

2 years agogh-98831: rewrite UNPACK_EX, UNPACK_SEQUENCE, UNPACK_SEQUENCE_TWO_TUPLE in the instru...
Irit Katriel [Tue, 7 Feb 2023 20:37:43 +0000 (20:37 +0000)] 
gh-98831: rewrite UNPACK_EX, UNPACK_SEQUENCE, UNPACK_SEQUENCE_TWO_TUPLE in the instruction definition DSL  (#101641)

2 years agogh-97725: Fix documentation for the default file of `asyncio.Task.print_stack` (...
Oleg Iarygin [Tue, 7 Feb 2023 18:04:31 +0000 (22:04 +0400)] 
gh-97725: Fix documentation for the default file of `asyncio.Task.print_stack` (#101652)

2 years agoMake use of TESTFN_ASCII in test_fileio (GH-101645)
Zachary Ware [Tue, 7 Feb 2023 17:22:58 +0000 (11:22 -0600)] 
Make use of TESTFN_ASCII in test_fileio (GH-101645)

testBytesOpen requires an ASCII filename, but TESTFN usually isn't ASCII.

Automerge-Triggered-By: GH:zware
2 years agogh-98831: Modernize the FOR_ITER family of instructions (#101626)
Guido van Rossum [Tue, 7 Feb 2023 16:28:28 +0000 (08:28 -0800)] 
gh-98831: Modernize the FOR_ITER family of instructions (#101626)

Co-authored-by: Irit Katriel <1055913+iritkatriel@users.noreply.github.com>
2 years agoFix nesting of 'Pending Removal in Python 3.14' (#101637)
Oleg Iarygin [Tue, 7 Feb 2023 14:54:47 +0000 (18:54 +0400)] 
Fix nesting of 'Pending Removal in Python 3.14' (#101637)

2 years agoDoctest: Pin sphinxext-opengraph==0.7.5 to prevent importing NumPy (#101642)
Hugo van Kemenade [Tue, 7 Feb 2023 13:59:26 +0000 (15:59 +0200)] 
Doctest: Pin sphinxext-opengraph==0.7.5 to prevent importing NumPy (#101642)

2 years agoPython 3.12.0a5 v3.12.0a5
Thomas Wouters [Tue, 7 Feb 2023 12:17:26 +0000 (13:17 +0100)] 
Python 3.12.0a5

2 years ago[gh-101072] Fix Blurb for GH-101127
Łukasz Langa [Tue, 7 Feb 2023 09:50:39 +0000 (10:50 +0100)] 
[gh-101072] Fix Blurb for GH-101127

2 years agogh-101072: support default and kw default in PyEval_EvalCodeEx for 3.11+ (#101127)
Matthieu Dartiailh [Tue, 7 Feb 2023 09:34:21 +0000 (10:34 +0100)] 
gh-101072: support default and kw default in PyEval_EvalCodeEx  for 3.11+ (#101127)

Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2 years agogh-85747: Active voice & suggested edits, 'running/stopping loop' & 'callbacks' subse...
Brian Skinn [Tue, 7 Feb 2023 05:25:42 +0000 (00:25 -0500)] 
gh-85747: Active voice & suggested edits, 'running/stopping loop' & 'callbacks' subsections of asyncio-eventloop.rst (#100270)

Co-authored-by: C.A.M. Gerlach <CAM.Gerlach@Gerlach.CAM>
Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
2 years agogh-98831: Move DSL documentation here from ideas repo (#101629)
Guido van Rossum [Tue, 7 Feb 2023 05:03:58 +0000 (21:03 -0800)] 
gh-98831: Move DSL documentation here from ideas repo (#101629)

2 years agogh-99108: Replace SHA2-224 & 256 with verified code from HACL* (#99109)
Jonathan Protzenko [Tue, 7 Feb 2023 02:11:01 +0000 (18:11 -0800)] 
gh-99108: Replace SHA2-224 & 256 with verified code from HACL* (#99109)

replacing hashlib primitives (for the non-OpenSSL case) with verified implementations from HACL*. This is the first PR in the series, and focuses specifically on SHA2-256 and SHA2-224.

This PR imports Hacl_Streaming_SHA2 into the Python tree. This is the HACL* implementation of SHA2, which combines a core implementation of SHA2 along with a layer of buffer management that allows updating the digest with any number of bytes. This supersedes the previous implementation in the tree.

@franziskuskiefer was kind enough to benchmark the changes: in addition to being verified (thus providing significant safety and security improvements), this implementation also provides a sizeable performance boost!

```
---------------------------------------------------------------
Benchmark                     Time             CPU   Iterations
---------------------------------------------------------------
Sha2_256_Streaming            3163 ns      3160 ns       219353     // this PR
LibTomCrypt_Sha2_256          5057 ns      5056 ns       136234     // library used by Python currently
```

The changes in this PR are as follows:
- import the subset of HACL* that covers SHA2-256/224 into `Modules/_hacl`
- rewire sha256module.c to use the HACL* implementation

Co-authored-by: Gregory P. Smith [Google LLC] <greg@krypto.org>
Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
2 years agogh-59956: Add a Test to Verify GILState Matches the "Current" Thread State (gh-101625)
Eric Snow [Mon, 6 Feb 2023 22:53:31 +0000 (15:53 -0700)] 
gh-59956: Add a Test to Verify GILState Matches the "Current" Thread State (gh-101625)

This test should have been in gh-101431.

https://github.com/python/cpython/issues/59956

2 years agogh-98831: rewrite COPY and SWAP in the instruction definition DSL (#101620)
Irit Katriel [Mon, 6 Feb 2023 22:45:18 +0000 (22:45 +0000)] 
gh-98831: rewrite COPY and SWAP in the instruction definition DSL (#101620)

2 years agoGH-101616: Mention the Docs Discourse forum in the "reporting docs issues" (GH-101617)
Mariatta Wijaya [Mon, 6 Feb 2023 21:59:45 +0000 (13:59 -0800)] 
GH-101616: Mention the Docs Discourse forum in the "reporting docs issues" (GH-101617)

Fixes https://github.com/python/cpython/issues/101616

2 years agogh-59956: Partial Fix for GILState API Compatibility with Subinterpreters (gh-101431)
Eric Snow [Mon, 6 Feb 2023 21:39:25 +0000 (14:39 -0700)] 
gh-59956: Partial Fix for GILState API Compatibility with Subinterpreters (gh-101431)

The GILState API (PEP 311) implementation from 2003 made the assumption that only one thread state would ever be used for any given OS thread, explicitly disregarding the case of subinterpreters.  However, PyThreadState_Swap() still facilitated switching between subinterpreters, meaning the "current" thread state (holding the GIL), and the GILState thread state could end up out of sync, causing problems (including crashes).

This change addresses the issue by keeping the two in sync in PyThreadState_Swap().  I verified the fix against gh-99040.

Note that the other GILState-subinterpreter incompatibility (with autoInterpreterState) is not resolved here.

https://github.com/python/cpython/issues/59956

2 years agogh-101609: Fix "‘state’ may be used uninitialized" warning in `_xxinterpchannelsmodul...
Nikita Sobolev [Mon, 6 Feb 2023 21:05:41 +0000 (00:05 +0300)] 
gh-101609: Fix "‘state’ may be used uninitialized" warning in `_xxinterpchannelsmodule` (GH-101610)

I went with the easiest solution: just removing the offending line. See the issue description with my reasoning.

https://github.com/python/cpython/issues/101609

2 years agogh-101562: typing: add tests for inheritance with NotRequired & Required in parent...
Eclips4 [Mon, 6 Feb 2023 19:28:24 +0000 (22:28 +0300)] 
gh-101562: typing: add tests for inheritance with NotRequired & Required in parent fields (#101563)

2 years agogh-101543: Ensure Windows registry path is only used when stdlib can't be found ...
Steve Dower [Mon, 6 Feb 2023 15:55:32 +0000 (15:55 +0000)] 
gh-101543: Ensure Windows registry path is only used when stdlib can't be found (GH-101544)

2 years agogh-76961: Fix buildbot failures in test_pep3118 (#101587) 101604/head
Mark Dickinson [Mon, 6 Feb 2023 12:25:31 +0000 (12:25 +0000)] 
gh-76961: Fix buildbot failures in test_pep3118 (#101587)

This PR fixes the buildbot failures introduced by the merge of #5561, by restricting the relevant tests to something that should work on both 32-bit and 64-bit platforms. It also silences some compiler warnings introduced in that PR.