Commit Graph

124167 Commits

Author SHA1 Message Date
Victor Stinner db96327203
gh-121654: Add PyType_Freeze() function (#122457)
Co-authored-by: Petr Viktorin <encukou@gmail.com>
2024-10-25 11:12:48 +02:00
Serhiy Storchaka da8673da36
gh-84545: Clarify the 'extend' action documentation in argparse (GH-125870) 2024-10-25 08:41:38 +00:00
Russell Keith-Magee 75401febc9
gh-123930: Correct test of attribute failure to account for iOS (#125959)
Update a test of importing attributes from binary modules to account for iOS conditions.
2024-10-25 07:18:45 +00:00
Tian Gao 2513593303
Fixed a few type mismatches in pdb (#125952) 2024-10-25 00:17:58 -04:00
Malcolm Smith 371c537dff
Increase minimum Android API level to 24 (#125946)
Minimum Android API level has been increased to 24 (Android 7.0).
2024-10-25 08:41:07 +08:00
Malcolm Smith b08570c90e
gh-125942: Android: set stdout to `errors="backslashreplace"` (#125943)
Android stdout/err streams now use `backslashreplace` encoding to ensure readability of the Android log.
2024-10-25 08:35:41 +08:00
Malcolm Smith e68d4b08ff
gh-125940: Android: support 16 KB pages (#125941)
Modify Android build tooling to use 16kB pages.
2024-10-25 07:51:16 +08:00
Sam Gross fed501d724
gh-125245: Fix race condition when importing `collections.abc` (#125415)
If multiple threads concurrently imported `collections.abc`, some of the
threads might incorrectly see the "shim" `Lib/collections/abc.py` module
instead of the correct `Lib/_collections_abc.py` module.  This affected
both the free threading build and the default GIL-enabled build.
2024-10-24 18:12:51 -04:00
Sam Gross 332356b880
gh-125900: Clean-up logic around immortalization in free-threading (#125901)
* Remove `@suppress_immortalization` decorator
* Make suppression flag per-thread instead of per-interpreter
* Suppress immortalization in `eval()` to avoid refleaks in three tests
  (test_datetime.test_roundtrip, test_logging.test_config8_ok, and
   test_random.test_after_fork).
* frozenset() is constant, but not a singleton. When run multiple times,
  the test could fail due to constant interning.
2024-10-24 18:09:59 -04:00
Kerim Kabirov 1306f33c84
gh-125933: Add ARIA labels to select elements in the version switcher (#125934)
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2024-10-24 23:52:21 +03:00
Shantanu 500f5338a8
gh-123930: Better error for "from imports" when script shadows module (#123929) 2024-10-24 12:11:12 -07:00
Javad Shafique 3f24bde0b6
gh-118950: Fix SSLProtocol.connection_lost not being called when OSError is thrown (#118960)
Co-authored-by: Kumar Aditya <kumaraditya@python.org>
2024-10-24 17:41:16 +00:00
Peter Bierma 41bd9d959c
gh-125864: Propagate `pickle.loads()` failures in `InterpreterPoolExecutor` (gh-125898)
Authored-by: Peter Bierma <zintensitydev@gmail.com>
2024-10-24 10:51:45 -06:00
Sam Gross 3c4a7fa617
gh-124218: Avoid refcount contention on builtins module (GH-125847)
This replaces `_PyEval_BuiltinsFromGlobals` with
`_PyDict_LoadBuiltinsFromGlobals`, which returns a new reference
instead of a borrowed reference. Internally, the new function uses
per-thread reference counting when possible to avoid contention on the
refcount fields on the builtins module.
2024-10-24 12:44:38 -04:00
partev 5003ad5c5e
gh-125909: Avoid a redirect when linking to the devguide (#125826) 2024-10-24 17:41:01 +01:00
Sam Gross ad6110a93f
gh-125842: Fix `sys.exit(0xffff_ffff)` on Windows (#125896)
On Windows, `long` is a signed 32-bit integer so it can't represent
`0xffff_ffff` without overflow. Windows exit codes are unsigned 32-bit
integers, so if a child process exits with `-1`, it will be represented
as `0xffff_ffff`.

Also fix a number of other possible cases where `_Py_HandleSystemExit`
could return with an exception set, leading to a `SystemError` (or
fatal error in debug builds) later on during shutdown.
2024-10-24 12:03:50 -04:00
Sam Gross e545ead66c
gh-125859: Fix crash when `gc.get_objects` is called during GC (#125882)
This fixes a crash when `gc.get_objects()` or `gc.get_referrers()` is
called during a GC in the free threading build.

Switch to `_PyObjectStack` to avoid corrupting the `struct worklist`
linked list maintained by the GC. Also, don't return objects that are frozen
(`gc.freeze()`) or in the process of being collected to more closely match
the behavior of the default build.
2024-10-24 09:33:11 -04:00
Mark Shannon b61fece852
GH-125868: Fix STORE_ATTR_WITH_HINT specialization (GH-125876) 2024-10-24 11:57:02 +01:00
Marat Sharafutdinov c35b33bfb7
Fix typo in garbage_collector.md (#125556) 2024-10-23 19:04:49 -07:00
Jelle Zijlstra d3be6f945a
gh-125614: annotationlib: Fix bug where not all Stringifiers are converted (#125635) 2024-10-23 16:27:55 -07:00
Tian Gao 8f2c0f7a03
gh-125884: Support breakpoint on functions with annotations (#125892) 2024-10-23 18:04:30 -04:00
Petr Viktorin 13c9fa3d64
gh-121938: ctypes: Skip test of _pack_-ed struct with c_int64 on x86 (GH-125877)
The current auto-generated tests don't cover this; it's instead
tested manually.
2024-10-23 16:37:06 -05:00
Wulian 9c01db40aa
gh-125665: Update turtledemo docstrings with correct file names (#125691)
Co-authored-by: Wulian <xiguawulian@gmail.com>
Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
2024-10-23 16:29:32 -04:00
Eric Snow 6f26d496d3
gh-125286: Share the Main Refchain With Legacy Interpreters (gh-125709)
They used to be shared, before 3.12.  Returning to sharing them resolves a failure on Py_TRACE_REFS builds.

Co-authored-by: Petr Viktorin <encukou@gmail.com>
2024-10-23 10:10:06 -06:00
Irit Katriel de0d5c6e2e
gh-119786: move 'changing grammar' checklist from devguide to InternalDocs (#125874) 2024-10-23 14:48:39 +01:00
Serhiy Storchaka 834ba5aaf2
gh-58032: Deprecate the argparse.FileType type converter (GH-124664) 2024-10-23 10:50:29 +03:00
Jacob Walls c75ff2ef8e
gh-80958: unittest: discovery support for namespace packages as start directory (#123820) 2024-10-23 13:41:33 +09:00
Mario Šaško 34653bba64
gh-125259: Fix error notes removal in enum initialization (GH-125647) 2024-10-22 13:42:22 -07:00
Ethan Furman aaed91cabc
gh-125710: [Enum] fix hashable<->nonhashable comparisons for member values (GH-125735) 2024-10-22 11:04:00 -07:00
Mikhail Efimov 079875e395
gh-125038: Fix crash after genexpr.gi_frame.f_locals manipulations (#125178) 2024-10-22 09:00:25 -07:00
Adam Turner 91ddde4af0
Doc: Show object descriptions in the table of contents (#125757) 2024-10-22 14:07:09 +01:00
Serhiy Storchaka 759a54d28f
gh-125355: Rewrite parse_intermixed_args() in argparse (GH-125356)
* The parser no longer changes temporarily during parsing.
* Default values are not processed twice.
* Required mutually exclusive groups containing positional arguments are
  now supported.
* The missing arguments report now includes the names of all required
  optional and positional arguments.
* Unknown options can be intermixed with positional arguments in
  parse_known_intermixed_args().
2024-10-22 10:57:25 +00:00
Mark Shannon 57e3c59bb6
GH-125521: Remove `if (true)` from generated output to reduce C compiler warnings (GH-125700) 2024-10-22 10:11:29 +01:00
Mikhail Efimov c1bdbe84c8
gh-124889: Rework Python generator cache (#125816) 2024-10-22 09:42:56 +01:00
Mikhail Efimov 4efe64aa56
gh-125811: Remove DeprecationWarnings in test_peg_generator (#125812) 2024-10-22 09:41:30 +01:00
Arjun Singh 03f9264ece
fix grammar in comment in dictobject.c (#125822) 2024-10-22 11:48:16 +09:00
Irit Katriel d0bfff47fb
gh-119786: [doc] more consistent syntax in InternalDocs (#125815) 2024-10-21 23:37:31 +01:00
Eric Snow 4848b0b92c
gh-125716: Use A Global Mutex When Initializing Global State For The _interpqueues Module (gh-125803)
This includes a drive-by cleanup in _queues_init() and _queues_fini().

This change also applies to the _interpchannels module.
2024-10-21 15:49:58 -06:00
Y5 d48cc82ed2
gh-124651: Quote template strings in `venv` activation scripts (GH-124712)
This patch properly quotes template strings in `venv` activation
scripts. This mitigates potential command injection.
2024-10-21 21:48:04 +01:00
Eric Snow 44f841f01a
gh-125716: Raise an Exception If _globals_init() Fails In the _interpqueues Module (gh-125802)
The fix applies to the _interpchannels module as well.

I've also included a drive-by typo fix for _interpqueues.
2024-10-21 19:39:07 +00:00
Serhiy Storchaka 9dde4638e4
gh-53203: Fix test_strptime on Solaris (GH-125785)
Use fixed timezone.
Skip roundtrip tests on locales with 2-digit year.
2024-10-21 22:17:39 +03:00
Serhiy Storchaka dcc4fb2c90
gh-124969: Make locale.nl_langinfo(locale.ALT_DIGITS) returning a string again (GH-125774)
This is a follow up of GH-124974. Only Glibc needed a fix.
Now the returned value is a string consisting of semicolon-separated
symbols on all Posix platforms.
2024-10-21 18:54:12 +00:00
Serhiy Storchaka 5ca4e34bc1
gh-125767: Fix pickling and copying of super objects (GH-125781)
Previously, copying a super object returned a copy of the instance
invoking super(). Pickling a super object could pickle the instance
invoking super() or fail, depending on its type and protocol.

Now deep copying returns a new super object and pickling pickles the super
object. Shallow copying returns the same super object.
2024-10-21 21:30:45 +03:00
mpage de5a6c7c7d
gh-121459: Fix a couple of uses of `PyStackRef_FromPyObjectSteal` (#125711)
* Fix usage of PyStackRef_FromPyObjectSteal in CALL_TUPLE_1

This was missed in gh-124894

* Fix usage of PyStackRef_FromPyObjectSteal in _CALL_STR_1

This was missed in gh-124894

* Regenerate code
2024-10-21 11:08:13 -07:00
Irit Katriel 695814c6e9
gh-119786: move interpreter doc from devguide to InternalDocs (#125715) 2024-10-21 18:54:24 +01:00
Sam Gross 9b0bfba2a2
gh-124218: Use per-thread reference counting for globals and builtins (#125713)
Use per-thread refcounting for the reference from function objects to
the globals and builtins dictionaries.
2024-10-21 12:51:29 -04:00
Richard Hansen d880c83ff7
Doc: C API: Move `tp_dealloc` paragraph to `tp_dealloc` section (#125737)
It looks like commit 43cf44ddcc
(gh-31501) accidentally moved the paragraph to the `tp_finalize`
section when the intent was to move it to the `tp_dealloc` section
(according to the commit message).

Also:
  * Convert the paragraph to a warning.
  * Apply the appropriate font style to `tp_dealloc`.
  * Unlinkify the first mention of `tp_dealloc` since the paragraph is
    already in the `tp_dealloc` section.
2024-10-21 09:46:37 -07:00
partev d67bf2d89a
gh-125766: Docs: minor rewording of installation on Linux section (GH-125743) 2024-10-21 16:18:10 +00:00
Tian Gao 5b7a872b26
gh-125590: Allow FrameLocalsProxy to delete and pop keys from extra locals (#125616) 2024-10-21 11:43:08 -04:00
Pablo Galindo Salgado 3d1df3d84e
gh-125703: Correctly honour tracemalloc hooks on more PyDECREF specialized paths (#125712) 2024-10-21 15:39:05 +01:00