]> git.ipfire.org Git - thirdparty/Python/cpython.git/log
thirdparty/Python/cpython.git
2 years agogh-112075: use per-thread dict version pool (#118676)
Dino Viehland [Tue, 7 May 2024 00:22:26 +0000 (17:22 -0700)] 
gh-112075: use per-thread dict version pool (#118676)

use thread state set of dict versions

2 years agogh-118527: Intern code consts in free-threaded build (#118667)
Sam Gross [Tue, 7 May 2024 00:12:39 +0000 (20:12 -0400)] 
gh-118527: Intern code consts in free-threaded build (#118667)

We already intern and immortalize most string constants. In the
free-threaded build, other constants can be a source of reference count
contention because they are shared by all threads running the same code
objects.

2 years agogh-118473: Fix set_asyncgen_hooks not to be partially set when arguments are invalid...
Jeong, YunWon [Tue, 7 May 2024 00:02:52 +0000 (09:02 +0900)] 
gh-118473: Fix set_asyncgen_hooks not to be partially set when arguments are invalid (#118474)

2 years agogh-118362: Skip tests when threading isn't available (#118666)
Dino Viehland [Mon, 6 May 2024 23:45:04 +0000 (16:45 -0700)] 
gh-118362: Skip tests when threading isn't available (#118666)

* Skip tests when threads aren't available

* Use ThreadPoolExecutor

2 years agogh-112075: Fix race in constructing dict for instance (#118499)
Dino Viehland [Mon, 6 May 2024 23:31:09 +0000 (16:31 -0700)] 
gh-112075: Fix race in constructing dict for instance (#118499)

2 years agoGH-118251: Bump the JIT CI timeout to 90 minutes (#118661)
Brandt Bucher [Mon, 6 May 2024 23:21:39 +0000 (16:21 -0700)] 
GH-118251: Bump the JIT CI timeout to 90 minutes (#118661)

2 years agogh-117486: Improve behavior for user-defined AST subclasses (#118212)
Jelle Zijlstra [Mon, 6 May 2024 22:57:27 +0000 (15:57 -0700)] 
gh-117486: Improve behavior for user-defined AST subclasses (#118212)

Now, such classes will no longer require changes in Python 3.13 in the normal case.
The test suite for robotframework passes with no DeprecationWarnings under this PR.

I also added a new DeprecationWarning for the case where `_field_types` exists
but is incomplete, since that seems likely to indicate a user mistake.

2 years agofix typo in `_pyrepl.pager`: `plainpager` -> `plain_pager` (#118675)
denballakh [Mon, 6 May 2024 22:56:28 +0000 (01:56 +0300)] 
fix typo in `_pyrepl.pager`: `plainpager` -> `plain_pager` (#118675)

2 years agoUse Intel with 12 cores for free-threading tests for maximum speedup (#118677)
Łukasz Langa [Mon, 6 May 2024 22:49:45 +0000 (00:49 +0200)] 
Use Intel with 12 cores for free-threading tests for maximum speedup (#118677)

2 years agogh-118647: Add defaults to typing.Generator and typing.AsyncGenerator (#118648)
Jelle Zijlstra [Mon, 6 May 2024 22:35:06 +0000 (15:35 -0700)] 
gh-118647: Add defaults to typing.Generator and typing.AsyncGenerator (#118648)

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
2 years agoTest premium Mac builders (#118672)
Łukasz Langa [Mon, 6 May 2024 22:08:17 +0000 (00:08 +0200)] 
Test premium Mac builders (#118672)

2 years agogh-118527: Intern code name and filename on default build (#118576)
Sam Gross [Mon, 6 May 2024 21:24:14 +0000 (17:24 -0400)] 
gh-118527: Intern code name and filename on default build (#118576)

Interned and non-interned strings are treated differently by `marshal`,
so be consistent between the default and free-threaded build.

2 years agoGH-115709: Invalidate executors when a local variable is changed via frame.f_locals...
Mark Shannon [Mon, 6 May 2024 21:21:06 +0000 (22:21 +0100)] 
GH-115709: Invalidate executors when a local variable is changed via frame.f_locals (#118639)

Also fix unrelated assert in debug Tier2/JIT builds.

2 years agogh-118415: Fix issues with local tracing being enabled/disabled on a function (#118496)
Dino Viehland [Mon, 6 May 2024 20:06:09 +0000 (13:06 -0700)] 
gh-118415: Fix issues with local tracing being enabled/disabled on a function (#118496)

2 years agogh-118628: Don't display pyrepl warning on Windows (#118665)
Łukasz Langa [Mon, 6 May 2024 19:35:22 +0000 (21:35 +0200)] 
gh-118628: Don't display pyrepl warning on Windows (#118665)

2 years agogh-71592: Fix a leak in tkinter.Tk destructor when _debug is true (GH-118664)
Serhiy Storchaka [Mon, 6 May 2024 19:25:20 +0000 (22:25 +0300)] 
gh-71592: Fix a leak in tkinter.Tk destructor when _debug is true (GH-118664)

2 years agogh-115119: Default to --with-system-libmpdec=yes (#118539)
Erlend E. Aasland [Mon, 6 May 2024 19:16:08 +0000 (21:16 +0200)] 
gh-115119: Default to --with-system-libmpdec=yes (#118539)

Co-authored-by: Zachary Ware <zachary.ware@gmail.com>
2 years agoGH-83151: Add closure support to pdb (GH-111094)
Tian Gao [Mon, 6 May 2024 18:34:13 +0000 (11:34 -0700)] 
GH-83151: Add closure support to pdb (GH-111094)

2 years agogh-118362: Fix thread safety around lookups from the type cache in the face of concur...
Dino Viehland [Mon, 6 May 2024 17:50:35 +0000 (10:50 -0700)] 
gh-118362: Fix thread safety around lookups from the type cache in the face of concurrent mutators (#118454)

Add _PyType_LookupRef and use incref before setting attribute on type
Makes setting an attribute on a class and signaling type modified atomic
Avoid adding re-entrancy exposing the type cache in an inconsistent state by decrefing after type is updated

2 years agogh-118518: Ensure that the code padding it's applied (#118654)
Pablo Galindo Salgado [Mon, 6 May 2024 17:20:42 +0000 (18:20 +0100)] 
gh-118518: Ensure that the code padding it's applied (#118654)

2 years agoGH-117714: implement athrow().close() and asend().close() using throw (GH-117906)
Thomas Grainger [Mon, 6 May 2024 17:13:15 +0000 (18:13 +0100)] 
GH-117714: implement athrow().close() and asend().close() using throw (GH-117906)

* GH-117714: replace athrow().close() and asend().close() stubs with implimentations

* test athrow().close() and asend().close() raises RuntimeError

* 📜🤖 Added by blurb_it.

* Update Objects/genobject.c

Co-authored-by: Petr Viktorin <encukou@gmail.com>
---------

Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Co-authored-by: Petr Viktorin <encukou@gmail.com>
2 years agogh-71592: Add ability to trace Tcl commands executed by Tkinter (GH-118291)
Serhiy Storchaka [Mon, 6 May 2024 17:12:51 +0000 (20:12 +0300)] 
gh-71592: Add ability to trace Tcl commands executed by Tkinter (GH-118291)

This is an experimental feature, for internal use.

Setting tkinter._debug = True before creating the root window enables
printing every executed Tcl command (or a Tcl command equivalent to the
used Tcl C API).

This will help to convert a Tkinter example into Tcl script to check
whether the issue is caused by Tkinter or exists in the underlying Tcl/Tk
library.

2 years agogh-116322: Rename PyModule_ExperimentalSetGIL to PyUnstable_Module_SetGIL (GH-118645)
Petr Viktorin [Mon, 6 May 2024 16:59:36 +0000 (18:59 +0200)] 
gh-116322: Rename PyModule_ExperimentalSetGIL to PyUnstable_Module_SetGIL (GH-118645)

2 years agoGH-115577 Clarify netloc term usage in urllib.parse docs (GH-117632)
Kerim Kabirov [Mon, 6 May 2024 16:55:22 +0000 (18:55 +0200)] 
GH-115577 Clarify netloc term usage in urllib.parse docs (GH-117632)

2 years agogh-118609: Add proper error check for framelocalsproxy (#118615)
Tian Gao [Mon, 6 May 2024 15:46:15 +0000 (08:46 -0700)] 
gh-118609: Add proper error check for framelocalsproxy (#118615)

2 years agogh-118271: Support more options for reading/writing images in Tkinter (GH-118273)
Serhiy Storchaka [Mon, 6 May 2024 15:06:06 +0000 (18:06 +0300)] 
gh-118271: Support more options for reading/writing images in Tkinter (GH-118273)

* Add PhotoImage.read() to read an image from a file.
* Add PhotoImage.data() to get the image data.
* Add background and grayscale parameters to PhotoImage.write().

2 years agoFix typo in Doc/library/asyncio-task.rst (GH-118627)
Xie Yanbo [Mon, 6 May 2024 15:00:31 +0000 (23:00 +0800)] 
Fix typo in Doc/library/asyncio-task.rst (GH-118627)

2 years agogh-118225: Support more options for copying images in Tkinter (GH-118228)
Serhiy Storchaka [Mon, 6 May 2024 14:33:15 +0000 (17:33 +0300)] 
gh-118225: Support more options for copying images in Tkinter (GH-118228)

* Add the PhotoImage method copy_replace() to copy a region
  from one image to other image, possibly with pixel zooming and/or
  subsampling.
* Add from_coords parameter to PhotoImage methods copy(), zoom() and subsample().
* Add zoom and subsample parameters to PhotoImage method copy().

2 years agogh-118518: Correct type of perf_profiling in config (#118646)
Pablo Galindo Salgado [Mon, 6 May 2024 14:30:30 +0000 (15:30 +0100)] 
gh-118518: Correct type of perf_profiling in config (#118646)

2 years agoFix typo in Lib/zipfile/_path/__init__.py (#118622)
Xie Yanbo [Mon, 6 May 2024 13:58:27 +0000 (21:58 +0800)] 
Fix typo in Lib/zipfile/_path/__init__.py (#118622)

2 years agogh-116871: Improve name suggestions in tracebacks (GH-116930)
Serhiy Storchaka [Mon, 6 May 2024 12:53:15 +0000 (15:53 +0300)] 
gh-116871: Improve name suggestions in tracebacks (GH-116930)

Only include underscored names in name suggestions for AttributeError and
ImportError if the original name was underscored.

2 years agogh-66543: Add mimetypes.guess_file_type() (GH-117258)
Serhiy Storchaka [Mon, 6 May 2024 12:50:52 +0000 (15:50 +0300)] 
gh-66543: Add mimetypes.guess_file_type() (GH-117258)

2 years agogh-111201: Use a more common constant in completion tests in test_pyrepl (#118638)
Pablo Galindo Salgado [Mon, 6 May 2024 10:56:47 +0000 (11:56 +0100)] 
gh-111201: Use a more common constant in completion tests in test_pyrepl (#118638)

2 years agogh-74929: Make containment checks more efficient in `FrameLocalsProxy` (#118624)
Tian Gao [Mon, 6 May 2024 10:16:48 +0000 (03:16 -0700)] 
gh-74929: Make containment checks more efficient in `FrameLocalsProxy` (#118624)

Properly implement the `sq_contains` slot for frame locals proxy containment checks.

2 years agogh-74929: locals() documentation update for PEP 667 (#118265)
Alyssa Coghlan [Mon, 6 May 2024 10:06:07 +0000 (20:06 +1000)] 
gh-74929: locals() documentation update for PEP 667 (#118265)

Documentation wording taken from the
withdrawn PEP 558 (which had switched to the
Python level semantics proposed in PEP 667 prior
to its withdrawal).

2 years agogh-111201: Fix event queue tests for pyrepl (#118635)
Lysandros Nikolaou [Mon, 6 May 2024 09:50:42 +0000 (11:50 +0200)] 
gh-111201: Fix event queue tests for pyrepl (#118635)

2 years agogh-118465: Add __firstlineno__ attribute to class (GH-118475)
Serhiy Storchaka [Mon, 6 May 2024 09:02:37 +0000 (12:02 +0300)] 
gh-118465: Add __firstlineno__ attribute to class (GH-118475)

It is set by compiler with the line number of the first line of
the class definition.

2 years agogh-115119: Bump CI to use Ubuntu 22.04 (#118631)
Erlend E. Aasland [Mon, 6 May 2024 08:39:43 +0000 (10:39 +0200)] 
gh-115119: Bump CI to use Ubuntu 22.04 (#118631)

Ubuntu 22.04 ships with mpdecimal 2.5.1, installable using 'apt install libmpdec-dev'.

2 years agogh-95382: Improve performance of json encoder with indent (GH-118105)
Pieter Eendebak [Mon, 6 May 2024 08:04:39 +0000 (10:04 +0200)] 
gh-95382: Improve performance of json encoder with indent (GH-118105)

2 years agogh-78955: Use user-selected color theme for Help => IDLE Doc (#9502)
Terry Jan Reedy [Mon, 6 May 2024 07:55:56 +0000 (03:55 -0400)] 
gh-78955: Use user-selected color theme for Help => IDLE Doc (#9502)

2 years agogh-118613: Fix error handling of `_PyEval_GetFrameLocals` in `ceval.c` (#118614)
Nikita Sobolev [Mon, 6 May 2024 07:34:56 +0000 (10:34 +0300)] 
gh-118613: Fix error handling of `_PyEval_GetFrameLocals` in `ceval.c` (#118614)

2 years agoSet a DerivedData path for iOS test builds. (GH-118621)
Russell Keith-Magee [Mon, 6 May 2024 03:58:14 +0000 (11:58 +0800)] 
Set a DerivedData path for iOS test builds. (GH-118621)

2 years agoCorrect timing sensitivity in iOS testing Makefile target. (GH-118620)
Russell Keith-Magee [Mon, 6 May 2024 02:34:59 +0000 (10:34 +0800)] 
Correct timing sensitivity in iOS testing Makefile target. (GH-118620)

2 years agoAdd Lysandros Nikolaou to the News entry of gh-111201 (#118616)
Pablo Galindo Salgado [Sun, 5 May 2024 22:13:50 +0000 (23:13 +0100)] 
Add Lysandros Nikolaou to the News entry of gh-111201 (#118616)

2 years agogh-111140: minor docs typos cleanup in the C example API calls. (#118612)
Gregory P. Smith [Sun, 5 May 2024 21:43:42 +0000 (14:43 -0700)] 
gh-111140: minor docs typos cleanup in the C example API calls. (#118612)

2 years agogh-118605: Fix reference leak in FrameLocalsProxy (#118607)
Tian Gao [Sun, 5 May 2024 21:31:35 +0000 (14:31 -0700)] 
gh-118605: Fix reference leak in FrameLocalsProxy (#118607)

Also add some error checks.

2 years agoMove pathlib implementation out of `__init__.py` (#118582)
Barney Gale [Sun, 5 May 2024 19:57:19 +0000 (20:57 +0100)] 
Move pathlib implementation out of `__init__.py` (#118582)

Use the `__init__.py` file only for imports that define the API, following the example of asyncio.

2 years agogh-111201: A new Python REPL (GH-111567)
Pablo Galindo Salgado [Sun, 5 May 2024 19:32:23 +0000 (21:32 +0200)] 
gh-111201: A new Python REPL (GH-111567)

Co-authored-by: Łukasz Langa <lukasz@langa.pl>
Co-authored-by: Marta Gómez Macías <mgmacias@google.com>
Co-authored-by: Lysandros Nikolaou <lisandrosnik@gmail.com>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2 years agogh-117549: Don't use designated initializers in headers (#118580)
Guido van Rossum [Sun, 5 May 2024 19:28:55 +0000 (12:28 -0700)] 
gh-117549: Don't use designated initializers in headers (#118580)

The designated initializer syntax in static inline functions in pycore_backoff.h
causes problems for C++ or MSVC users who aren't yet using C++20.
While internal, pycore_backoff.h is included (indirectly, via pycore_code.h)
by some key 3rd party software that does so for speed.

2 years agogh-117389: Fix `test_compileall.EncodingTest` (#117390)
Nikita Sobolev [Sun, 5 May 2024 18:46:37 +0000 (21:46 +0300)] 
gh-117389: Fix `test_compileall.EncodingTest` (#117390)

2 years agoFix negative bandwidth test and add online code path test. (gh-118600)
Raymond Hettinger [Sun, 5 May 2024 17:29:23 +0000 (12:29 -0500)] 
Fix negative bandwidth test and add online code path test. (gh-118600)

2 years agogh-74929: Rudimentary docs for PEP 667 (#118581)
Guido van Rossum [Sun, 5 May 2024 15:31:26 +0000 (08:31 -0700)] 
gh-74929: Rudimentary docs for PEP 667 (#118581)

This is *not* sufficient for the final 3.13 release, but it will do for beta 1:

- What's new entry
- Updated changelog entry (news blurb)
- Mention the proxy for f_globals in the datamodel and Python frame object docs

This doesn't have any C API details (what's new refers to the PEP).

2 years agoGH-111744: Make breakpoint() enter the debugger immediately (GH-118579)
Tian Gao [Sun, 5 May 2024 14:05:01 +0000 (07:05 -0700)] 
GH-111744: Make breakpoint() enter the debugger immediately (GH-118579)

2 years agogh-101137: Add `text/x-rst` to `mimetypes` (#118593)
Nikita Sobolev [Sun, 5 May 2024 13:39:50 +0000 (16:39 +0300)] 
gh-101137: Add `text/x-rst` to `mimetypes` (#118593)

2 years agogh-83505: Add markdown mimetype mapping (#17995)
Ryan Batchelder [Sun, 5 May 2024 13:09:59 +0000 (09:09 -0400)] 
gh-83505: Add markdown mimetype mapping (#17995)

2 years agogh-118518: Use the raw syscall directly for gettid (#118592)
Pablo Galindo Salgado [Sun, 5 May 2024 12:37:32 +0000 (14:37 +0200)] 
gh-118518: Use the raw syscall directly for gettid (#118592)

2 years agogh-110850: Remove _PyTime_TimeUnchecked() function (#118552)
Victor Stinner [Sun, 5 May 2024 10:15:19 +0000 (12:15 +0200)] 
gh-110850: Remove _PyTime_TimeUnchecked() function (#118552)

Use the new public Raw functions:

* _PyTime_PerfCounterUnchecked() with PyTime_PerfCounterRaw()
* _PyTime_TimeUnchecked() with PyTime_TimeRaw()
* _PyTime_MonotonicUnchecked() with PyTime_MonotonicRaw()

Remove internal functions:

* _PyTime_PerfCounterUnchecked()
* _PyTime_TimeUnchecked()
* _PyTime_MonotonicUnchecked()

2 years agogh-118476: Fix corner cases in islice() rough equivalent. (Gh-118559)
Raymond Hettinger [Sun, 5 May 2024 06:42:30 +0000 (01:42 -0500)] 
gh-118476: Fix corner cases in islice() rough equivalent. (Gh-118559)

2 years agoMinor edit: Simplify and tighten the distribution test (gh-118585)
Raymond Hettinger [Sun, 5 May 2024 06:35:06 +0000 (01:35 -0500)] 
Minor edit: Simplify and tighten the distribution test (gh-118585)

Simplify and tighten the distribution test

2 years agogh-118131: Command-line interface for the `random` module (#118132)
Hugo van Kemenade [Sun, 5 May 2024 06:30:03 +0000 (08:30 +0200)] 
gh-118131: Command-line interface for the `random` module (#118132)

2 years agogh-118455: Fix mangle_from_ default value in email.policy.Policy.__doc__ (#118456)
wim glenn [Sun, 5 May 2024 06:18:04 +0000 (01:18 -0500)] 
gh-118455: Fix mangle_from_ default value in email.policy.Policy.__doc__ (#118456)

* Fix mangle_from_ default value in email.policy.Policy.__doc__

The docstring says it defaults to True, but it actually defaults
to False. Only the Compat32 subclass overrides that.

---------

Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
2 years agogh-118164: Break a loop between _pydecimal and _pylong and optimize int to str conver...
Serhiy Storchaka [Sun, 5 May 2024 05:20:06 +0000 (08:20 +0300)] 
gh-118164: Break a loop between _pydecimal and _pylong and optimize int to str conversion (GH-118483)

For converting large ints to strings, CPython invokes a function in _pylong.py,
which uses the decimal module to implement an asymptotically waaaaay
sub-quadratic algorithm. But if the C decimal module isn't available, CPython
uses _pydecimal.py instead. Which in turn frequently does str(int). If the int
is very large, _pylong ends up doing the work, which in turn asks decimal to do
"big" arithmetic, which in turn calls str(big_int), which in turn ... it can
become infinite mutual recursion.

This change introduces a different int->str function that doesn't use decimal.
It's asymptotically worse, "Karatsuba time" instead of quadratic time, so
still a huge improvement. _pylong switches to that when the C decimal isn't
available. It is also used for not too large integers (less than 450_000 bits),
where it is faster (up to 2 times for 30_000 bits) than the asymptotically
better implementation that uses the C decimal.

Co-authored-by: Tim Peters <tim.peters@gmail.com>
2 years agogh-74929: Remove undesirable DECREF in PEP 667 implementation (#118583)
Tian Gao [Sun, 5 May 2024 03:06:42 +0000 (20:06 -0700)] 
gh-74929: Remove undesirable DECREF in PEP 667 implementation (#118583)

With tests.

2 years agogh-118518: Allow perf to work without frame pointers (#112254)
Pablo Galindo Salgado [Sun, 5 May 2024 01:07:29 +0000 (03:07 +0200)] 
gh-118518: Allow perf to work without frame pointers (#112254)

2 years agogh-118164: str(10**10000) hangs if the C _decimal module is missing (#118503)
Tim Peters [Sat, 4 May 2024 23:22:33 +0000 (18:22 -0500)] 
gh-118164: str(10**10000) hangs if the C _decimal module is missing (#118503)

* Initial stab.

* Test the tentative fix. Hangs "forever" without this change.

* Move the new test to a better spot.

* New comment to explain why _convert_to_str allows any poewr of 10.

* Fixed a comment, and fleshed out an existing test that appeared unfinished.

* Added temporary asserts. Or maybe permanent ;-)

* Update Lib/_pydecimal.py

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
* Remove the new _convert_to_str().

Serhiy and I independently concluded that exact powers of 10
aren't possible in these contexts, so just checking the
string length is sufficient.

* At least for now, add the asserts to the other block too.

* 📜🤖 Added by blurb_it.

---------

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
2 years agogh-109617: fix ncurses incompatibility on macOS with Xcode 15 (#111258)
Davide Rizzo [Sat, 4 May 2024 21:41:47 +0000 (23:41 +0200)] 
gh-109617: fix ncurses incompatibility on macOS with Xcode 15 (#111258)

Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2 years agogh-117953: Track Extra Details in Global Extensions Cache (gh-118532)
Eric Snow [Sat, 4 May 2024 21:24:02 +0000 (15:24 -0600)] 
gh-117953: Track Extra Details in Global Extensions Cache (gh-118532)

We have only been tracking each module's PyModuleDef.  However, there are some problems with that.  For example, in some cases we load single-phase init extension modules from def->m_base.m_init or def->m_base.m_copy, but if multiple modules share a def then we can end up with unexpected behavior.

With this change, we track the following:

* PyModuleDef (same as before)
* for some modules, its init function or a copy of its __dict__, but specific to that module
* whether it is a builtin/core module or a "dynamic" extension
* the interpreter (ID) that owns the cached __dict__ (only if cached)

This also makes it easier to remember the module's kind (e.g. single-phase init) and if loading it previously failed, which I'm doing separately.

2 years agogh-117139: Fix missing semicolon (GH-118573)
Ken Jin [Sat, 4 May 2024 15:45:49 +0000 (23:45 +0800)] 
gh-117139: Fix missing semicolon (GH-118573)

2 years agogh-118569: Add a test for dynamic PEP695 classes (#118570)
Nikita Sobolev [Sat, 4 May 2024 15:08:38 +0000 (18:08 +0300)] 
gh-118569: Add a test for dynamic PEP695 classes (#118570)

2 years agoGH-111744: Support opcode events in bdb (GH-111834)
Tian Gao [Sat, 4 May 2024 14:44:49 +0000 (07:44 -0700)] 
GH-111744: Support opcode events in bdb (GH-111834)

2 years agobuild(deps): bump hypothesis from 6.100.0 to 6.100.2 in /Tools (#118462)
dependabot[bot] [Sat, 4 May 2024 13:47:48 +0000 (14:47 +0100)] 
build(deps): bump hypothesis from 6.100.0 to 6.100.2 in /Tools (#118462)

Bumps [hypothesis](https://github.com/HypothesisWorks/hypothesis) from 6.100.0 to 6.100.2.
- [Release notes](https://github.com/HypothesisWorks/hypothesis/releases)
- [Commits](https://github.com/HypothesisWorks/hypothesis/compare/hypothesis-python-6.100.0...hypothesis-python-6.100.2)

2 years agofix comment typo in importlib (#118567)
wim glenn [Sat, 4 May 2024 13:46:32 +0000 (08:46 -0500)] 
fix comment typo in importlib (#118567)

2 years agogh-74929: Implement PEP 667 (GH-115153)
Tian Gao [Sat, 4 May 2024 11:12:10 +0000 (04:12 -0700)] 
gh-74929: Implement PEP 667 (GH-115153)

2 years agoGH-118095: Use broader specializations of CALL in tier 1, for better tier 2 support...
Mark Shannon [Sat, 4 May 2024 11:11:11 +0000 (12:11 +0100)] 
GH-118095: Use broader specializations of CALL in tier 1, for better tier 2 support of calls. (GH-118322)

* Add CALL_PY_GENERAL, CALL_BOUND_METHOD_GENERAL and call CALL_NON_PY_GENERAL specializations.

* Remove CALL_PY_WITH_DEFAULTS specialization

* Use CALL_NON_PY_GENERAL in more cases when otherwise failing to specialize

2 years agogh-113081: Print colorized exception just like built-in traceback in pdb (#113082)
Tian Gao [Sat, 4 May 2024 10:26:40 +0000 (03:26 -0700)] 
gh-113081: Print colorized exception just like built-in traceback in pdb (#113082)

2 years agogh-111997: C-API for signalling monitoring events (#116413)
Irit Katriel [Sat, 4 May 2024 08:23:50 +0000 (09:23 +0100)] 
gh-111997: C-API for signalling monitoring events (#116413)

2 years agoGH-113464: Remove the extra jump via `_SIDE_EXIT` in `_EXIT_TRACE` (GH-118545)
Mark Shannon [Sat, 4 May 2024 07:50:24 +0000 (08:50 +0100)] 
GH-113464: Remove the extra jump via `_SIDE_EXIT` in `_EXIT_TRACE` (GH-118545)

2 years agogh-110850: Use _PyDeadline_Get() in EnterNonRecursiveMutex() (#118556)
Victor Stinner [Sat, 4 May 2024 07:39:58 +0000 (09:39 +0200)] 
gh-110850: Use _PyDeadline_Get() in EnterNonRecursiveMutex() (#118556)

Use _PyDeadline_Init() and _PyDeadline_Get() in
EnterNonRecursiveMutex() of thread_nt.h.

_PyDeadline_Get() uses the monotonic clock which is now the same as
the perf counter clock on all platforms. So this change does not
cause any behavior change. It just reuses existing helper functions.

2 years agogh-115532 Add kde_random() to the statistic module (#118210)
Raymond Hettinger [Sat, 4 May 2024 04:13:36 +0000 (23:13 -0500)] 
gh-115532 Add kde_random() to the statistic module (#118210)

2 years agoGH-113464: Generate a more efficient JIT (GH-118512)
Brandt Bucher [Fri, 3 May 2024 23:41:07 +0000 (16:41 -0700)] 
GH-113464: Generate a more efficient JIT (GH-118512)

2 years agoGH-118251: Fix incomplete ternary expression in JIT workflow (GH-118564)
Brandt Bucher [Fri, 3 May 2024 23:10:02 +0000 (16:10 -0700)] 
GH-118251: Fix incomplete ternary expression in JIT workflow (GH-118564)

2 years agogh-118527: Intern filename, name, and qualname in code objects. (#118558)
Sam Gross [Fri, 3 May 2024 22:16:45 +0000 (18:16 -0400)] 
gh-118527: Intern filename, name, and qualname in code objects. (#118558)

This interns the strings for `co_filename`, `co_name`, and `co_qualname`
on codeobjects in the free-threaded build. This partially addresses a
reference counting bottleneck when creating closures concurrently. The
closures take the name and qualified name from the code object.

2 years agogh-118534: Fix load of `gil->locked` (#118553)
Sam Gross [Fri, 3 May 2024 22:13:40 +0000 (18:13 -0400)] 
gh-118534: Fix load of `gil->locked` (#118553)

2 years agoMinor improvements to the itertools recipes (#118563)
Raymond Hettinger [Fri, 3 May 2024 22:07:47 +0000 (17:07 -0500)] 
Minor improvements to the itertools recipes (#118563)

2 years agoGH-116380: Move pathlib globbing implementation into `pathlib._glob` (#118562)
Barney Gale [Fri, 3 May 2024 20:29:25 +0000 (21:29 +0100)] 
GH-116380: Move pathlib globbing implementation into `pathlib._glob` (#118562)

Moving this code under the `pathlib` package makes it quite a lot easier
to backport in the `pathlib-abc` PyPI package. It was a bit foolish of me
to add it to `glob` in the first place.

Also add `translate()` to `__all__` in `glob`. This function is new in
3.13, so there's no NEWS needed.

2 years agogh-117657: Disable the function/code cache in free-threaded builds (#118301)
mpage [Fri, 3 May 2024 20:21:04 +0000 (13:21 -0700)] 
gh-117657: Disable the function/code cache in free-threaded builds (#118301)

This is only used by the specializing interpreter and the tier 2
optimizer, both of which are disabled in free-threaded builds.

2 years agoGH-118251: Skip fewer test in emulated JIT CI (GH-118536)
Savannah Ostrowski [Fri, 3 May 2024 19:07:10 +0000 (12:07 -0700)] 
GH-118251: Skip fewer test in emulated JIT CI (GH-118536)

2 years agogh-107674: Improve performance of `sys.settrace` (GH-117133)
Tian Gao [Fri, 3 May 2024 18:49:24 +0000 (11:49 -0700)] 
gh-107674: Improve performance of `sys.settrace` (GH-117133)

* Check tracing in RESUME_CHECK

* Only change to RESUME_CHECK if not tracing

2 years agogh-83856: Honor atexit for all multiprocessing start methods (GH-114279)
Tian Gao [Fri, 3 May 2024 18:45:46 +0000 (11:45 -0700)] 
gh-83856: Honor atexit for all multiprocessing start methods (GH-114279)

Use atexit for all multiprocessing start methods to cleanup.
See the GH-114279 PR discussion and related issue for details as to why.

2 years agoGH-118487: Add Black to `.pre-commit-config.yaml` for JIT files (GH-118537)
Savannah Ostrowski [Fri, 3 May 2024 17:49:51 +0000 (10:49 -0700)] 
GH-118487: Add Black to `.pre-commit-config.yaml` for JIT files (GH-118537)

2 years agogh-115119: Update macOS installer to build with libmpdec 4.0.0 (GH-118382)
Erlend E. Aasland [Fri, 3 May 2024 16:49:40 +0000 (18:49 +0200)] 
gh-115119: Update macOS installer to build with libmpdec 4.0.0 (GH-118382)

Co-authored-by: Ned Deily <nad@python.org>
2 years agogh-115119: Update Windows installer to mpdecimal 4.0.0 (#118506)
Erlend E. Aasland [Fri, 3 May 2024 16:00:43 +0000 (18:00 +0200)] 
gh-115119: Update Windows installer to mpdecimal 4.0.0 (#118506)

2 years agodocs: clarify csv.DictReader's treatment of the first data row (#118549)
Ned Batchelder [Fri, 3 May 2024 15:48:27 +0000 (11:48 -0400)] 
docs: clarify csv.DictReader's treatment of the first data row (#118549)

2 years agogh-118527: Use deferred reference counting for C functions on modules (#118529)
Sam Gross [Fri, 3 May 2024 15:33:05 +0000 (11:33 -0400)] 
gh-118527: Use deferred reference counting for C functions on modules (#118529)

This addresses a scaling bottleneck in the free-threaded build when
calling functions like `math.floor()` concurrently from multiple
threads.

2 years agogh-116322: Add Py_mod_gil module slot (#116882)
Brett Simmers [Fri, 3 May 2024 15:30:55 +0000 (08:30 -0700)] 
gh-116322: Add Py_mod_gil module slot (#116882)

This PR adds the ability to enable the GIL if it was disabled at
interpreter startup, and modifies the multi-phase module initialization
path to enable the GIL when loading a module, unless that module's spec
includes a slot indicating it can run safely without the GIL.

PEP 703 called the constant for the slot `Py_mod_gil_not_used`; I went
with `Py_MOD_GIL_NOT_USED` for consistency with gh-104148.

A warning will be issued up to once per interpreter for the first
GIL-using module that is loaded. If `-v` is given, a shorter message
will be printed to stderr every time a GIL-using module is loaded
(including the first one that issues a warning).

2 years agogh-118495: Skip test using threads after forking when running with TSAN (#118530)
mpage [Fri, 3 May 2024 15:14:26 +0000 (08:14 -0700)] 
gh-118495: Skip test using threads after forking when running with TSAN (#118530)

This is unsupported. Note that `skip_unless_reliable_fork()` checks for
the conditions used by the decorators that were removed, along with checking
for TSAN.

2 years agogh-117514: Add `sys._is_gil_enabled()` function (#118514)
Sam Gross [Fri, 3 May 2024 15:09:57 +0000 (11:09 -0400)] 
gh-117514: Add `sys._is_gil_enabled()` function (#118514)

The function returns `True` or `False` depending on whether the GIL is
currently enabled. In the default build, it always returns `True`
because the GIL is always enabled.

2 years agogh-118527: Use `_Py_ID(__main__)` for main module name (#118528)
Sam Gross [Fri, 3 May 2024 15:05:30 +0000 (11:05 -0400)] 
gh-118527: Use `_Py_ID(__main__)` for main module name (#118528)

Most module names are interned and immortalized, but the main
module was not. This partially addresses a scaling bottleneck in the
free-threaded when creating closure concurrently in the main module.

2 years agogh-118513: Fix sibling comprehensions with a name bound in one and global in the...
Carl Meyer [Fri, 3 May 2024 14:05:19 +0000 (08:05 -0600)] 
gh-118513: Fix sibling comprehensions with a name bound in one and global in the other (#118526)

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
Co-authored-by: Kirill Podoprigora <kirill.bast9@mail.ru>
2 years agogh-101732: Modules/_ssl.c: use Y2038 compatible openssl function when available ...
Alexander Kanavin [Fri, 3 May 2024 13:34:05 +0000 (15:34 +0200)] 
gh-101732: Modules/_ssl.c: use Y2038 compatible openssl function when available (GH-118425)