]> git.ipfire.org Git - thirdparty/Python/cpython.git/log
thirdparty/Python/cpython.git
2 years agogh-93937: Document PyFrame_Check and PyFrame_Type (GH-99695)
Petr Viktorin [Tue, 22 Nov 2022 15:41:57 +0000 (16:41 +0100)] 
gh-93937: Document PyFrame_Check and PyFrame_Type (GH-99695)

2 years agogh-88863: Clear ref cycles to resolve leak when asyncio.open_connection raises (...
Dong Uk, Kang [Tue, 22 Nov 2022 15:06:20 +0000 (00:06 +0900)] 
gh-88863: Clear ref cycles to resolve leak when asyncio.open_connection raises (#95739)

Break reference cycles to resolve memory leak, by
removing local exception and future instances from the frame

2 years agogh-99537: Use Py_CLEAR() function in C code (#99686)
Victor Stinner [Tue, 22 Nov 2022 14:22:55 +0000 (15:22 +0100)] 
gh-99537: Use Py_CLEAR() function in C code (#99686)

Replace "Py_XDECREF(var); var = NULL;" with "Py_CLEAR(var);".

Don't replace "Py_DECREF(var); var = NULL;" with "Py_CLEAR(var);". It
would add an useless "if (var)" test in code path where var cannot be
NULL.

2 years agogh-99537: Use Py_SETREF() function in C code (#99656)
Victor Stinner [Tue, 22 Nov 2022 13:22:22 +0000 (14:22 +0100)] 
gh-99537: Use Py_SETREF() function in C code (#99656)

Fix potential race condition in code patterns:

* Replace "Py_DECREF(var); var = new;" with "Py_SETREF(var, new);"
* Replace "Py_XDECREF(var); var = new;" with "Py_XSETREF(var, new);"
* Replace "Py_CLEAR(var); var = new;" with "Py_XSETREF(var, new);"

Other changes:

* Replace "old = var; var = new; Py_DECREF(var)"
  with "Py_SETREF(var, new);"
* Replace "old = var; var = new; Py_XDECREF(var)"
  with "Py_XSETREF(var, new);"
* And remove the "old" variable.

2 years agogh-99537: Use Py_SETREF() function in C code (#99657)
Victor Stinner [Tue, 22 Nov 2022 12:39:11 +0000 (13:39 +0100)] 
gh-99537: Use Py_SETREF() function in C code (#99657)

Fix potential race condition in code patterns:

* Replace "Py_DECREF(var); var = new;" with "Py_SETREF(var, new);"
* Replace "Py_XDECREF(var); var = new;" with "Py_XSETREF(var, new);"
* Replace "Py_CLEAR(var); var = new;" with "Py_XSETREF(var, new);"

Other changes:

* Replace "old = var; var = new; Py_DECREF(var)"
  with "Py_SETREF(var, new);"
* Replace "old = var; var = new; Py_XDECREF(var)"
  with "Py_XSETREF(var, new);"
* And remove the "old" variable.

2 years agogh-91053: Add an optional callback that is invoked whenever a function is modified...
mpage [Tue, 22 Nov 2022 12:06:44 +0000 (04:06 -0800)] 
gh-91053: Add an optional callback that is invoked whenever a function is modified (#98175)

2 years agogh-99537: Use Py_SETREF() function in longobject C code (#99655)
Victor Stinner [Tue, 22 Nov 2022 12:04:19 +0000 (13:04 +0100)] 
gh-99537: Use Py_SETREF() function in longobject C code (#99655)

Replace "Py_DECREF(var); var = new;" with "Py_SETREF(var, new);"
in longobject.c and _testcapi/long.c.

2 years agogh-99341: Cover type ignore nodes when incrementing line numbers (GH-99422)
Batuhan Taskaya [Tue, 22 Nov 2022 10:41:14 +0000 (13:41 +0300)] 
gh-99341: Cover type ignore nodes when incrementing line numbers (GH-99422)

2 years agoGH-92892: Add section about variadic functions to ctypes documentation (#99529)
Ronald Oussoren [Tue, 22 Nov 2022 10:33:37 +0000 (11:33 +0100)] 
GH-92892: Add section about variadic functions to ctypes documentation (#99529)

On some platforms, and in particular macOS/arm64, the calling
convention for variadic arguments is different from the regular
calling convention. Add a section to the documentation to document
this.

2 years agoGH-97001: Release GIL in termios extension (#99503)
Ronald Oussoren [Tue, 22 Nov 2022 10:14:23 +0000 (11:14 +0100)] 
GH-97001: Release GIL in termios extension (#99503)

Without releasing the GIL calls to termios APIs might block the entire interpreter.

2 years agogh-47146: Soft-deprecate structmember.h, expose its contents via Python.h (GH-99014)
Petr Viktorin [Tue, 22 Nov 2022 07:25:43 +0000 (08:25 +0100)] 
gh-47146: Soft-deprecate structmember.h, expose its contents via Python.h (GH-99014)

The ``structmember.h`` header is deprecated, though it continues to be available
and there are no plans to remove it. There are no deprecation warnings. Old code
can stay unchanged (unless the extra include and non-namespaced macros bother
you greatly). Specifically, no uses in CPython are updated -- that would just be
unnecessary churn.
The ``structmember.h`` header is deprecated, though it continues to be
available and there are no plans to remove it.

Its contents are now available just by including ``Python.h``,
with a ``Py`` prefix added if it was missing:

- `PyMemberDef`, `PyMember_GetOne` and`PyMember_SetOne`
- Type macros like `Py_T_INT`, `Py_T_DOUBLE`, etc.
  (previously ``T_INT``, ``T_DOUBLE``, etc.)
- The flags `Py_READONLY` (previously ``READONLY``) and
  `Py_AUDIT_READ` (previously all uppercase)

Several items are not exposed from ``Python.h``:

- `T_OBJECT` (use `Py_T_OBJECT_EX`)
- `T_NONE` (previously undocumented, and pretty quirky)
- The macro ``WRITE_RESTRICTED`` which does nothing.
- The macros ``RESTRICTED`` and ``READ_RESTRICTED``, equivalents of
  `Py_AUDIT_READ`.
- In some configurations, ``<stddef.h>`` is not included from ``Python.h``.
  It should be included manually when using ``offsetof()``.

The deprecated header continues to provide its original
contents under the original names.
Your old code can stay unchanged, unless the extra include and non-namespaced
macros bother you greatly.

There is discussion on the issue to rename `T_PYSSIZET` to `PY_T_SSIZE` or
similar. I chose not to do that -- users will probably copy/paste that with any
spelling, and not renaming it makes migration docs simpler.

Co-Authored-By: Alexander Belopolsky <abalkin@users.noreply.github.com>
Co-Authored-By: Matthias Braun <MatzeB@users.noreply.github.com>
2 years agogh-99662: fix typo in typing.TypeVarTuple docs (#99672)
GabrielAnguita [Tue, 22 Nov 2022 04:02:55 +0000 (01:02 -0300)] 
gh-99662: fix typo in typing.TypeVarTuple docs (#99672)

2 years agogh-99659: Use correct exceptions in sqlite3 bigmem tests (#99660)
Łukasz Langa [Mon, 21 Nov 2022 20:44:17 +0000 (21:44 +0100)] 
gh-99659: Use correct exceptions in sqlite3 bigmem tests (#99660)

The tests in question were added in 0eec6276fdcd by Serhiy. Apparently,
sqlite3 changed exceptions raised in those cases in the mean time but
the tests never ran because they require a high `-M` setting in the
test runner.

2 years agogh-98629: Fixes sys._git and sys.version creation on Windows (GH-99664)
Steve Dower [Mon, 21 Nov 2022 20:42:18 +0000 (20:42 +0000)] 
gh-98629: Fixes sys._git and sys.version creation on Windows (GH-99664)

2 years agogh-96002: Add functional test for Argument Clinic (#96178)
colorfulappl [Mon, 21 Nov 2022 14:08:45 +0000 (22:08 +0800)] 
gh-96002: Add functional test for Argument Clinic (#96178)

Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
2 years agoAdd more details in test_unittest (GH-99626)
Serhiy Storchaka [Mon, 21 Nov 2022 11:57:30 +0000 (13:57 +0200)] 
Add more details in test_unittest (GH-99626)

2 years agogh-99578: Fix refleak in _imp.create_builtin() (#99642)
Victor Stinner [Mon, 21 Nov 2022 11:14:54 +0000 (12:14 +0100)] 
gh-99578: Fix refleak in _imp.create_builtin() (#99642)

Fix a reference bug in _imp.create_builtin() after the creation of
the first sub-interpreter for modules "builtins" and "sys".

2 years agoGH-95815: Document less specific error for os.remove (#99571)
Ronald Oussoren [Mon, 21 Nov 2022 10:08:06 +0000 (11:08 +0100)] 
GH-95815: Document less specific error for os.remove (#99571)

os.remove can raise PermissionError instead of IsADirectoryError,
when the object to be removed is a directory (in particular on
macOS).

This reverts a change done in #14262.

2 years agogh-99337: Fix compile errors with gcc 12 on macOS (#99470)
Ronald Oussoren [Mon, 21 Nov 2022 09:50:20 +0000 (10:50 +0100)] 
gh-99337: Fix compile errors with gcc 12 on macOS (#99470)

Fix a number of compile errors with GCC-12 on macOS:

1. In pylifecycle.c the compile rejects _Pragma within a declaration
2. posixmodule.c was missing a number of ..._RUNTIME macros for non-clang on macOS
3. _ctypes assumed that __builtin_available is always present on macOS

2 years agogh-90994: Improve error messages upon call arguments syntax errors (GH-96893)
Lysandros Nikolaou [Sun, 20 Nov 2022 23:15:05 +0000 (00:15 +0100)] 
gh-90994: Improve error messages upon call arguments syntax errors (GH-96893)

2 years agogh-99581: Fix a buffer overflow in the tokenizer when copying lines that fill the...
Pablo Galindo Salgado [Sun, 20 Nov 2022 20:20:03 +0000 (20:20 +0000)] 
gh-99581: Fix a buffer overflow in the tokenizer when copying lines that fill the available buffer (#99605)

2 years agogh-61460: Add a comment describing the multiprocessing.connection protocol (gh-99623)
Gregory P. Smith [Sun, 20 Nov 2022 18:20:04 +0000 (10:20 -0800)] 
gh-61460: Add a comment describing the multiprocessing.connection protocol (gh-99623)

Describe the multiprocessing connection protocol.

It isn't a good protocol, but it is what it is.  This way we can more
easily reason about making changes to it in a backwards compatible way.

2 years agogh-99211: Point to except/except* on syntax errors when mixing them (GH-99215)
Lysandros Nikolaou [Sun, 20 Nov 2022 17:11:02 +0000 (18:11 +0100)] 
gh-99211: Point to except/except* on syntax errors when mixing them (GH-99215)

Automerge-Triggered-By: GH:lysnikolaou
2 years agogh-99201: fix IndexError when initializing sysconfig config variables
Filipe Laíns [Sat, 19 Nov 2022 20:47:09 +0000 (20:47 +0000)] 
gh-99201: fix IndexError when initializing sysconfig config variables

2 years agoDoc: Make functions.html readable again. (GH-99476)
Julien Palard [Sat, 19 Nov 2022 10:25:45 +0000 (11:25 +0100)] 
Doc: Make functions.html readable again. (GH-99476)

2 years ago gh-99284: [ctypes] remove `_use_broken_old_ctypes_structure_semantics_` (GH-99285)
Nikita Sobolev [Sat, 19 Nov 2022 06:25:32 +0000 (09:25 +0300)] 
 gh-99284: [ctypes] remove `_use_broken_old_ctypes_structure_semantics_` (GH-99285)

It was untested and undocumented. No code has been found in the wild that ever used it.

2 years agogh-85073: Add some missing links to source (GH-99363)
Stanley [Fri, 18 Nov 2022 19:33:40 +0000 (11:33 -0800)] 
gh-85073: Add some missing links to source (GH-99363)

Add some missing links to source from Python docs

2 years agoDoc: Replace question mark with fullstop (#99558)
Rafael Fontenelle [Fri, 18 Nov 2022 19:24:23 +0000 (16:24 -0300)] 
Doc: Replace question mark with fullstop (#99558)

The sentence "Set the LC_CTYPE locale to the user preferred locale." should end with a period
instead of a question mark.

2 years agoDoc: Fix broken link to emscripten networking website (#99531)
Alexander Ryabov [Fri, 18 Nov 2022 18:57:04 +0000 (21:57 +0300)] 
Doc: Fix broken link to emscripten networking website (#99531)

There was an extra `>` in the url.

2 years agogh-99553: fix bug where an ExceptionGroup subclass can wrap a BaseException (GH-99572)
Irit Katriel [Fri, 18 Nov 2022 15:44:43 +0000 (15:44 +0000)] 
gh-99553: fix bug where an ExceptionGroup subclass can wrap a BaseException (GH-99572)

2 years agogh-99442: Fix handling in py.exe launcher when argv[0] does not include a file extens...
Steve Dower [Fri, 18 Nov 2022 14:14:56 +0000 (14:14 +0000)] 
gh-99442: Fix handling in py.exe launcher when argv[0] does not include a file extension (GH-99542)

2 years agoGH-98831: Refactor and fix cases generator (#99526)
Guido van Rossum [Fri, 18 Nov 2022 01:06:07 +0000 (17:06 -0800)] 
GH-98831: Refactor and fix cases generator (#99526)

Also complete cache effects for BINARY_SUBSCR family.

2 years agoGH-99298: Clean up attribute specializations (GH-99398)
Brandt Bucher [Thu, 17 Nov 2022 23:09:18 +0000 (15:09 -0800)] 
GH-99298: Clean up attribute specializations (GH-99398)

2 years agoGH-98686: Get rid of BINARY_OP_GENERIC and COMPARE_OP_GENERIC (GH-99399)
Brandt Bucher [Thu, 17 Nov 2022 19:36:57 +0000 (11:36 -0800)] 
GH-98686: Get rid of BINARY_OP_GENERIC and COMPARE_OP_GENERIC (GH-99399)

2 years agoAdd a macro for "inlining" new frames (GH-99490)
Brandt Bucher [Thu, 17 Nov 2022 19:36:03 +0000 (11:36 -0800)] 
Add a macro for "inlining" new frames (GH-99490)

2 years agoMisc copyedits in docs on built-in types (GH-24466)
Adorilson Bezerra [Thu, 17 Nov 2022 16:06:00 +0000 (16:06 +0000)] 
Misc copyedits in docs on built-in types (GH-24466)

# DOC: Improvements in library/stdtypes

This PR does the following:

1. Replaces :meth: by :func: around repr function
2. Adds links to Unicode Standard site
3. Makes explicit "when" you can call the `iskeyword` function. The previous text could cause confusion to readers, especially those with English as a second language. The reader could understand that the `isidentifier` method calls the `iskeyword` function. Now, it is explicit that the dev can do it.
4. Replaces a URL with an inline link.

Automerge-Triggered-By: GH:AlexWaygood
2 years agogh-93649: Split float/long tests from _testcapimodule.c (GH-99549)
Erlend E. Aasland [Thu, 17 Nov 2022 08:56:56 +0000 (09:56 +0100)] 
gh-93649: Split float/long tests from _testcapimodule.c (GH-99549)

Automerge-Triggered-By: GH:erlend-aasland
2 years agogh-99377: Revert audit events for thread state creation and free, because the GIL...
Steve Dower [Thu, 17 Nov 2022 00:24:16 +0000 (00:24 +0000)] 
gh-99377: Revert audit events for thread state creation and free, because the GIL is not properly held at these times (GH-99543)

2 years agogh-99443: `descr_set_trampoline_call` return type should be `int` not `PyObject*...
Hood Chatham [Wed, 16 Nov 2022 23:20:17 +0000 (15:20 -0800)] 
gh-99443: `descr_set_trampoline_call` return type should be `int` not `PyObject*` (#99444)

2 years agoRemove old comment (GH-99489)
Brandt Bucher [Wed, 16 Nov 2022 21:43:31 +0000 (13:43 -0800)] 
Remove old comment (GH-99489)

2 years agogh-99370: Prefer LIBDIR from sysconfig when locating libpython for test (GH-99523)
Steve Dower [Wed, 16 Nov 2022 21:41:13 +0000 (21:41 +0000)] 
gh-99370: Prefer LIBDIR from sysconfig when locating libpython for test (GH-99523)

2 years agogh-93649: Split watcher API tests from _testcapimodule.c (#99532)
Erlend E. Aasland [Wed, 16 Nov 2022 19:13:32 +0000 (20:13 +0100)] 
gh-93649: Split watcher API tests from _testcapimodule.c (#99532)

2 years agogh-81057: Move the global Dict-Related Versions to _PyRuntimeState (gh-99497)
Eric Snow [Wed, 16 Nov 2022 17:37:29 +0000 (10:37 -0700)] 
gh-81057: Move the global Dict-Related Versions to _PyRuntimeState (gh-99497)

We also move the global func version.

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

2 years agogh-99300: Replace Py_INCREF() with Py_NewRef() (#99530)
Victor Stinner [Wed, 16 Nov 2022 17:34:24 +0000 (18:34 +0100)] 
gh-99300: Replace Py_INCREF() with Py_NewRef() (#99530)

Replace Py_INCREF() and Py_XINCREF() using a cast with Py_NewRef()
and Py_XNewRef().

2 years agogh-99377: Add audit events for thread creation and clear (GH-99378)
Steve Dower [Wed, 16 Nov 2022 17:15:52 +0000 (17:15 +0000)] 
gh-99377: Add audit events for thread creation and clear (GH-99378)

2 years agogh-81057: Move contextvars-related Globals to _PyRuntimeState (gh-99400)
Eric Snow [Wed, 16 Nov 2022 16:54:28 +0000 (09:54 -0700)] 
gh-81057: Move contextvars-related Globals to _PyRuntimeState (gh-99400)

This is part of the effort to consolidate global variables, to make them easier to manage (and make it easier to later move some of them to PyInterpreterState).

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

2 years agogh-81057: Move More Globals in Core Code to _PyRuntimeState (gh-99516)
Eric Snow [Wed, 16 Nov 2022 16:37:14 +0000 (09:37 -0700)] 
gh-81057: Move More Globals in Core Code to _PyRuntimeState (gh-99516)

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

2 years agogh-99518: Fix escape symbol in `test_enum` (#99519)
Nikita Sobolev [Wed, 16 Nov 2022 14:06:37 +0000 (17:06 +0300)] 
gh-99518: Fix escape symbol in `test_enum` (#99519)

2 years agogh-93649: Split memory and docstring tests from _testcapimodule.c (#99517)
Erlend E. Aasland [Wed, 16 Nov 2022 13:09:10 +0000 (14:09 +0100)] 
gh-93649: Split memory and docstring tests from _testcapimodule.c (#99517)

2 years agogh-96269: static and shared ext need different deps (#96316)
Christian Heimes [Wed, 16 Nov 2022 13:03:35 +0000 (14:03 +0100)] 
gh-96269: static and shared ext need different deps (#96316)

2 years agogh-99300: Replace Py_INCREF() with Py_NewRef() (#99513)
Victor Stinner [Wed, 16 Nov 2022 09:39:47 +0000 (10:39 +0100)] 
gh-99300: Replace Py_INCREF() with Py_NewRef() (#99513)

Replace Py_INCREF() and Py_XINCREF() using a cast with Py_NewRef()
and Py_XNewRef().

2 years agogh-98940: Fix Mac/Extras.install.py File filter bug (#98943)
zhangbo [Wed, 16 Nov 2022 09:17:18 +0000 (17:17 +0800)] 
gh-98940: Fix Mac/Extras.install.py File filter bug (#98943)

Slightly simplify the script and fix a case issue in the name of ``.DS_Store`` files.

Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
2 years agoGH-98831: Implement basic cache effects (#99313)
Guido van Rossum [Wed, 16 Nov 2022 03:59:19 +0000 (19:59 -0800)] 
GH-98831: Implement basic cache effects (#99313)

2 years agoUpdate Windows readme.txt to clarify Visual Studio required versions (GH-99522)
Ben Kuhn [Wed, 16 Nov 2022 03:31:16 +0000 (19:31 -0800)] 
Update Windows readme.txt to clarify Visual Studio required versions (GH-99522)

This is just a minor update to add a clarification to the requirements in the Windows build readme.

Automerge-Triggered-By: GH:zooba
2 years agogh-99460 Emscripten trampolines on optimized METH_O and METH_NOARGS code paths (...
Hood Chatham [Tue, 15 Nov 2022 17:53:39 +0000 (09:53 -0800)] 
gh-99460 Emscripten trampolines on optimized METH_O and METH_NOARGS code paths (#99461)

2 years agogh-92647: [Enum] use final status to determine lookup or create (GH-99500)
Ethan Furman [Tue, 15 Nov 2022 16:49:22 +0000 (08:49 -0800)] 
gh-92647: [Enum] use final status to determine lookup or create (GH-99500)

* use final status to determine lookup or create

* 📜🤖 Added by blurb_it.

Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
2 years agogh-81057: Move Globals in Core Code to _PyRuntimeState (gh-99496)
Eric Snow [Tue, 15 Nov 2022 16:45:11 +0000 (09:45 -0700)] 
gh-81057: Move Globals in Core Code to _PyRuntimeState (gh-99496)

This is the first of several changes to consolidate non-object globals in core code.

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

2 years agoMerge the 3.12.0a2 release into main.
Thomas Wouters [Tue, 15 Nov 2022 12:38:09 +0000 (13:38 +0100)] 
Merge the 3.12.0a2 release into main.

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 agogh-99300: Use Py_NewRef() in Python/Python-ast.c (#99499)
Victor Stinner [Tue, 15 Nov 2022 09:29:56 +0000 (10:29 +0100)] 
gh-99300: Use Py_NewRef() in Python/Python-ast.c (#99499)

Replace Py_INCREF() and Py_XINCREF() with Py_NewRef() and
Py_XNewRef() in Python/Python-ast.c.

Update Parser/asdl_c.py to regenerate code.

2 years agogh-93649: Split pytime and datetime tests from _testcapimodule.c (#99494)
Erlend E. Aasland [Tue, 15 Nov 2022 07:17:52 +0000 (08:17 +0100)] 
gh-93649: Split pytime and datetime tests from _testcapimodule.c (#99494)

2 years agogh-99370: fix test_zippath_from_non_installed_posix (GH-99483)
Kai Zhang [Tue, 15 Nov 2022 01:01:01 +0000 (09:01 +0800)] 
gh-99370: fix test_zippath_from_non_installed_posix (GH-99483)

When build with shared enabled, we need to set `LD_LIBRARY_PATH`
for the non-installed python environment in
test_zippath_from_non_installed_posix so that the python binary
and find and link the libpython.so.

2 years agoGH-99205: remove `_static` field from `PyThreadState` and `PyInterpreterState` (GH...
Kumar Aditya [Tue, 15 Nov 2022 00:35:37 +0000 (06:05 +0530)] 
GH-99205: remove `_static` field from `PyThreadState` and `PyInterpreterState` (GH-99385)

2 years agogh-81057: Move the Remaining Import State Globals to _PyRuntimeState (gh-99488)
Eric Snow [Mon, 14 Nov 2022 22:56:16 +0000 (15:56 -0700)] 
gh-81057: Move the Remaining Import State Globals to _PyRuntimeState (gh-99488)

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

2 years agogh-87604: Avoid publishing list of active per-interpreter audit hooks via the gc...
Steve Dower [Mon, 14 Nov 2022 21:39:18 +0000 (21:39 +0000)] 
gh-87604: Avoid publishing list of active per-interpreter audit hooks via the gc module (GH-99373)

2 years agogh-93649: Split getargs tests from _testcapimodule.c (#99346)
Erlend E. Aasland [Mon, 14 Nov 2022 21:23:41 +0000 (22:23 +0100)] 
gh-93649: Split getargs tests from _testcapimodule.c (#99346)

2 years agogh-81057: Move Global Variables Holding Objects to _PyRuntimeState. (gh-99487)
Eric Snow [Mon, 14 Nov 2022 20:50:56 +0000 (13:50 -0700)] 
gh-81057: Move Global Variables Holding Objects to _PyRuntimeState. (gh-99487)

This moves nearly all remaining object-holding globals in core code (other than static types).

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

2 years agoGH-98219: reduce sleep time in `asyncio` subprocess test (#99464)
Kumar Aditya [Mon, 14 Nov 2022 19:53:11 +0000 (01:23 +0530)] 
GH-98219: reduce sleep time in `asyncio` subprocess test (#99464)

2 years agoGH-99388: add `loop_factory` parameter to `asyncio.run` (#99462)
Kumar Aditya [Mon, 14 Nov 2022 18:18:51 +0000 (23:48 +0530)] 
GH-99388: add `loop_factory` parameter to `asyncio.run` (#99462)

2 years agogh-99300: Use Py_NewRef() in PC/ directory (#99479)
Victor Stinner [Mon, 14 Nov 2022 17:49:51 +0000 (18:49 +0100)] 
gh-99300: Use Py_NewRef() in PC/ directory (#99479)

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

2 years agogh-99300: Use Py_NewRef() in Doc/ directory (#99480)
Victor Stinner [Mon, 14 Nov 2022 17:49:14 +0000 (18:49 +0100)] 
gh-99300: Use Py_NewRef() in Doc/ directory  (#99480)

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

Replace PyModule_AddObject() with PyModule_AddObjectRef() to simplify
reference counting.

2 years agogh-99300: Use Py_NewRef() in Modules/ directory (#99473)
Victor Stinner [Mon, 14 Nov 2022 15:21:40 +0000 (16:21 +0100)] 
gh-99300: Use Py_NewRef() in Modules/ directory (#99473)

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/ directory (#99469)
Victor Stinner [Mon, 14 Nov 2022 15:21:23 +0000 (16:21 +0100)] 
gh-99300: Use Py_NewRef() in Modules/ directory (#99469)

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

2 years agogh-99370: Calculate zip path from prefix when in a venv (GH-99371)
Kai Zhang [Mon, 14 Nov 2022 15:05:14 +0000 (23:05 +0800)] 
gh-99370: Calculate zip path from prefix when in a venv (GH-99371)

Before python3.11, when in a venv the zip path is calculated
from prefix on POSIX platforms. In python3.11 the behavior is
accidentally changed to calculating from default prefix. This
change will break venv created from a non-installed python
with a stdlib zip file. This commit restores the behavior back
to before python3.11.

2 years agogh-87092: expose the compiler's codegen to python for unit tests (GH-99111)
Irit Katriel [Mon, 14 Nov 2022 13:56:40 +0000 (13:56 +0000)] 
gh-87092: expose the compiler's codegen to python for unit tests (GH-99111)

2 years agogh-78453: Move Unicode C API tests from test_unicode to test_capi.test_unicode (GH...
Serhiy Storchaka [Mon, 14 Nov 2022 13:32:02 +0000 (15:32 +0200)] 
gh-78453: Move Unicode C API tests from test_unicode to test_capi.test_unicode (GH-99431)

2 years agogh-99426: Use PyUnicode_FromFormat() and PyErr_Format() instead of sprintf (GH-99427)
Serhiy Storchaka [Mon, 14 Nov 2022 13:25:34 +0000 (15:25 +0200)] 
gh-99426: Use PyUnicode_FromFormat() and PyErr_Format() instead of sprintf (GH-99427)

2 years agogh-99300: Use Py_NewRef() in Modules/ directory (#99468)
Victor Stinner [Mon, 14 Nov 2022 12:44:56 +0000 (13:44 +0100)] 
gh-99300: Use Py_NewRef() in Modules/ directory (#99468)

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

2 years agogh-99289: Add COMPILEALL_OPTS to Makefile (#99291)
Victor Stinner [Mon, 14 Nov 2022 12:43:45 +0000 (13:43 +0100)] 
gh-99289: Add COMPILEALL_OPTS to Makefile (#99291)

Add COMPILEALL_OPTS variable in Makefile to override compileall
options (default: -j0) in "make install". Also merge the compileall
commands into a single command building PYC files for the all
optimization levels (0, 1, 2) at once.

Co-authored-by: Gregory P. Smith <greg@krypto.org>
2 years agogh-99300: Use Py_NewRef() in Modules/_datetimemodule.c (#99465)
Victor Stinner [Mon, 14 Nov 2022 12:09:12 +0000 (13:09 +0100)] 
gh-99300: Use Py_NewRef() in Modules/_datetimemodule.c (#99465)

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

2 years agogh-99300: Use Py_NewRef() in Modules/ directory (#99467)
Victor Stinner [Mon, 14 Nov 2022 12:08:43 +0000 (13:08 +0100)] 
gh-99300: Use Py_NewRef() in Modules/ directory (#99467)

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/ directory (#99466)
Victor Stinner [Mon, 14 Nov 2022 12:08:15 +0000 (13:08 +0100)] 
gh-99300: Use Py_NewRef() in Modules/ directory (#99466)

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

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)