Commit Graph

29390 Commits

Author SHA1 Message Date
T. Wouters 6be55f1bed
[3.13] gh-119724: Revert "bpo-45759: Better error messages for non-matching 'elif'/'else' statements (GH-29513)" (GH-119974) (GH-120013)
This reverts commit 1c8f912ebd.
(cherry picked from commit 31a4fb3c74)
2024-06-04 08:36:16 +02:00
Miss Islington (bot) e5fb3a2385
[3.13] gh-117398: Use Per-Interpreter State for the _datetime Static Types (gh-120009)
We make use of the same mechanism that we use for the static builtin types.  This required a few tweaks.

This change is the final piece needed to make _datetime support multiple interpreters.  I've updated the module slot accordingly.

(cherry picked from commit 105f22ea46, AKA gh-119929)

Co-authored-by: Eric Snow <ericsnowcurrently@gmail.com>
2024-06-03 23:37:28 +00:00
Miss Islington (bot) c348e27cc1
[3.13] gh-117142: Support Importing ctypes in Isolated Interpreters (gh-120008)
This makes the support official.

(cherry picked from commit dba7a167db, AKA gh-119991)

Co-authored-by: Eric Snow <ericsnowcurrently@gmail.com>
Co-authored-by: Kirill Podoprigora <kirill.bast9@mail.ru>
2024-06-03 23:06:56 +00:00
Miss Islington (bot) 6b10467fbc
[3.13] gh-118835: pyrepl: Fix prompt length computation for custom prompts containing ANSI escape codes (GH-119942) (#119990)
gh-118835: pyrepl: Fix prompt length computation for custom prompts containing ANSI escape codes (GH-119942)
(cherry picked from commit 2e0aa731ae)

Co-authored-by: Daniel Hollas <daniel.hollas@bristol.ac.uk>
2024-06-03 17:31:26 +00:00
Miss Islington (bot) 671b740f45
gh-119679: Ensures correct import libraries are included in Windows install packages (GH-119790)
(cherry picked from commit fd01271366)

Co-authored-by: Steve Dower <steve.dower@python.org>
2024-06-03 15:06:53 +00:00
Miss Islington (bot) b26b410ce9
gh-102511: Amend 3.13.0b1.rst (GH-119895)
(cherry picked from commit 4765e1fa29)

Co-authored-by: Nice Zombies <nineteendo19d0@gmail.com>
2024-06-03 13:46:40 +00:00
Miss Islington (bot) cc663b7e25
[3.13] gh-119336: Restore removed _PyLong_NumBits() function (GH-119418) (#119970)
gh-119336: Restore removed _PyLong_NumBits() function (GH-119418)

It is used by the pywin32 project.
(cherry picked from commit e50fac96e8)

Co-authored-by: Ethan Smith <ethan@ethanhs.me>
2024-06-03 09:29:07 +00:00
Miss Islington (bot) 225c3cd6c1
[3.13] GH-89727: Fix `shutil.rmtree()` recursion error on deep trees (GH-119808) (#119918)
Implement `shutil._rmtree_safe_fd()` using a list as a stack to avoid emitting recursion errors on deeply nested trees.

`shutil._rmtree_unsafe()` was fixed in a150679f90.

(cherry picked from commit 53b1981fb0)

Co-authored-by: Barney Gale <barney.gale@gmail.com>
2024-06-01 20:38:55 +01:00
Miss Islington (bot) 0ea77d49cc
[3.13] gh-113892: Add a extra check to `ProactorEventLoop.sock_connect` to ensure that the given socket is in non-blocking mode (GH-119519) (#119912)
(cherry picked from commit cf3bba3f06)

Co-authored-by: Kirill Podoprigora <kirill.bast9@mail.ru>
2024-06-01 16:27:54 +00:00
Victor Stinner 4e147caf3f
[3.13] Revert "[3.13] gh-69214: Fix fcntl.ioctl() request type (GH-119498) (… (#119906)
Revert "[3.13] gh-69214: Fix fcntl.ioctl() request type (GH-119498) (#119504)"

This reverts commit 0bab0b3a53.

The change modified how negative values, like termios.TIOCSWINSZ, was
treated and is actually backward incompatible.
2024-06-01 17:08:23 +02:00
Jelle Zijlstra a0559849ac
[3.13] gh-119821: Support non-dict globals in LOAD_FROM_DICT_OR_GLOBALS (#119822) (#119889)
dSupport non-dict globals in LOAD_FROM_DICT_OR_GLOBALS

The implementation basically copies LOAD_GLOBAL. Possibly it could be deduplicated,
but that seems like it may get hairy since the two operations have different operands.

This is important to fix in 3.14 for PEP 649, but it's a bug in earlier versions too,
and we should backport to 3.13 and 3.12 if possible.

(cherry picked from commit 80a4e38994)
2024-05-31 21:56:26 -07:00
Miss Islington (bot) a5272e63ef
[3.13] gh-118894: Make asyncio REPL use pyrepl (GH-119433) (#119884)
(cherry picked from commit 2237946af0)

Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2024-05-31 17:15:44 -04:00
Miss Islington (bot) a7e81fdfc1
[3.13] gh-119369: Fix deadlock during thread exit in free-threaded build (GH-119528) (#119868)
Release the GIL before calling `_Py_qsbr_unregister`.

The deadlock could occur when the GIL was enabled at runtime. The
`_Py_qsbr_unregister` call might block while holding the GIL because the
thread state was not active, but the GIL was still held.
(cherry picked from commit 078b8c8cf2)

Co-authored-by: Sam Gross <colesbury@gmail.com>
2024-05-31 14:19:38 -04:00
Miss Islington (bot) 8e0777df1f
gh-119690: Adds Unicode support for named pipes in _winapi (GH-119717)
(cherry picked from commit 78d697b7d5)

Co-authored-by: Steve Dower <steve.dower@python.org>
2024-05-31 16:22:30 +00:00
Miss Islington (bot) ea48de4f4f
[3.13] gh-119585: Fix crash involving `PyGILState_Release()` and `PyThreadState_Clear()` (GH-119753) (#119859)
Make sure that `gilstate_counter` is not zero in when calling
`PyThreadState_Clear()`. A destructor called from `PyThreadState_Clear()` may
call back into `PyGILState_Ensure()` and `PyGILState_Release()`. If
`gilstate_counter` is zero, it will try to create a new thread state before
the current active thread state is destroyed, leading to an assertion failure
or crash.
(cherry picked from commit bcc1be39cb)

Co-authored-by: Sam Gross <colesbury@gmail.com>
2024-05-31 15:29:50 +00:00
Miss Islington (bot) d6faac6d1f
[3.13] gh-111201: Support pyrepl on Windows (GH-119559) (GH-119850)
(cherry picked from commit 0d07182821)

Co-authored-by: Dino Viehland <dinoviehland@gmail.com>
Co-authored-by: Anthony Shaw <anthony.p.shaw@gmail.com>
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2024-05-31 17:18:28 +02:00
Miss Islington (bot) 6e57bd01e0
gh-116145: Updated bundled Tcl/Tk on Windows to 8.6.14 (GH-117030)
(cherry picked from commit 0e8d35b931)

Co-authored-by: Steve Dower <steve.dower@python.org>
2024-05-31 12:38:03 +00:00
Miss Islington (bot) 5539bd9df2
[3.13] gh-103194: Fix Tkinter’s Tcl value type handling for Tcl 8.7/9.0 (GH-103846) (GH-119830)
Some of standard Tcl types were renamed, removed, or no longer
registered in Tcl 8.7/9.0. This change fixes automatic conversion of Tcl
values to Python values to avoid returning a Tcl_Obj where the primary
Python types (int, bool, str, bytes) were returned in older Tcl.
(cherry picked from commit 94e9585e99)

Co-authored-by: Christopher Chavez <chrischavez@gmx.us>
2024-05-31 10:42:24 +00:00
Miss Islington (bot) 8470593a98
[3.13] gh-119548: Add a 'clear' command to the REPL (GH-119549) (#119552)
gh-119548: Add a 'clear' command to the REPL (GH-119549)
(cherry picked from commit e3bac04c37)

Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
2024-05-31 08:35:21 +00:00
Miss Islington (bot) 608cfb8b41
[3.13] gh-119729: Use 't' in pkg-config file name for free-threaded build (GH-119738) (#119797)
For example, the free-threaded build now generates
`lib/pkgconfig/python-3.13t.pc` and the debug build generates
`lib/pkgconfig/python-3.13d.pc`.
(cherry picked from commit 1c04c63ced)

Co-authored-by: Sam Gross <colesbury@gmail.com>
2024-05-30 18:17:05 +00:00
Miss Islington (bot) 810a09ad37
[3.13] GH-89727: Fix `os.fwalk()` recursion error on deep trees (GH-119638) (#119764)
GH-89727: Fix `os.fwalk()` recursion error on deep trees (GH-119638)

Implement `os.fwalk()` using a list as a stack to avoid emitting recursion
errors on deeply nested trees.
(cherry picked from commit 3c890b503c)

Co-authored-by: Barney Gale <barney.gale@gmail.com>
2024-05-30 03:28:55 +00:00
Miss Islington (bot) 061abf8e4c
[3.13] GH-89727: Partially fix `shutil.rmtree()` recursion error on deep trees (GH-119634) (#119748)
GH-89727: Partially fix `shutil.rmtree()` recursion error on deep trees (GH-119634)

Make `shutil._rmtree_unsafe()` call `os.walk()`, which is implemented
without recursion.

`shutil._rmtree_safe_fd()` is not affected and can still raise a recursion
error.

(cherry picked from commit a150679f90)

Co-authored-by: Barney Gale <barney.gale@gmail.com>
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2024-05-29 20:41:03 +00:00
Miss Islington (bot) c3cfc04a73
gh-119070: Fix py.exe handling of /usr/bin/env commands missing extension (GH-119426)
(cherry picked from commit df93f5d4bf)

Co-authored-by: Steve Dower <steve.dower@python.org>
2024-05-29 20:06:38 +00:00
Miss Islington (bot) dcfbd3be9f
[3.13] gh-119525: Fix deadlock with `_PyType_Lookup` and the GIL (GH-119527) (#119746)
The deadlock only affected the free-threaded build and only occurred
when the GIL was enabled at runtime. The `Py_DECREF(old_name)` call
might temporarily release the GIL while holding the type seqlock.
Another thread may spin trying to acquire the seqlock while holding the
GIL.

The deadlock occurred roughly 1 in ~1,000 runs of `pool_in_threads.py`
from `test_multiprocessing_pool_circular_import`.
(cherry picked from commit c22323cd1c)

Co-authored-by: Sam Gross <colesbury@gmail.com>
2024-05-29 19:47:47 +00:00
Miss Islington (bot) 40a024c983
[3.13] gh-119555: catch SyntaxError from compile() in the InteractiveColoredConsole (GH-119557) (#119709) 2024-05-29 12:04:45 +01:00
Miss Islington (bot) 17d3398486
[3.13] gh-119443: Turn off from __future__ import annotations in REPL (GH-119493) (#119697)
gh-119443: Turn off from __future__ import annotations in REPL (GH-119493)
(cherry picked from commit a8e35e8eba)

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2024-05-29 01:26:19 +00:00
Eric Snow 12a580b82d
[3.13] gh-117398: Statically Allocate the Datetime C-API (GH-119472) (gh-119641)
This is a backport of 3 commits that go together.

(cherry picked from commit a895756)
(cherry picked from commit b30d30c)
(cherry picked from commit a89fc26)
2024-05-28 21:00:04 +00:00
Miss Islington (bot) 0d0be6b3ef
[3.13] gh-119118: Fix performance regression in tokenize module (GH-119615) (#119682)
- Cache line object to avoid creating a Unicode object
  for all of the tokens in the same line.
- Speed up byte offset to column offset conversion by using the
  smallest buffer possible to measure the difference.

(cherry picked from commit d87b015106)

Co-authored-by: Lysandros Nikolaou <lisandrosnik@gmail.com>
Co-authored-by: Pablo Galindo <pablogsal@gmail.com>
2024-05-28 22:47:45 +02:00
Miss Islington (bot) c0e9961798
[3.13] gh-119011: `type.__type_params__` now return an empty tuple (GH-119296) (#119678)
(cherry picked from commit 6b240c2308)

Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
2024-05-28 19:09:04 +00:00
Jelle Zijlstra 6394a72e99
[3.13] gh-119311: Fix name mangling with PEP 695 generic classes (#119464) (#119643)
Fixes #119311. Fixes #119395.

(cherry picked from commit a9a74da4a0)
2024-05-28 11:03:33 -07:00
Miss Islington (bot) bd9983cab8
[3.13] gh-119560: Drop an Invalid Assert in PyState_FindModule() (gh-119561) (gh-119632)
The assertion was added in gh-118532 but was based on the invalid assumption that PyState_FindModule() would only be called with an already-initialized module def.  I've added a test to make sure we don't make that assumption again.

(cherry picked from commit 0c5ebe13e9)

Co-authored-by: Eric Snow <ericsnowcurrently@gmail.com>
2024-05-27 19:11:29 +00:00
Miss Islington (bot) 46d7712829
[3.13] Fix typos in HISTORY documentation (GH-119453) (#119597)
Co-authored-by: Xie Yanbo <xieyanbo@gmail.com>
2024-05-27 08:13:49 +00:00
Miss Islington (bot) f49749cf8f
[3.13] gh-111999: Fix the signature of str.format_map() (GH-119540) (#119543)
(cherry picked from commit 08e65430aa)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2024-05-25 13:46:41 +00:00
Miss Islington (bot) cc38ee1edb
gh-118263: Add additional arguments to path_t (Argument Clinic type) in posixmodule (GH-118355)
(cherry picked from commit 96b392df30)

Co-authored-by: Nice Zombies <nineteendo19d0@gmail.com>
2024-05-24 18:26:06 +00:00
Miss Islington (bot) 0bab0b3a53
[3.13] gh-69214: Fix fcntl.ioctl() request type (GH-119498) (#119504)
gh-69214: Fix fcntl.ioctl() request type (GH-119498)

Use an 'unsigned long' instead of an 'unsigned int' for the request
parameter of fcntl.ioctl() to support requests larger than UINT_MAX.
(cherry picked from commit 92fab3356f)

Co-authored-by: Victor Stinner <vstinner@python.org>
2024-05-24 12:54:59 +00:00
Miss Islington (bot) c864efba25
[3.13] gh-118692: Avoid creating unnecessary StopIteration instances for monitoring (GH-119216) (#119497)
* gh-118692: Avoid creating unnecessary StopIteration instances for monitoring (GH-119216)
(cherry picked from commit 6e9863d7a3)

---------

Co-authored-by: Irit Katriel <1055913+iritkatriel@users.noreply.github.com>
2024-05-24 10:18:13 +00:00
Miss Islington (bot) 251ef2e36f
[3.13] GH-117195: Avoid assertion error in `object.__sizeof__` (GH-117220) (GH-119456) 2024-05-23 16:58:34 +01:00
Miss Islington (bot) dbe4f8a2e8
[3.13] Fix typos in what's new documentation (GH-119448) (#119449) 2024-05-23 06:59:33 +00:00
Lysandros Nikolaou 9fa1b4fc46
[3.13] gh-118911: Trailing whitespace in a block shouldn't prevent the user from terminating the code block (GH-119355) (#119404)
(cherry picked from commit 5091c4400c)

Co-authored-by: Aya Elsayed <ayah.ehab11@gmail.com>
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2024-05-23 00:12:26 -04:00
Miss Islington (bot) 6bc7fc08ae
[3.13] gh-113978: Ignore warnings on text completion inside REPL (GH-113979) (#119429)
(cherry picked from commit e03dde5a24)

Co-authored-by: Yan Yanchii <yyanchiy@gmail.com>
2024-05-22 23:13:32 +02:00
Miss Islington (bot) 3e30a38561
gh-117505: Run ensurepip in isolated env in Windows installer (GH-118257)
ensurepip forks a subprocess to run pip itself, but that subprocess only inherits a -I isolated mode flag (see _run_pip() in Lib/ensurepip/__init__.py), not the "-E -s" flags that the installer has been using. This means that parts of ensurepip don't actually run in an isolated environment and can make incorrect decisions based on packages installed in the user site-packages.
(cherry picked from commit c9073eb1a9)

Co-authored-by: Michael Vincent <377567+Vynce@users.noreply.github.com>
2024-05-22 19:46:35 +00:00
Miss Islington (bot) 08416065a7
[3.13] gh-119247: Add macros to use PySequence_Fast safely in free-threaded build (GH-119315) (#119419)
Add `Py_BEGIN_CRITICAL_SECTION_SEQUENCE_FAST` and
`Py_END_CRITICAL_SECTION_SEQUENCE_FAST` macros and update `str.join` to use
them. Also add a regression test that would crash reliably without this
patch.
(cherry picked from commit baf347d916)

Co-authored-by: Josh {*()} Rosenberg <26495692+MojoVampire@users.noreply.github.com>
2024-05-22 19:24:02 +00:00
Miss Islington (bot) bfd9c3ea53
[3.13] gh-119213: Be More Careful About _PyArg_Parser.kwtuple Across Interpreters (gh-119331) (gh-119410)
_PyArg_Parser holds static global data generated for modules by Argument Clinic.  The _PyArg_Parser.kwtuple field is a tuple object, even though it's stored within a static global.  In some cases the tuple is statically allocated and thus it's okay that it gets shared by multiple interpreters.  However, in other cases the tuple is set lazily, allocated from the heap using the active interprepreter at the point the tuple is needed.

This is a problem once that interpreter is destroyed since _PyArg_Parser.kwtuple becomes at dangling pointer, leading to crashes.  It isn't a problem if the tuple is allocated under the main interpreter, since its lifetime is bound to the lifetime of the runtime.  The solution here is to temporarily switch to the main interpreter.  The alternative would be to always statically allocate the tuple.

This change also fixes a bug where only the most recent parser was added to the global linked list.

(cherry picked from commit 81865002ae)

Co-authored-by: Eric Snow <ericsnowcurrently@gmail.com>
2024-05-22 12:09:48 -06:00
Lysandros Nikolaou ac9163637b
[3.13] gh-111201: Remove readline dependency from the PyREPL (GH-119262) (#119403)
(cherry picked from commit 561ff1fa71)
2024-05-22 11:45:11 -04:00
Miss Islington (bot) 6892b400dc
[3.13] gh-118643: Fix AttributeError in the email module (GH-119099) (GH-119389)
Fix regression introduced in gh-100884: AttributeError when re-fold a long
address list.

Also fix more cases of incorrect encoding of the address separator in the
address list missed in gh-100884.
(cherry picked from commit 858b9e85fc)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2024-05-22 14:07:38 +03:00
Miss Islington (bot) 0e6198972a
[3.13] Fix typos in NEWS entries for 3.13 (GH-119374) (GH-119385)
(cherry picked from commit 904e256292)

Co-authored-by: Xie Yanbo <xieyanbo@gmail.com>
2024-05-22 09:47:49 +00:00
Miss Islington (bot) f15fbe9991
gh-118507 : Refactor `nt._path_is*` to improve applicability for other cases (GH-118755)
(cherry picked from commit b64182550f)

Co-authored-by: Nice Zombies <nineteendo19d0@gmail.com>
2024-05-22 00:29:34 +00:00
Miss Islington (bot) fef202f97b
[3.13] Fix typos in documentation (GH-119295) (#119337)
Co-authored-by: Xie Yanbo <xieyanbo@gmail.com>
2024-05-21 22:07:20 +00:00
Hugo van Kemenade 1929b7e2bf
[3.13] Docs: Ensure no warnings are found in the NEWS file before a given line number (GH-119221) (#119261) 2024-05-21 08:40:08 -06:00
Miss Islington (bot) f7303cd967
[3.13] gh-119174: Fix high DPI causes turtledemo(turtle-graphics examples) windows blurry (GH-119175) (#119289)
gh-119174: Fix high DPI causes turtledemo(turtle-graphics examples) windows blurry (GH-119175)

------

(cherry picked from commit 538ed5e481)

Co-authored-by: Wulian233 <71213467+Wulian233@users.noreply.github.com>
2024-05-21 03:53:29 +00:00
Miss Islington (bot) 42a8d11752
[3.13] gh-119050: Add XML support to libregrtest refleak checker (GH-119148) (#119270)
gh-119050: Add XML support to libregrtest refleak checker (GH-119148)

regrtest test runner: Add XML support to the refleak checker
(-R option).

* run_unittest() now stores XML elements as string, rather than
  objects, in support.junit_xml_list.
* runtest_refleak() now saves/restores XML strings before/after
  checking for reference leaks. Save XML into a temporary file.
(cherry picked from commit 9257731f5d)

Co-authored-by: Victor Stinner <vstinner@python.org>
2024-05-20 22:50:20 +00:00
Miss Islington (bot) b4462aaed6
[3.13] gh-118760: Restore the default value of tkinter.wantobjects to 1 (GH-118784) (GH-119251)
It was set to 2 in 65f5e586a1 (GH-98592).
(cherry picked from commit e188527c34)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2024-05-20 20:28:42 +00:00
Miss Islington (bot) 054f1af811
[3.13] gh-92081: Fix for email.generator.Generator with whitespace between encoded words. (GH-92281) (#119245)
* Fix for email.generator.Generator with whitespace between encoded words.

email.generator.Generator currently does not handle whitespace between
encoded words correctly when the encoded words span multiple lines.  The
current generator will create an encoded word for each line.  If the end
of the line happens to correspond with the end real word in the
plaintext, the generator will place an unencoded space at the start of
the subsequent lines to represent the whitespace between the plaintext
words.

A compliant decoder will strip all the whitespace from between two
encoded words which leads to missing spaces in the round-tripped
output.

The fix for this is to make sure that whitespace between two encoded
words ends up inside of one or the other of the encoded words.  This
fix places the space inside of the second encoded word.

A second problem happens with continuation lines.  A continuation line that
starts with whitespace and is followed by a non-encoded word is fine because
the newline between such continuation lines is defined as condensing to
a single space character.  When the continuation line starts with whitespace
followed by an encoded word, however, the RFCs specify that the word is run
together with the encoded word on the previous line.  This is because normal
words are filded on syntactic breaks by encoded words are not.

The solution to this is to add the whitespace to the start of the encoded word
on the continuation line.

Test cases are from GH-92081

* Rename a variable so it's not confused with the final variable.
(cherry picked from commit a6fdb31b67)

Co-authored-by: Toshio Kuratomi <a.badger@gmail.com>
2024-05-20 20:01:56 +00:00
Miss Islington (bot) e370b642ea
[3.13] gh-115119: Fall back to bundled libmpdec if system libmpdec is not found (GH-119196) (#119217)
(cherry picked from commit 642b25b9a8)

Co-authored-by: Erlend E. Aasland <erlend@python.org>
2024-05-20 16:10:21 +00:00
Miss Islington (bot) 3a8ab99bf7
[3.13] gh-119121: Fix and test `async.staggered.staggered_race` (GH-119173) (#119206)
gh-119121: Fix and test `async.staggered.staggered_race` (GH-119173)
(cherry picked from commit 16b46ebd2b)

Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
2024-05-20 11:31:31 +00:00
Miss Islington (bot) 27b61c17a1
[3.13] GH-119113: Raise `TypeError` from `pathlib.PurePath.with_suffix(None)` (GH-119124) (#119183)
Restore behaviour from 3.12 when `path.with_suffix(None)` is called.
(cherry picked from commit 3c28510b98)

Co-authored-by: Barney Gale <barney.gale@gmail.com>
2024-05-19 16:27:12 +00:00
Miss Islington (bot) 7407267ce4
[3.13] GH-118447: Fix handling of unreadable symlinks in `os.path.realpath()` (GH-118489) (#119163)
(cherry picked from commit caf6064a1b)

Co-authored-by: Barney Gale <barney.gale@gmail.com>
Co-authored-by: Nice Zombies <nineteendo19d0@gmail.com>
2024-05-18 23:12:19 +00:00
Miss Islington (bot) ec88e9f686
[3.13] gh-119132: Update sys.version to identify free-threaded or not. (gh-119134) (#119153)
gh-119132: Update sys.version to identify free-threaded or not. (gh-119134)
(cherry picked from commit c141d43937)

Co-authored-by: Donghee Na <donghee.na@python.org>
2024-05-18 16:49:11 -04:00
Miss Islington (bot) ced71d39cf
[3.13] gh-119049: Fix incorrect display of warning which is constructed by C API (GH-119063) (GH-119106)
The source line was not displayed if the warnings module had not yet
been imported.
(cherry picked from commit 100c7ab00a)

Co-authored-by: Kirill Podoprigora <kirill.bast9@mail.ru>
2024-05-17 18:16:58 +03:00
Miss Islington (bot) ada4ad0e24
[3.13] Fix typos in documentation (GH-119092) (#119116)
Fix typos in documentation (GH-119092)
(cherry picked from commit 65de194dd8)

Co-authored-by: Xie Yanbo <xieyanbo@gmail.com>
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2024-05-17 10:57:20 +00:00
Miss Islington (bot) acffe20683
[3.13] GH-118943: Fix a race condition when generating jit_stencils.h (GH-119101)
(cherry picked from commit 4702b7b5bd)
2024-05-16 14:37:56 -04:00
Miss Islington (bot) 4f81915cf5
[3.13] gh-118760: Fix errors in calling Tkinter bindings on Windows (GH-118782) (GH-119072)
For unknown reasons some arguments for Tkinter binding can be created
as a 1-tuple containing a Tcl_Obj when wantobjects is 2.
(cherry picked from commit 5b88d95cc5)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2024-05-15 17:16:03 +00:00
Miss Islington (bot) 8720006062
[3.13] gh-67693: Fix urlunparse() and urlunsplit() for URIs with path starting with multiple slashes and no authority (GH-113563) (GH-119023)
(cherry picked from commit e237b25a4f)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2024-05-14 09:47:05 +00:00
Miss Islington (bot) 29a2f9cc28
[3.13] GH-118836: Fix JIT build error when SHT_NOTE section is present (GH-119020)
(cherry picked from commit e04cd964eb)

Co-authored-by: Michał Górny <mgorny@gentoo.org>
2024-05-13 22:17:34 +00:00
Miss Islington (bot) 09d4c072eb
[3.13] gh-58933: Make pdb return to caller frame correctly when f_trace is not set (GH-118979) (#119007)
gh-58933: Make pdb return to caller frame correctly when f_trace is not set (GH-118979)
(cherry picked from commit f526314194)

Co-authored-by: Tian Gao <gaogaotiantian@hotmail.com>
2024-05-13 20:18:03 +01:00
Miss Islington (bot) a8ea9669aa
[3.13] gh-87106: Fix inspect.signature.bind() handling of positional-only arguments with **kwargs (GH-103404) (#118985)
(cherry picked from commit 9c15202441)

Co-authored-by: Jacob Walls <jacobtylerwalls@gmail.com>
2024-05-13 08:35:31 +00:00
Miss Islington (bot) 9d2c10bee3
[3.13] GH-118844: Fix build failures when combining --disable-gil with --enable-experimental-jit (GH-118959)
(cherry picked from commit 5b941e57c7)

Co-authored-by: Savannah Ostrowski <savannahostrowski@gmail.com>
2024-05-13 04:53:30 +00:00
Miss Islington (bot) 93ef7aa03c
[3.13] gh-118921: Add `copy()` method for `FrameLocalsProxy` (GH-118923) (#118933)
(cherry picked from commit 35c436186b)

Co-authored-by: Tian Gao <gaogaotiantian@hotmail.com>
2024-05-10 23:15:54 +00:00
Miss Islington (bot) 6df49134b3
[3.13] gh-118895: Call PyType_Ready() on typing.NoDefault (GH-118897) (#118914)
(cherry picked from commit 13d7cf997b)

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2024-05-10 16:36:33 +00:00
Miss Islington (bot) 4480dd86d9
[3.13] gh-117657: Fix data races reported by TSAN on `interp->threads.main` (GH-118865) (#118904)
Use relaxed loads/stores when reading/writing to this field.
(cherry picked from commit 22d5185308)

Co-authored-by: mpage <mpage@meta.com>
2024-05-10 14:40:06 +00:00
Miss Islington (bot) bb5bf24226
[3.13] gh-118789: Restore hidden `_PyWeakref_ClearRef` (GH-118797) (GH-118903)
gh-118789: Restore hidden `_PyWeakref_ClearRef` (GH-118797)

_PyWeakref_ClearRef was previously exposed in the public C-API, although
it begins with an underscore and is not documented. It's used by a few
C-API extensions. There is currently no alternative public API that can
replace its use.

_PyWeakref_ClearWeakRefsExceptCallbacks is the only thread-safe way to
use _PyWeakref_ClearRef in the free-threaded build. This exposes the C
symbol, but does not make the API public.
(cherry picked from commit db5af7da09)

Co-authored-by: Sam Gross <colesbury@gmail.com>
2024-05-10 14:20:22 +00:00
Miss Islington (bot) 7dc9875d55
gh-118209: Add Windows structured exception handling to mmap module (GH-118213)
(cherry picked from commit e85e8deaf3)

Co-authored-by: Dobatymo <Dobatymo@users.noreply.github.com>
2024-05-10 12:00:00 +01:00
Miss Islington (bot) 00ec116883
[3.13] gh-118851: Default ctx arguments to AST constructors to Load() (GH-118854) (#118871)
(cherry picked from commit 68fbc00dc8)

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2024-05-09 22:52:42 +00:00
Miss Islington (bot) 0a23970478
[3.13] gh-116984: Make mimalloc header includes relative to the current file (GH-118808) (#118866)
Some embedders and extensions include parts of the internal API. The
pycore_mimalloc.h file is transitively include by a number of other
internal headers. This avoids include errors for code that was
already including those headers.
(cherry picked from commit 71cc0651e7)

Co-authored-by: Sam Gross <colesbury@gmail.com>
2024-05-09 20:26:36 +00:00
Miss Islington (bot) 846cfb9a67
[3.13] gh-118561: Fix crash involving list.extend in free-threaded build (GH-118723) (#118863)
The `list_preallocate_exact` function did not zero initialize array
contents. In the free-threaded build, this could expose uninitialized
memory to concurrent readers between the call to
`list_preallocate_exact` and the filling of the array contents with
items.
(cherry picked from commit 2402715e10)

Co-authored-by: Sam Gross <colesbury@gmail.com>
2024-05-09 19:14:47 +00:00
Miss Islington (bot) 9d646d084c
gh-118773: Use language-invariant SDDL string instead of aliases for ACLs. (GH-118800)
(cherry picked from commit 8af84b503d)

Co-authored-by: Steve Dower <steve.dower@python.org>
2024-05-09 17:11:11 +00:00
Miss Islington (bot) c4b853f2a5
[3.13] gh-103956: Fix `trace` output in case of missing source line (GH-103958) (GH-118834)
Print only filename with lineno if linecache.getline() returns an empty string.
(cherry picked from commit 7c87ce777b)

Co-authored-by: Radislav Chugunov <52372310+chgnrdv@users.noreply.github.com>
2024-05-09 13:05:37 +00:00
Steve Dower d86b494117
gh-118486: Update docs for CVE-2024-4030 reference (GH-118737)
Update docs for CVE-2024-4030 reference
2024-05-09 12:52:11 +01:00
Miss Islington (bot) 632682c0c2
[3.13] gh-118033: Fix `__weakref__` not set for generic dataclasses (GH-118099) (#118821)
gh-118033: Fix `__weakref__` not set for generic dataclasses (GH-118099)
(cherry picked from commit fa9b9cb113)

Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
2024-05-09 09:02:22 +00:00
Miss Islington (bot) 8f31af68d0
[3.13] Format None, True, False and NotImplemented as literals (GH-118758) (GH-118792)
(cherry picked from commit 05c2fe1acd)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2024-05-08 19:55:12 +00:00
Miss Islington (bot) c6680cdc5a
[3.13] gh-118772: Allow TypeVars without a default to follow those with a default when constructing aliases (GH-118774) (#118776)
(cherry picked from commit aac6b019fe)

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2024-05-08 19:31:41 +00:00
Thomas Wouters 2268289a47 Python 3.13.0b1 2024-05-08 11:21:00 +02:00
Steve Dower 460546529b
gh-118734: Fixes Windows build when Use_TIER2 is unspecified (#118735) 2024-05-07 23:01:18 +02:00
Jelle Zijlstra 71080b8a0f
gh-118660: Add second type parameter to (Async)ContextManager (#118681)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2024-05-07 14:16:05 +00:00
Serhiy Storchaka 65f5e586a1
gh-66410: Do not stringify arguments of Tkinter callback (GH-98592)
Callbacks registered in the tkinter module now take arguments as
various Python objects (int, float, bytes, tuple), not just str.
To restore the previous behavior set tkinter module global wantobject to 1
before creating the Tk object or call the wantobject() method of the Tk object
with argument 1.
Calling it with argument 2 restores the current default behavior.
2024-05-07 12:07:32 +00:00
Nikita Sobolev b60d4c0d53
gh-118090: Improve error message for empty type param brackets (GH-118091) 2024-05-07 14:01:06 +02:00
Hugo van Kemenade 04859228aa
gh-118518: Rename `PYTHONPERFJITSUPPORT` and `-X perfjit` with underscores (#118693) 2024-05-07 11:47:21 +00:00
Alex Waygood 0f8a07d158
gh-118418: Deprecate failing to pass a value to the *type_params* parameter of some private `typing` APIs (#118695) 2024-05-07 11:12:28 +00:00
chrysn 1e428426c8
gh-118650: Exclude `_repr_*` methods from Enum's _sunder_ reservation (GH-118651) 2024-05-07 12:35:51 +02:00
Hugo van Kemenade 6cf70678e2
gh-109975: Update 'What's New in Python 3.13' for beta (#118694) 2024-05-07 12:35:32 +02:00
Youfu Zhang fe47d9bee3
gh-118314: Fix padding edge case in binascii.a2b_base64 strict mode (GH-118320)
Fix an edge case in `binascii.a2b_base64` strict mode, where
excessive padding was not detected when no padding is necessary.

Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
Co-authored-by: Pieter Eendebak <pieter.eendebak@gmail.com>
2024-05-07 11:18:45 +02:00
Ali Hamdan de1428f8c2
gh-62090: Simplify argparse usage formatting (GH-105039)
Rationale
=========

argparse performs a complex formatting of the usage for argument grouping
and for line wrapping to fit the terminal width. This formatting has been
a constant source of bugs for at least 10 years (see linked issues below)
where defensive assertion errors are triggered or brackets and paranthesis
are not properly handeled.

Problem
=======

The current implementation of argparse usage formatting relies on regular
expressions to group arguments usage only to separate them again later
with another set of regular expressions. This is a complex and error prone
approach that caused all the issues linked below. Special casing certain
argument formats has not solved the problem. The following are some of
the most common issues:
- empty `metavar`
- mutually exclusive groups with `SUPPRESS`ed arguments
- metavars with whitespace
- metavars with brackets or paranthesis

Solution
========

The following two comments summarize the solution:
- https://github.com/python/cpython/issues/82091#issuecomment-1093832187
- https://github.com/python/cpython/issues/77048#issuecomment-1093776995

Mainly, the solution is to rewrite the usage formatting to avoid the
group-then-separate approach. Instead, the usage parts are kept separate
and only joined together at the end. This allows for a much simpler
implementation that is easier to understand and maintain. It avoids the
regular expressions approach and fixes the corresponding issues.

This closes the following GitHub issues:
-  #62090
-  #62549
-  #77048
-  #82091
-  #89743
-  #96310
-  #98666

These PRs become obsolete:
-  #15372
-  #96311
2024-05-07 09:28:51 +02:00
John Sirois 49258efada
gh-118107: Fix zipimporter ZIP64 handling. (GH-118108)
Add missing import to code that handles too large files and offsets.
Use list, not tuple, for a mutable sequence.

Add tests to prevent similar mistakes.

---------

Co-authored-by: Gregory P. Smith [Google LLC] <greg@krypto.org>
Co-authored-by: Kirill Podoprigora <kirill.bast9@mail.ru>
2024-05-07 09:23:27 +02:00
Tian Gao 0d9148823d
gh-118414: Fix assertion in YIELD_VALUE when tracing lines or instrs (#118683) 2024-05-06 21:22:59 -07:00
Eric Snow b2cd54a4fb
gh-117953: Always Run Extension Init Func in Main Interpreter First (gh-118157)
This change makes sure all extension/builtin modules have their init function run first by the main interpreter before proceeding with import in the original interpreter (main or otherwise).  This means when the import of a single-phase init module fails in an isolated subinterpreter, it won't tie any global state/callbacks to the subinterpreter.
2024-05-07 04:21:51 +00:00
Brett Simmers 853163d3b5
gh-116322: Enable the GIL while loading C extension modules (#118560)
Add the ability to enable/disable the GIL at runtime, and use that in
the C module loading code.

We can't know before running a module init function if it supports
free-threading, so the GIL is temporarily enabled before doing so. If
the module declares support for running without the GIL, the GIL is
later disabled. Otherwise, the GIL is permanently enabled, and will
never be disabled again for the life of the current interpreter.
2024-05-06 23:07:23 -04:00
James Hilton-Balfe e7dafdc224
gh-110209: Add __class_getitem__ for generator and coroutine (#110212) 2024-05-06 18:41:32 -07:00
Jeong, YunWon 8d8275b0cf
gh-118473: Fix set_asyncgen_hooks not to be partially set when arguments are invalid (#118474) 2024-05-06 17:02:52 -07:00
Jelle Zijlstra e0422198fb
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.
2024-05-06 15:57:27 -07:00
Jelle Zijlstra 8419f01673
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>
2024-05-06 22:35:06 +00:00
Erlend E. Aasland 325a1da18d
gh-115119: Default to --with-system-libmpdec=yes (#118539)
Co-authored-by: Zachary Ware <zachary.ware@gmail.com>
2024-05-06 21:16:08 +02:00
Tian Gao e5353d49dc
GH-83151: Add closure support to pdb (GH-111094) 2024-05-06 11:34:13 -07:00
Dino Viehland 5a1618a2c8
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
2024-05-06 10:50:35 -07:00
Thomas Grainger e5c699280d
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>
2024-05-06 17:13:15 +00:00
Petr Viktorin 417dd3aca7
gh-116322: Rename PyModule_ExperimentalSetGIL to PyUnstable_Module_SetGIL (GH-118645) 2024-05-06 18:59:36 +02:00
Serhiy Storchaka 709ca90a00
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().
2024-05-06 15:06:06 +00:00
Serhiy Storchaka 1b639a04ca
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().
2024-05-06 17:33:15 +03:00
Serhiy Storchaka 0085c3ae8f
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.
2024-05-06 15:53:15 +03:00
Serhiy Storchaka d6fa1d4bee
gh-66543: Add mimetypes.guess_file_type() (GH-117258) 2024-05-06 15:50:52 +03:00
Serhiy Storchaka 153b3f7530
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.
2024-05-06 12:02:37 +03:00
Pieter Eendebak 05adfbba2a
gh-95382: Improve performance of json encoder with indent (GH-118105) 2024-05-06 11:04:39 +03:00
Terry Jan Reedy 7758be4318
gh-78955: Use user-selected color theme for Help => IDLE Doc (#9502) 2024-05-06 03:55:56 -04:00
Pablo Galindo Salgado 2eb99914c4
Add Lysandros Nikolaou to the News entry of gh-111201 (#118616) 2024-05-05 22:13:50 +00:00
Pablo Galindo Salgado f27f8c790a
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>
2024-05-05 21:32:23 +02:00
Guido van Rossum 40cc809902
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.
2024-05-05 19:28:55 +00:00
Guido van Rossum 9c13d9e37a
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).
2024-05-05 15:31:26 +00:00
Tian Gao 5a0022a1d7
GH-111744: Make breakpoint() enter the debugger immediately (GH-118579) 2024-05-05 07:05:01 -07:00
Nikita Sobolev 1511bc95c4
gh-101137: Add `text/x-rst` to `mimetypes` (#118593) 2024-05-05 13:39:50 +00:00
Ryan Batchelder b6f0ab5b1c
gh-83505: Add markdown mimetype mapping (#17995) 2024-05-05 13:09:59 +00:00
Hugo van Kemenade 3b32575ed6
gh-118131: Command-line interface for the `random` module (#118132) 2024-05-05 06:30:03 +00:00
Serhiy Storchaka 711c80bfca
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>
2024-05-05 08:20:06 +03:00
Pablo Galindo Salgado 1b22d801b8
gh-118518: Allow perf to work without frame pointers (#112254) 2024-05-05 03:07:29 +02:00
Tim Peters 999f0c5122
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>
2024-05-04 18:22:33 -05:00
Davide Rizzo 08d169f14a
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>
2024-05-04 23:41:47 +02:00
Tian Gao f34e965e52
GH-111744: Support opcode events in bdb (GH-111834) 2024-05-04 07:44:49 -07:00
Tian Gao b034f14a4b
gh-74929: Implement PEP 667 (GH-115153) 2024-05-04 12:12:10 +01:00
Tian Gao 00da0afa0d
gh-113081: Print colorized exception just like built-in traceback in pdb (#113082) 2024-05-04 12:26:40 +02:00
Irit Katriel 85af789961
gh-111997: C-API for signalling monitoring events (#116413) 2024-05-04 08:23:50 +00:00
Tian Gao 9c14ed0618
gh-107674: Improve performance of `sys.settrace` (GH-117133)
* Check tracing in RESUME_CHECK

* Only change to RESUME_CHECK if not tracing
2024-05-03 19:49:24 +01:00
Tian Gao 998c3856c1
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.
2024-05-03 11:45:46 -07:00
Erlend E. Aasland dd8f05fee2
gh-115119: Update macOS installer to build with libmpdec 4.0.0 (GH-118382)
Co-authored-by: Ned Deily <nad@python.org>
2024-05-03 16:49:40 +00:00
Erlend E. Aasland 1324502752
gh-115119: Update Windows installer to mpdecimal 4.0.0 (#118506) 2024-05-03 18:00:43 +02:00
Brett Simmers c2627d6eea
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).
2024-05-03 11:30:55 -04:00
Sam Gross 2dae505e87
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.
2024-05-03 11:09:57 -04:00
Carl Meyer c8deb1e4b4
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>
2024-05-03 14:05:19 +00:00
Alexander Kanavin 37ccf16786
gh-101732: Modules/_ssl.c: use Y2038 compatible openssl function when available (GH-118425) 2024-05-03 15:34:05 +02:00
Jelle Zijlstra ca269e58c2
gh-116126: Implement PEP 696 (#116129)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com>
2024-05-03 06:17:32 -07:00
Tian Gao 4e2caf2aa0
gh-118500: Add pdb support for zipapp (#118501) 2024-05-02 21:53:27 +01:00
infohash b28a3339e4
gh-90848: Fixed create_autospec ignoring configure_mock style kwargs (#118163) 2024-05-02 18:36:35 +01:00
Pablo Galindo Salgado 6bcbee09df
gh-93502: Add new C-API functions to trace object creation and destruction (#115945) 2024-05-02 19:30:00 +02:00
Raphael Gaschignard 2770d5caca
gh-105879: Add support for keyword arguments to eval and exec (#105885)
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2024-05-02 08:55:29 -07:00
Sergey B Kirpichev 9789440de3
gh-82062: Fix support of parameter defaults on methods in extension modules (GH-115270)
Now inspect.signature() supports references to the module globals in
parameter defaults on methods in extension modules.  Previously it was
only supported in functions.  The workaround was to specify the fully
qualified name, including the module name.
2024-05-02 17:44:33 +03:00
Steve Dower 81939dad77
gh-118486: Support mkdir(mode=0o700) on Windows (GH-118488) 2024-05-02 15:20:43 +01:00
Crowthebird 7c97dc8c95
gh-118216: Don't consider dotted `__future__` imports (#118267) 2024-05-02 06:32:20 -07:00
Guido van Rossum a524152b8c
gh-118335: Make REGEN_JIT_COMMAND empty if tier2 interpreter enabled (#118493)
Also patch up news blurb for gh-118339
(add warning that PYTHON_UOPS is now PYTHON_JIT).
2024-05-01 16:36:29 -07:00
Nice Zombies a7711a2a4e
gh-117607: Speedup os.path.relpath() (GH-117608) 2024-05-01 22:44:55 +01:00
Victor Stinner b52c753e0f
gh-110850: Add PyTime_TimeRaw() function (#118394)
Add "Raw" variant of PyTime functions:

* PyTime_MonotonicRaw()
* PyTime_PerfCounterRaw()
* PyTime_TimeRaw()

Changes:

* Add documentation and tests. Tests release the GIL while calling
  raw clock functions.
* py_get_system_clock() and py_get_monotonic_clock() now check that
  the GIL is hold by the caller if raise_exc is non-zero.
* Reimplement "Unchecked" functions with raw clock functions.

Co-authored-by: Petr Viktorin <encukou@gmail.com>
2024-05-01 18:05:01 +00:00
Malcolm Smith 75955110a6
gh-116622: Android sysconfig updates (#118352) 2024-05-01 16:47:54 +00:00
Harmen Stoppels 759e8e7ab8
gh-99730: urllib.request: Keep HEAD method on redirect (GH-99731) 2024-05-01 18:01:47 +02:00
Anthony Shaw beb653cc24
gh-117958: Expose JIT code via method in UOpExecutor (#117959) 2024-05-01 07:11:14 -07:00