]> git.ipfire.org Git - thirdparty/Python/cpython.git/log
thirdparty/Python/cpython.git
2 years agoPost 3.12.0a2
Thomas Wouters [Tue, 15 Nov 2022 12:36:51 +0000 (13:36 +0100)] 
Post 3.12.0a2

2 years agoPython 3.12.0a2 v3.12.0a2
Thomas Wouters [Mon, 14 Nov 2022 11:12:42 +0000 (12:12 +0100)] 
Python 3.12.0a2

2 years ago[Enum] update version TODO comment (GH-99458)
Ethan Furman [Mon, 14 Nov 2022 04:52:30 +0000 (20:52 -0800)] 
[Enum] update version TODO comment (GH-99458)

2 years agogh-96192: fix os.ismount() to use a path that is str or bytes (#96194)
Christoph Anton Mitterer [Mon, 14 Nov 2022 04:12:32 +0000 (05:12 +0100)] 
gh-96192: fix os.ismount() to use a path that is str or bytes (#96194)

Signed-off-by: Christoph Anton Mitterer <mail@christoph.anton.mitterer.name>
Co-authored-by: Eryk Sun <eryksun@gmail.com>
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2 years agogh-99300: Use Py_NewRef() in Modules/_asynciomodule.c (#99441)
Victor Stinner [Sun, 13 Nov 2022 23:31:21 +0000 (00:31 +0100)] 
gh-99300: Use Py_NewRef() in Modules/_asynciomodule.c (#99441)

Replace Py_INCREF() and Py_XINCREF() with Py_NewRef() and
Py_XNewRef() in Modules/_asynciomodule.c.

2 years agoFix misspelling in docs for http.HTTPMethod (#99376)
Matt Harasymczuk [Sun, 13 Nov 2022 20:46:28 +0000 (21:46 +0100)] 
Fix misspelling in docs for http.HTTPMethod (#99376)

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2 years agogh-98930: improve the docstring of signal.strsignal (#99290)
ram vikram singh [Sun, 13 Nov 2022 19:41:23 +0000 (01:11 +0530)] 
gh-98930: improve the docstring of signal.strsignal (#99290)

Improves the docstring on signal.strsignal to make it explain when it returns a message, None, or when it raises ValueError.

Closes #98930

Co-authored-by: Gregory P. Smith <greg@krypto.org>
2 years agogh-99275: Fix `SystemError` in `ctypes` during `__initsubclass__` (#99283)
Nikita Sobolev [Sun, 13 Nov 2022 19:22:45 +0000 (22:22 +0300)] 
gh-99275: Fix `SystemError` in `ctypes` during `__initsubclass__` (#99283)

2 years agogh-99430: Remove duplicated tests for old-styled classes (#99432)
Nikita Sobolev [Sun, 13 Nov 2022 18:30:00 +0000 (21:30 +0300)] 
gh-99430: Remove duplicated tests for old-styled classes (#99432)

python 1 & 2 were a loong time ago.

2 years agogh-99418: Make urllib.parse.urlparse enforce that a scheme must begin with an alphabe...
Ben Kallus [Sun, 13 Nov 2022 18:25:55 +0000 (18:25 +0000)] 
gh-99418: Make urllib.parse.urlparse enforce that a scheme must begin with an alphabetical ASCII character. (#99421)

Prevent urllib.parse.urlparse from accepting schemes that don't begin with an alphabetical ASCII character.

RFC 3986 defines a scheme like this: `scheme = ALPHA *( ALPHA / DIGIT / "+" / "-" / "." )`
RFC 2234 defines an ALPHA like this: `ALPHA = %x41-5A / %x61-7A`

The WHATWG URL spec defines a scheme like this:
`"A URL-scheme string must be one ASCII alpha, followed by zero or more of ASCII alphanumeric, U+002B (+), U+002D (-), and U+002E (.)."`

2 years agogh-99300: Use Py_NewRef() in Modules/_ctypes/ (#99436)
Victor Stinner [Sun, 13 Nov 2022 15:04:54 +0000 (16:04 +0100)] 
gh-99300: Use Py_NewRef() in Modules/_ctypes/ (#99436)

Replace Py_INCREF() and Py_XINCREF() with Py_NewRef() and
Py_XNewRef() in C files of the Modules/_ctypes/ directory.

2 years agogh-99300: Use Py_NewRef() in Modules/ directory (#99440)
Victor Stinner [Sun, 13 Nov 2022 15:04:33 +0000 (16:04 +0100)] 
gh-99300: Use Py_NewRef() in Modules/ directory (#99440)

Replace Py_INCREF() and Py_XINCREF() with Py_NewRef() and
Py_XNewRef() in test C files of the Modules/ directory.

2 years agogh-99300: Use Py_NewRef() in Modules/itertoolsmodule.c (#99439)
Victor Stinner [Sun, 13 Nov 2022 15:04:22 +0000 (16:04 +0100)] 
gh-99300: Use Py_NewRef() in Modules/itertoolsmodule.c (#99439)

Replace Py_INCREF() and Py_XINCREF() with Py_NewRef() and
Py_XNewRef() in Modules/itertoolsmodule.c.

2 years agogh-99300: Use Py_NewRef() in Modules/_elementtree.c (#99438)
Victor Stinner [Sun, 13 Nov 2022 15:04:11 +0000 (16:04 +0100)] 
gh-99300: Use Py_NewRef() in Modules/_elementtree.c (#99438)

Replace Py_INCREF() and Py_XINCREF() with Py_NewRef() and
Py_XNewRef() in Modules/_elementtree.c.

2 years agogh-91248: Optimize PyFrame_GetVar() (#99252)
Victor Stinner [Sun, 13 Nov 2022 14:37:03 +0000 (15:37 +0100)] 
gh-91248: Optimize PyFrame_GetVar() (#99252)

PyFrame_GetVar() no longer creates a temporary dictionary to get a
variable.

2 years agogh-99103: Normalize specialized traceback anchors against the current line (GH-99145)
Batuhan Taskaya [Sat, 12 Nov 2022 23:37:25 +0000 (02:37 +0300)] 
gh-99103: Normalize specialized traceback anchors against the current line (GH-99145)

Automerge-Triggered-By: GH:isidentical
2 years agogh-83638: Add sqlite3.Connection.autocommit for PEP 249 compliant behaviour (#93823)
Erlend E. Aasland [Sat, 12 Nov 2022 22:44:41 +0000 (23:44 +0100)] 
gh-83638: Add sqlite3.Connection.autocommit for PEP 249 compliant behaviour (#93823)

Introduce the autocommit attribute to Connection and the autocommit
parameter to connect() for PEP 249-compliant transaction handling.

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
Co-authored-by: C.A.M. Gerlach <CAM.Gerlach@Gerlach.CAM>
Co-authored-by: Géry Ogam <gery.ogam@gmail.com>
2 years agogh-99357: Close the event loop when it is no longer used in test_uncancel_structured_...
Xiao Chen [Sat, 12 Nov 2022 20:16:44 +0000 (04:16 +0800)] 
gh-99357: Close the event loop when it is no longer used in test_uncancel_structured_blocks (#99414)

2 years agogh-99392: Fix sqlite3 converter recipes (#99393)
naglis [Sat, 12 Nov 2022 19:39:37 +0000 (21:39 +0200)] 
gh-99392: Fix sqlite3 converter recipes (#99393)

2 years agogh-98762: Fix locations of match sub-patterns (GH-98775)
Irit Katriel [Sat, 12 Nov 2022 18:42:17 +0000 (18:42 +0000)] 
gh-98762: Fix locations of match sub-patterns (GH-98775)

2 years agogh-99304: [Enum] clarify what constitutes a flag alias (GH-99395)
Ethan Furman [Sat, 12 Nov 2022 18:39:47 +0000 (10:39 -0800)] 
gh-99304: [Enum] clarify what constitutes a flag alias (GH-99395)

Co-authored-by: C.A.M. Gerlach <CAM.Gerlach@Gerlach.CAM>
2 years agoGH-81057: Remove static state from arraymodule (#99409)
Kumar Aditya [Sat, 12 Nov 2022 09:11:32 +0000 (14:41 +0530)] 
GH-81057: Remove static state from arraymodule (#99409)

2 years agoGH-94597: add deprecation warnings for subclassing `AbstractChildWatcher` (#99386)
Kumar Aditya [Sat, 12 Nov 2022 07:17:53 +0000 (12:47 +0530)] 
GH-94597: add deprecation warnings for subclassing `AbstractChildWatcher` (#99386)

2 years agogh-80448: argparse: Fix IndexError on store_true action (#15656)
Hai Shi [Sat, 12 Nov 2022 01:51:38 +0000 (09:51 +0800)] 
gh-80448: argparse: Fix IndexError on store_true action (#15656)

Co-authored-by: Rémi Lapeyre <remi.lapeyre@henki.fr>
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com>
2 years agogh-81057: Move PyImport_Inittab to _PyRuntimeState (gh-99402)
Eric Snow [Sat, 12 Nov 2022 00:06:05 +0000 (17:06 -0700)] 
gh-81057: Move PyImport_Inittab to _PyRuntimeState (gh-99402)

We actually don't move PyImport_Inittab.  Instead, we make a copy that we keep on _PyRuntimeState and use only that after Py_Initialize().  We also prevent folks from modifying PyImport_Inittab (the best we can) after that point.

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

2 years agogh-81057: Move the Allocators to _PyRuntimeState (gh-99217)
Eric Snow [Fri, 11 Nov 2022 23:30:46 +0000 (16:30 -0700)] 
gh-81057: Move the Allocators to _PyRuntimeState (gh-99217)

The global allocators were stored in 3 static global variables: _PyMem_Raw, _PyMem, and _PyObject.  State for the "small block" allocator was stored in another 13.  That makes a total of 16 global variables. We are moving all 16 to the _PyRuntimeState struct as part of the work for gh-81057.  (If PEP 684 is accepted then we will follow up by moving them all to PyInterpreterState.)

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

2 years agogh-99305: Speed up secrets.token_hex() ~2x (#99306)
NewUserHa [Fri, 11 Nov 2022 22:45:24 +0000 (06:45 +0800)] 
gh-99305: Speed up secrets.token_hex() ~2x (#99306)

simple code modernization.

Co-authored-by: Pieter Eendebak <pieter.eendebak@gmail.com>
3 years agogh-81057: Add PyInterpreterState.static_objects (gh-99397)
Eric Snow [Fri, 11 Nov 2022 21:24:18 +0000 (14:24 -0700)] 
gh-81057: Add PyInterpreterState.static_objects (gh-99397)

As we consolidate global variables, we find some objects that are almost suitable to add to _PyRuntimeState.global_objects, but have some small/sneaky bit of per-interpreter state (e.g. a weakref list). We're adding PyInterpreterState.static_objects so we can move such objects there. (We'll removed the _not_used field once we've added others.)

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

3 years agogh-81057: Move the Extension Modules Cache to _PyRuntimeState (gh-99355)
Eric Snow [Fri, 11 Nov 2022 21:16:28 +0000 (14:16 -0700)] 
gh-81057: Move the Extension Modules Cache to _PyRuntimeState (gh-99355)

We also move the closely related max_module_number and add comments documenting the group of struct members.

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

3 years agogh-81057: Generate a Separate Initializer For Each Part of the Global Objects Initial...
Eric Snow [Fri, 11 Nov 2022 20:23:41 +0000 (13:23 -0700)] 
gh-81057: Generate a Separate Initializer For Each Part of the Global Objects Initializer (gh-99389)

Up until now we had a single generated initializer macro for all the statically declared global objects in _PyRuntimeState, including several one-offs (e.g. the empty tuple). The one-offs don't need to be generated, but were because we had one big initializer. Having separate initializers for set of generated global objects allows us to generate only the ones we need to.  This allows us to add initializers for one-off global objects without having to generate them.

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

3 years agogh-98707: configure --with-system-libmpdec and --with-system-expat no longer include...
Miro Hrončok [Fri, 11 Nov 2022 18:59:30 +0000 (19:59 +0100)] 
gh-98707: configure --with-system-libmpdec and --with-system-expat no longer include vendored headers (#98711)

3 years agoFix typo in Tools/wasm/README.md (GH-99384)
Ikko Ashimine [Fri, 11 Nov 2022 16:38:09 +0000 (01:38 +0900)] 
Fix typo in Tools/wasm/README.md (GH-99384)

Noticable -> Noticeable

Automerge-Triggered-By: GH:AlexWaygood
3 years agogh-87604: Clarify in docs that sys.addaudithook is not for sandboxes (GH-99372)
Steve Dower [Fri, 11 Nov 2022 13:35:02 +0000 (13:35 +0000)] 
gh-87604: Clarify in docs that sys.addaudithook is not for sandboxes (GH-99372)

3 years agogh-99254: remove all unused consts from code objects (GH-99255)
Irit Katriel [Fri, 11 Nov 2022 10:53:43 +0000 (10:53 +0000)] 
gh-99254: remove all unused consts from code objects (GH-99255)

3 years agogh-99325: Remove unused `NameError` handling (#99326)
Nikita Sobolev [Fri, 11 Nov 2022 09:56:57 +0000 (12:56 +0300)] 
gh-99325: Remove unused `NameError` handling (#99326)

3 years agoUpdate github CI to use OpenSSL 1.1.1s and 3.0.7. (#99364)
Gregory P. Smith [Fri, 11 Nov 2022 09:33:55 +0000 (01:33 -0800)] 
Update github CI to use OpenSSL 1.1.1s and 3.0.7. (#99364)

3 years agogh-98086: Now ``patch.dict`` can decorate async functions (#98095)
Nikita Sobolev [Fri, 11 Nov 2022 08:04:30 +0000 (11:04 +0300)] 
gh-98086: Now ``patch.dict`` can decorate async functions (#98095)

3 years agogh-84522: Add for-loop to apply-method-to-sequence FAQ (#94660)
Samuel Sloniker [Fri, 11 Nov 2022 04:16:16 +0000 (20:16 -0800)] 
gh-84522: Add for-loop to apply-method-to-sequence FAQ (#94660)

3 years agogh-98366: use sphinx.locale._ as gettext() in pyspecific.py (#98437)
Wei-Hsiang (Matt) Wang [Fri, 11 Nov 2022 01:18:11 +0000 (09:18 +0800)] 
gh-98366: use sphinx.locale._ as gettext() in pyspecific.py (#98437)

fix(doc-tools): use sphinx.locale._ as gettext() for backward-compatibility in pyspecific.py

[why] spinix 5.3 changed locale.translators from a defaultdict(gettext.NullTranslations) to a dict, which leads to failure of pyspecific.py. Use sphinx.locale._ as gettext to fix the issue.

3 years agogh-99300: Use Py_NewRef() in Objects/ directory (#99354)
Victor Stinner [Thu, 10 Nov 2022 22:58:07 +0000 (23:58 +0100)] 
gh-99300: Use Py_NewRef() in Objects/ directory (#99354)

Replace Py_INCREF() and Py_XINCREF() with Py_NewRef() and
Py_XNewRef() in C files of the Objects/ directory.

3 years agogh-99300: Use Py_NewRef() in Objects/ directory (#99351)
Victor Stinner [Thu, 10 Nov 2022 22:40:31 +0000 (23:40 +0100)] 
gh-99300: Use Py_NewRef() in Objects/ directory (#99351)

Replace Py_INCREF() and Py_XINCREF() with Py_NewRef() and
Py_XNewRef() in C files of the Objects/ directory.

3 years agogh-99300: Use Py_NewRef() in Objects/ directory (#99335)
Victor Stinner [Thu, 10 Nov 2022 21:22:02 +0000 (22:22 +0100)] 
gh-99300: Use Py_NewRef() in Objects/ directory (#99335)

Replace Py_INCREF() and Py_XINCREF() with Py_NewRef() and
Py_XNewRef() in C files of the Objects/ directory.

3 years agoGH-99183: Document behavior of count() for empty substrings (GH-99339)
Raymond Hettinger [Thu, 10 Nov 2022 21:20:01 +0000 (15:20 -0600)] 
GH-99183: Document behavior of count() for empty substrings (GH-99339)

3 years agogh-99300: Use Py_NewRef() in Objects/listobject.c (#99336)
Victor Stinner [Thu, 10 Nov 2022 21:09:18 +0000 (22:09 +0100)] 
gh-99300: Use Py_NewRef() in Objects/listobject.c (#99336)

Replace Py_INCREF() and Py_XINCREF() with Py_NewRef() and
Py_XNewRef() in Objects/listobject.c.

3 years agoGH-98831: Remove all remaining DISPATCH() calls from bytecodes.c (#99271)
Guido van Rossum [Thu, 10 Nov 2022 18:50:57 +0000 (10:50 -0800)] 
GH-98831: Remove all remaining DISPATCH() calls from bytecodes.c (#99271)

Also mark those opcodes that have no stack effect as such.

Co-authored-by: Brandt Bucher <brandtbucher@gmail.com>
3 years agoGH-99298: Don't perform jumps before error handling (GH-99299)
Brandt Bucher [Thu, 10 Nov 2022 16:46:56 +0000 (08:46 -0800)] 
GH-99298: Don't perform jumps before error handling (GH-99299)

3 years agogh-99204: Calculate base_executable by alternate names in POSIX venvs (GH-99206)
Vincent Fazio [Thu, 10 Nov 2022 16:26:42 +0000 (10:26 -0600)] 
gh-99204: Calculate base_executable by alternate names in POSIX venvs (GH-99206)

Check to see if `base_executable` exists. If it does not, attempt
to use known alternative names of the python binary to find an
executable in the path specified by `home`.

If no alternative is found, previous behavior is preserved.

Signed-off-by: Vincent Fazio <vfazio@gmail.com>
Signed-off-by: Vincent Fazio <vfazio@gmail.com>
3 years agogh-99277: remove older version of `get_write_buffer_limits` (#99280)
Carlo [Thu, 10 Nov 2022 16:07:17 +0000 (17:07 +0100)] 
gh-99277: remove older version of `get_write_buffer_limits` (#99280)

Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
3 years agogh-90110: Update the C-analyzer Tool (gh-99307)
Eric Snow [Thu, 10 Nov 2022 16:03:57 +0000 (09:03 -0700)] 
gh-90110: Update the C-analyzer Tool (gh-99307)

3 years agogh-99300: Use Py_NewRef() in Objects/dictobject.c (#99333)
Victor Stinner [Thu, 10 Nov 2022 15:27:53 +0000 (16:27 +0100)] 
gh-99300: Use Py_NewRef() in Objects/dictobject.c (#99333)

Replace Py_INCREF() and Py_XINCREF() with Py_NewRef() and
Py_XNewRef() in Objects/dictobject.c.

3 years agogh-99300: Use Py_NewRef() in Objects/ directory (#99332)
Victor Stinner [Thu, 10 Nov 2022 15:27:32 +0000 (16:27 +0100)] 
gh-99300: Use Py_NewRef() in Objects/ directory (#99332)

Replace Py_INCREF() and Py_XINCREF() with Py_NewRef() and
Py_XNewRef() in C files of the Objects/ directory.

3 years agogh-99300: Use Py_NewRef() in Parser/ directory (#99330)
Victor Stinner [Thu, 10 Nov 2022 14:30:05 +0000 (15:30 +0100)] 
gh-99300: Use Py_NewRef() in Parser/ directory (#99330)

Replace Py_INCREF() with Py_NewRef() in C files of the Parser/
directory and in the PEG generator.

3 years agoGH-96421: Insert shim frame on entry to interpreter (GH-96319)
Mark Shannon [Thu, 10 Nov 2022 12:34:57 +0000 (04:34 -0800)] 
GH-96421: Insert shim frame on entry to interpreter (GH-96319)

* Adds EXIT_INTERPRETER instruction to exit PyEval_EvalDefault()

* Simplifies RETURN_VALUE, YIELD_VALUE and RETURN_GENERATOR instructions as they no longer need to check for entry frames.

3 years agogh-74044: inspect.signature for wrappers around decorated bound methods (GH-736)
Anton Ryzhov [Thu, 10 Nov 2022 12:32:01 +0000 (13:32 +0100)] 
gh-74044: inspect.signature for wrappers around decorated bound methods (GH-736)

3 years agoGH-99257: Check the owner's type when specializing slots (GH-99258)
Brandt Bucher [Thu, 10 Nov 2022 11:50:34 +0000 (03:50 -0800)] 
GH-99257: Check the owner's type when specializing slots (GH-99258)

3 years agogh-99320: remove tests for old-style class from `test_complex` (#99321)
Nikita Sobolev [Thu, 10 Nov 2022 10:51:22 +0000 (13:51 +0300)] 
gh-99320: remove tests for old-style class from `test_complex` (#99321)

3 years agogh-99281: [csv] remove try/except, `complex` always exists (#99282)
Nikita Sobolev [Thu, 10 Nov 2022 10:37:57 +0000 (13:37 +0300)] 
gh-99281: [csv] remove try/except, `complex` always exists (#99282)

3 years agogh-99300: Use Py_NewRef() in Python/ceval.c (#99318)
Victor Stinner [Thu, 10 Nov 2022 10:25:33 +0000 (11:25 +0100)] 
gh-99300: Use Py_NewRef() in Python/ceval.c (#99318)

Replace Py_INCREF() and Py_XINCREF() with Py_NewRef() and
Py_XNewRef() in Python/ceval.c and related files.

3 years agogh-99300: Use Py_NewRef() in Python/ directory (#99317)
Victor Stinner [Thu, 10 Nov 2022 10:23:36 +0000 (11:23 +0100)] 
gh-99300: Use Py_NewRef() in Python/ directory (#99317)

Replace Py_INCREF() and Py_XINCREF() with Py_NewRef() and
Py_XNewRef() in C files of the Python/ directory.

Update Parser/asdl_c.py to regenerate Python/Python-ast.c.

3 years agogh-99300: Use Py_NewRef() in Python/ directory (#99302)
Victor Stinner [Thu, 10 Nov 2022 08:03:39 +0000 (09:03 +0100)] 
gh-99300: Use Py_NewRef() in Python/ directory (#99302)

Replace Py_INCREF() and Py_XINCREF() with Py_NewRef() and
Py_XNewRef() in C files of the Python/ directory.

3 years agobpo-34272: Reorganize C API tests. (GH-8551)
Serhiy Storchaka [Thu, 10 Nov 2022 06:54:37 +0000 (08:54 +0200)] 
bpo-34272: Reorganize C API tests. (GH-8551)

Move some C API tests into Lib/test/test_capi/.

3 years agogh-98832: Change wording in docstring of `pathlib.Path.iterdir` (GH-98833)
Nikita Sobolev [Wed, 9 Nov 2022 22:05:07 +0000 (01:05 +0300)] 
gh-98832: Change wording in docstring of `pathlib.Path.iterdir` (GH-98833)

Found while working on https://github.com/python/cpython/issues/98829

Automerge-Triggered-By: GH:AlexWaygood
3 years agoGH-99205: Mark new interpreters and threads as non-static (GH-99268)
Brandt Bucher [Wed, 9 Nov 2022 21:55:20 +0000 (13:55 -0800)] 
GH-99205: Mark new interpreters and threads as non-static (GH-99268)

3 years agoUpdate reference to the size of PyPI (#99076)
jmcb [Wed, 9 Nov 2022 19:26:46 +0000 (19:26 +0000)] 
Update reference to the size of PyPI (#99076)

Update reference to the size of PyPI

Last changed in 2008 (528576031d9655ca8004260a2bf2c783f77d1da1).

3 years agoGH-98686: Get rid of "adaptive" and "quick" instructions (GH-99182)
Brandt Bucher [Wed, 9 Nov 2022 18:50:09 +0000 (10:50 -0800)] 
GH-98686: Get rid of "adaptive" and "quick" instructions (GH-99182)

3 years agoGH-90699: disallow `_Py_IDENTIFIER` in core code (GH-99210)
Kumar Aditya [Wed, 9 Nov 2022 16:53:21 +0000 (22:23 +0530)] 
GH-90699: disallow `_Py_IDENTIFIER` in core code  (GH-99210)

3 years agogh-98724: Fix Py_CLEAR() macro side effects (#99100)
Victor Stinner [Wed, 9 Nov 2022 13:06:36 +0000 (14:06 +0100)] 
gh-98724: Fix Py_CLEAR() macro side effects (#99100)

The Py_CLEAR(), Py_SETREF() and Py_XSETREF() macros now only evaluate
their argument once. If an argument has side effects, these side
effects are no longer duplicated.

Add test_py_clear() and test_py_setref() unit tests to _testcapi.

3 years agogh-90868: Add _PyStaticObject_CheckRefcnt() function (#99261)
Victor Stinner [Wed, 9 Nov 2022 07:40:40 +0000 (08:40 +0100)] 
gh-90868: Add _PyStaticObject_CheckRefcnt() function (#99261)

Add _PyStaticObject_CheckRefcnt() function to make
_PyStaticObjects_CheckRefcnt() shorter. Use
_PyObject_ASSERT_FAILED_MSG() to log the object causing the fatal
error.

3 years agoCODEOWNERS: add myself to sysconfig and importlib.resources (#98851)
Filipe Laíns [Wed, 9 Nov 2022 03:27:13 +0000 (03:27 +0000)] 
CODEOWNERS: add myself to sysconfig and importlib.resources (#98851)

3 years ago[Enum] Typo: fix DuplicateFreeEnum example docs (GH-99265)
Bruno Neyra [Wed, 9 Nov 2022 00:39:56 +0000 (21:39 -0300)] 
[Enum] Typo: fix DuplicateFreeEnum example docs (GH-99265)

3 years agogh-99238: clarify the type of the env dict. (#99253)
Gregory P. Smith [Tue, 8 Nov 2022 21:00:31 +0000 (13:00 -0800)] 
gh-99238: clarify the type of the env dict. (#99253)

3 years agogh-94445: add compiler test for another case of excessive stack use (GH-99237)
Carl Meyer [Tue, 8 Nov 2022 20:39:32 +0000 (14:39 -0600)] 
gh-94445: add compiler test for another case of excessive stack use (GH-99237)

3 years agogh-99248: [Enum] fix negative number infinite loop (GH-99256)
Ethan Furman [Tue, 8 Nov 2022 20:00:19 +0000 (12:00 -0800)] 
gh-99248: [Enum] fix negative number infinite loop (GH-99256)

[Enum] fix negative number infinite loop

- _iter_bits_lsb() now raises a ValueError if a negative number
  is passed in

- verify() now skips checking negative numbers for named flags

3 years agogh-90868: Adjust the Generated Objects (gh-99223)
Eric Snow [Tue, 8 Nov 2022 17:03:03 +0000 (10:03 -0700)] 
gh-90868: Adjust the Generated Objects (gh-99223)

We do the following:

* move the generated _PyUnicode_InitStaticStrings() to its own file
* move the generated _PyStaticObjects_CheckRefcnt() to its own file
* include pycore_global_objects.h in extension modules instead of pycore_runtime_init.h

These changes help us avoid including things that aren't needed.

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

3 years agogh-98627: Add the _testsinglephase Module (gh-99039)
Eric Snow [Tue, 8 Nov 2022 16:58:11 +0000 (09:58 -0700)] 
gh-98627: Add the _testsinglephase Module (gh-99039)

This makes it more clear that a given test is definitely testing against a single-phase init (legacy) extension module.  The new module is a companion to _testmultiphase.

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

3 years agogh-91248: Add PyFrame_GetVar() function (#95712)
Victor Stinner [Tue, 8 Nov 2022 16:40:27 +0000 (17:40 +0100)] 
gh-91248: Add PyFrame_GetVar() function (#95712)

Add PyFrame_GetVar() and PyFrame_GetVarString() functions to get a
frame variable by its name.

Move PyFrameObject C API tests from test_capi to test_frame.

3 years agoFix broken link in `asyncio-subprocesses` doc (GH-99214)
Mikael Koli [Tue, 8 Nov 2022 16:26:06 +0000 (18:26 +0200)] 
Fix broken link in `asyncio-subprocesses` doc (GH-99214)

# Fix broken link in Doc/library/asyncio-subprocess.rst

This is a trivial fix in documentation to fix a broken link.

There is a broken link in [Doc/library/asyncio-subprocess.rst](https://docs.python.org/3/library/asyncio-subprocess.html#asyncio.subprocess.Process) for the function ``wait_for``:

![image](https://user-images.githubusercontent.com/37690409/200388894-fb6b7c42-b2cc-49ec-a239-e3472890db1f.png)

I suppose this refers to the function ``asyncio.wait_for`` which is not clear in the docs.

This PR fixes the link and the result looks like the following:

![image](https://user-images.githubusercontent.com/37690409/200389483-b4a92105-7d2c-4285-b0fc-78a6dc0be39c.png)

Automerge-Triggered-By: GH:AlexWaygood
3 years agoGH-98831: Simple input-output stack effects for bytecodes.c (#99120)
Guido van Rossum [Tue, 8 Nov 2022 16:22:56 +0000 (08:22 -0800)] 
GH-98831: Simple input-output stack effects for bytecodes.c (#99120)

3 years agoGH-93143: Don't turn LOAD_FAST into LOAD_FAST_CHECK (GH-99075)
Brandt Bucher [Tue, 8 Nov 2022 15:50:46 +0000 (07:50 -0800)] 
GH-93143: Don't turn LOAD_FAST into LOAD_FAST_CHECK (GH-99075)

3 years agogh-72719: Remove asyncore and asynchat modules (#96580)
Nikita Sobolev [Tue, 8 Nov 2022 15:48:58 +0000 (18:48 +0300)] 
gh-72719: Remove asyncore and asynchat modules (#96580)

Remove modules asyncore and asynchat, which were deprecated by PEP 594.

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
3 years agogh-99181: fix except* on unhashable exceptions (GH-99192)
Irit Katriel [Tue, 8 Nov 2022 09:32:20 +0000 (09:32 +0000)] 
gh-99181: fix except* on unhashable exceptions (GH-99192)

3 years agoGH-90699: fix refleak in `_testcapimodule.c` (gh-99236)
Kumar Aditya [Tue, 8 Nov 2022 06:50:07 +0000 (12:20 +0530)] 
GH-90699: fix refleak in `_testcapimodule.c` (gh-99236)

3 years agogh-92119: ctypes: Print exception class name instead of its representation (#98302)
Kamil Turek [Tue, 8 Nov 2022 04:53:59 +0000 (05:53 +0100)] 
gh-92119: ctypes: Print exception class name instead of its representation (#98302)

3 years agogh-98513: Test abstract methods of some `collections` types (#98516)
Nikita Sobolev [Tue, 8 Nov 2022 01:48:23 +0000 (04:48 +0300)] 
gh-98513: Test abstract methods of some `collections` types (#98516)

3 years agogh-99124: use concrete exception types in `test_builtin` (#99125)
Nikita Sobolev [Tue, 8 Nov 2022 01:47:32 +0000 (04:47 +0300)] 
gh-99124: use concrete exception types in `test_builtin` (#99125)

3 years agogh-98433: Fix quadratic time idna decoding. (#99092)
Gregory P. Smith [Tue, 8 Nov 2022 00:54:41 +0000 (16:54 -0800)] 
gh-98433: Fix quadratic time idna decoding. (#99092)

There was an unnecessary quadratic loop in idna decoding. This restores
the behavior to linear.

This also adds an early length check in IDNA decoding to outright reject
huge inputs early on given the ultimate result is defined to be 63 or fewer
characters.

3 years agogh-98817: Remove PCbuild/lib.pyproj (GH-98818)
Hugo van Kemenade [Mon, 7 Nov 2022 20:23:35 +0000 (22:23 +0200)] 
gh-98817: Remove PCbuild/lib.pyproj (GH-98818)

3 years agoGH-90699: Remove remaining `_Py_IDENTIFIER` stdlib usage (GH-99067)
Kumar Aditya [Mon, 7 Nov 2022 20:06:23 +0000 (01:36 +0530)] 
GH-90699: Remove remaining `_Py_IDENTIFIER`  stdlib usage (GH-99067)

3 years agogh-96746: Docs: Clear up Py_TPFLAGS_DISALLOW_INSTANTIATION inheritance (GH-99002)
Petr Viktorin [Mon, 7 Nov 2022 18:45:50 +0000 (19:45 +0100)] 
gh-96746: Docs: Clear up Py_TPFLAGS_DISALLOW_INSTANTIATION inheritance (GH-99002)

The flag is not inherited, but its effect -- a NULL tp_new -- is.

Drop hints for people who come here wanting to “disallow instantiation”.

3 years agoGH-96793: Specialize FOR_ITER for generators. (GH-98772)
Mark Shannon [Mon, 7 Nov 2022 14:49:51 +0000 (06:49 -0800)] 
GH-96793: Specialize FOR_ITER for generators. (GH-98772)

3 years agogh-95389: expose popular ETHERTYPE_* constants in the socket module (#95390)
Noam Cohen [Mon, 7 Nov 2022 14:27:37 +0000 (16:27 +0200)] 
gh-95389: expose popular ETHERTYPE_* constants in the socket module (#95390)

Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
Co-authored-by: CAM Gerlach <CAM.Gerlach@Gerlach.CAM>
3 years agogh-98254: Add what's new entry for the improvement in commit bb56dead336357153a0c3b8c...
Pablo Galindo Salgado [Mon, 7 Nov 2022 13:37:14 +0000 (13:37 +0000)] 
gh-98254: Add what's new entry for the improvement in commit bb56dead336357153a0c3b8cc9d9d6856d2c5a03 (#99197)

3 years agogh-91058: Add what's new entry for the improvement in commit 7cfbb49fcd4c85f9bab37973...
Pablo Galindo Salgado [Mon, 7 Nov 2022 13:36:48 +0000 (13:36 +0000)] 
gh-91058: Add what's new entry for the improvement in commit 7cfbb49fcd4c85f9bab3797302eadf93df490344 (#99198)

3 years agoDocs: add argument spec to sqlite3 CLI docs (#99200)
Erlend E. Aasland [Mon, 7 Nov 2022 13:18:36 +0000 (14:18 +0100)] 
Docs: add argument spec to sqlite3 CLI docs (#99200)

3 years agobpo-38523: ignore_dangling_symlinks does not apply recursively (GH-22937)
Zackery Spytz [Mon, 7 Nov 2022 11:45:16 +0000 (03:45 -0800)] 
bpo-38523: ignore_dangling_symlinks does not apply recursively (GH-22937)

3 years agoremove new line in pickle exception message (GH-31782)
Harshil [Mon, 7 Nov 2022 07:43:39 +0000 (13:13 +0530)] 
remove new line in pickle exception message (GH-31782)

3 years agogh-91803: Mock - fix error when using autospec methods with seal (#92213)
andrei kulakov [Mon, 7 Nov 2022 07:24:46 +0000 (02:24 -0500)] 
gh-91803: Mock - fix error when using autospec methods with seal (#92213)

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

Co-authored-by: Karthikeyan Singaravelan <tir.karthi@gmail.com>
Co-authored-by: Irit Katriel <1055913+iritkatriel@users.noreply.github.com>
3 years agodoc: Formatting and typo fixes (#98974)
jmcb [Mon, 7 Nov 2022 04:55:55 +0000 (04:55 +0000)] 
doc: Formatting and typo fixes (#98974)

3 years agoGH-99155: Fix `NormalDist` pickle with `0` and `1` protocols (GH-99156)
Nikita Sobolev [Mon, 7 Nov 2022 03:02:13 +0000 (06:02 +0300)] 
GH-99155: Fix `NormalDist` pickle with `0` and `1` protocols (GH-99156)

3 years agoGH-99155: Fix `NormalDist` pickle with `0` and `1` protocols (GH99156)
Nikita Sobolev [Mon, 7 Nov 2022 02:56:41 +0000 (05:56 +0300)] 
GH-99155: Fix `NormalDist` pickle with `0` and `1` protocols (GH99156)