Commit graph

127083 commits

Author SHA1 Message Date
Serhiy Storchaka
07edc0d2b2
gh-132987: Support __index__() in the posix module (GH-133096)
Support it for the dev_t values in mknod(), major(), minor() and makedev(),
CPU numbers in sched_setaffinity(), group numbers in setgroups(),
configuration name in fpathconf(), pathconf(), confstr(), and sysconf().
2025-04-29 16:14:47 +03:00
Stan Ulbrych
bba14c3e01
gh-46236: Document PyUnicodeIter_Type (GH-132925) 2025-04-29 14:23:06 +02:00
Stan Ulbrych
59ff42155a
gh-57281: Fix duplicate deprecation note: array 'u' format (#133113) 2025-04-29 13:22:15 +02:00
Petr Viktorin
0c26dbd16e
gh-133079: Remove Py_C_RECURSION_LIMIT & PyThreadState.c_recursion_remaining (GH-133080)
Both were added in 3.13, are undocumented, and don't make sense in 3.14 due to
changes in the stack overflow detection machinery (gh-112282).

PEP 387 exception for skipping a deprecation period: https://github.com/python/steering-council/issues/288
2025-04-29 12:56:20 +02:00
Adam Turner
208d06fd51
gh-132930: Fix use of ALIAS_WPREFIX in pymanager builds (GH-133120) 2025-04-29 08:53:43 +00:00
Adam Turner
4d54e9cdf6
GH-132930: Display 'free-threaded' in pymanager builds (GH-133119) 2025-04-29 09:28:04 +01:00
Mark Shannon
622300bdfa
GH-132554: Add stats for GET_ITER (GH-132592)
* Add stats for GET_ITER

* Look for common iterable types, not iterator types

* Add stats for self iter and fix naming in summary
2025-04-29 09:00:14 +01:00
sobolevn
01f11a0e4e
Run mypy workflow on _colorize.py and Misc/mypy/** changes (#133116)
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2025-04-29 07:53:12 +00:00
Neil Schemenauer
eecafc3380
Revert gh-127266: avoid data races when updating type slots (gh-131174) (gh-133129)
This is triggering deadlocks in test_opcache.  See GH-133130 for stack trace.
2025-04-28 23:38:29 -07:00
Raymond Hettinger
219b1f9d1d
gh-132893: Minor edits to the statistics module PR (gh-133106) 2025-04-28 23:05:37 -05:00
Eric Snow
219d8d24b5
gh-87859: Track Code Object Local Kinds For Arguments (gh-132980)
Doing this was always the intention. I was finally motivated to find the time to do it.

See #87859 (comment).
2025-04-29 02:21:47 +00:00
Eric Snow
96a7fb93a8
gh-132775: Add _PyCode_ReturnsOnlyNone() (gh-132981)
The function indicates whether or not the function has a return statement.

This is used by a later change related treating some functions like scripts.
2025-04-28 20:12:52 -06:00
Donghee Na
75cbb8d89e
gh-132070: Use _PyObject_IsUniquelyReferenced in unicodeobject (gh-133039)
---------

Co-authored-by: Kumar Aditya <kumaraditya@python.org>
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2025-04-29 09:48:53 +09:00
Eric Snow
bdd23c0bb9
gh-132775: Add _PyMarshal_GetXIData() (gh-133108)
Note that the bulk of this change is tests.
2025-04-28 17:23:46 -06:00
Neil Schemenauer
68a737691b
gh-125142: add REPL help text for keyboard shortcuts (gh-125143) 2025-04-28 14:17:34 -07:00
Neil Schemenauer
31a500a92b
Add internal docs about the free-threaded GC. (gh-132562) 2025-04-28 13:32:39 -07:00
Neil Schemenauer
e414a2d81c
gh-127266: avoid data races when updating type slots (gh-131174)
In the free-threaded build, avoid data races caused by updating type slots
or type flags after the type was initially created.  For those (typically
rare) cases, use the stop-the-world mechanism.  Remove the use of atomics
when reading or writing type flags.  The use of atomics is not sufficient to
avoid races (since flags are sometimes read without a lock and without
atomics) and are no longer required.
2025-04-28 20:28:44 +00:00
Neil Schemenauer
22f0730d40
gh-122320: Limit dict key versions used by test_opcache. (gh-132961)
The `test_load_global_module()` test consumes a lot of dict key versions.
Skip the test if we have consumed half of the available versions that can be
used for the "load global" cache.
2025-04-28 12:54:55 -07:00
Barney Gale
336322b341
GH-128520: pathlib ABCs tests: use explicit text encoding (#133105)
Follow-up to fbffd70. Set `encoding='utf-8'` when reading and writing text
in the tests for the private pathlib ABCs, which allows the tests to run
with `-W error -X warn_default_encoding`
2025-04-28 20:18:56 +01:00
Eric Snow
606003ffa9
gh-132775: Add _PyBytes_GetXIData() (gh-133101)
This is the base for several other XIData wrappers, like pickle and marshal. It is essentially a refactor of the existing bytes XIData code.
2025-04-28 12:52:36 -06:00
Neil Schemenauer
31d1342de9
gh-132942: Fix races in type lookup cache (gh-133032)
Two races related to the type lookup cache, when used in the
free-threaded build.  This caused test_opcache to sometimes fail (as
well as other hard to re-produce failures).
2025-04-28 11:52:08 -07:00
Eric Snow
fe462f5a91
gh-132775: Drop PyUnstable_InterpreterState_GetMainModule() (gh-132978)
We replace it with _Py_GetMainModule(), and add _Py_CheckMainModule(), but both in the internal-only C-API.  We also add _PyImport_GetModulesRef(), which is the equivalent of _PyImport_GetModules(), but which increfs before the lock is released.

This is used by a later change related to pickle and handling __main__.
2025-04-28 12:46:22 -06:00
Eric Snow
c17238251f
gh-132775: Add _PyModule_GetFilenameObject() and _PyModule_GetFilenameUTF8() (gh-132979)
They are derived from the existing `PyModule_GetFilenameObject().

They are used by a later change related to pickle and handling __main__.
2025-04-28 12:41:32 -06:00
Serhiy Storchaka
25186c2472
gh-132742: Fix newly added tcflush() tests on Android (GH-133070) 2025-04-28 21:41:09 +03:00
Steve Dower
3940e1f873
gh-132930: Improve the names of IDLE and PyDoc shortcuts (GH-133091) 2025-04-28 19:09:20 +01:00
Barney Gale
fbffd70328
GH-128520: pathlib ABCs: raise text encoding warnings at correct stack level (#133051)
Ensure that warnings about unspecified text encodings are emitted from
`ReadablePath.read_text()`, `WritablePath.write_text()` and `magic_open()`
with the correct stack level set.
2025-04-28 19:04:20 +01:00
Eric Snow
6f04325992
gh-132775: Cleanup Related to crossinterp.c Before Further Changes (gh-132974)
This change consists of adding tests and moving code around, with some renaming thrown in.
2025-04-28 11:55:15 -06:00
sobolevn
b739ec5ab7
gh-133054: Skip test_pyrepl tests when cannot use pyrepl is reported (#133055)
Co-authored-by: Tomas R. <tomas.roun8@gmail.com>
2025-04-28 19:09:28 +03:00
Jelle Zijlstra
58567cc18c
gh-132952: Speed up startup by importing _io instead of io (#132957) 2025-04-28 08:38:56 -07:00
Jelle Zijlstra
7f16f1bc11
typing, annotationlib: clean tests (#133087)
- Add @cpython_only decorator to lazy import tests
- Rename reference to SOURCE format
- Always two newlines between test case classes
- Merge two classes of ForwardRef tests
- Use get_annotations instead of annotationlib.get_annotations
- Format test_annotationlib with Black (not expecting that we'll keep this up
  but it's close to Black-formatted right now)
2025-04-28 08:38:11 -07:00
Hugo van Kemenade
4cec0b510b
gh-129965: Add more missing MIME types (#132845) 2025-04-28 15:30:35 +00:00
Serhiy Storchaka
c2eaeee3dc
gh-132915: Try to detect a buffer overflow in fcntl() and ioctl() (GH-132919)
SystemError is raised when buffer overflow is detected.
The stack and memory can already be corrupted, so treat this error as fatal.
2025-04-28 17:56:10 +03:00
Semyon Moroz
0f84f6b334
gh-132726: Change the heading of sysconfig CLI section (#133035) 2025-04-28 17:44:49 +03:00
Hugo van Kemenade
ee9102a535
gh-75223: Deprecate undotted extensions in mimetypes.MimeTypes.add_type (#128638)
Co-authored-by: Petr Viktorin <encukou@gmail.com>
Co-authored-by: Daniel Watkins <daniel@daniel-watkins.co.uk>
Co-authored-by: Oleg Iarygin <oleg@arhadthedev.net>
2025-04-28 14:23:57 +00:00
Victor Stinner
fe8ad53443
gh-132983: Convert compression._common to a package (#133086)
Add an "__init__.py" file. Fix test_tools.test_freeze.
2025-04-28 14:13:06 +00:00
Bénédikt Tran
a99bfaa53c
gh-133073: avoid NULL + 0 arithmetic in list_extend_* functions (#133074) 2025-04-28 15:59:09 +02:00
Petr Viktorin
4ebbfcf30e
gh-87135: Raise PythonFinalizationError when joining a blocked daemon thread (gh-130402)
If `Py_IsFinalizing()` is true, non-daemon threads (other than the current one)
are done, and daemon threads are prevented from running, so they
cannot finalize themselves and become done. Joining them (without timeout)
would block forever.

Raise PythonFinalizationError instead of hanging.

Raise even when a timeout is given, for consistency with trying to join your own thread.

See gh-123940 for a use case: calling `join()` from `__del__`. This is
ill-advised, but an exception should at least make it easier to diagnose.
2025-04-28 15:48:48 +02:00
Wulian233
995b1a72f2
Fixed a typo in the PCbuild/readme.txt about PGO clang-cl (#133083)
Fixed a typo in the readme.txt section about PGO clang-cl
2025-04-28 13:39:16 +00:00
Sergey B Kirpichev
6157135a8d
gh-130317: Fix PyFloat_Pack/Unpack[24] for NaN's with payload (#130452)
Co-authored-by: Victor Stinner <vstinner@python.org>
2025-04-28 15:23:26 +02:00
Jelle Zijlstra
922049b613
gh-130907: Treat all module-level annotations as conditional (#131550) 2025-04-28 06:10:28 -07:00
Sergey B Kirpichev
5bf0f3666e
gh-53032: support IEEE 754 contexts in the decimal module (#122003)
This was in C version from beginning, but available only
on conditional compilation (EXTRA_FUNCTIONALITY).  Current
patch adds function to create IEEE contexts to the
pure-python module as well.

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2025-04-28 15:05:56 +02:00
Steve Dower
e20ca6d1b0
gh-132930: Implement PEP 773 (GH-132931)
This change to the core CPython repo:
* Adds PyManager support to PC/layout
* Adds a warning message to the legacy py.exe if subcommands are invoked
* Add deprecation message to traditional installer
* Updates using/windows docs
2025-04-28 13:57:47 +01:00
Chris Eibl
11f457cf41
GH-114911: use time.perf_counter in Stopwatch (GH-131469)
Co-authored-by: Petr Viktorin <encukou@gmail.com>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2025-04-28 13:55:08 +02:00
Bénédikt Tran
e577439803
gh-131423: update note in Tools/ssl/make_ssl_data.py (#133077) 2025-04-28 11:11:46 +00:00
Bénédikt Tran
96bc1721d2
gh-111178: fix incorrect function signatures for Windows builds (#133072) 2025-04-28 13:05:39 +02:00
Yuki Kobayashi
4e04511cb9
gh-133033: Add docs for TypeIgnore (#133034)
Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
2025-04-28 13:49:07 +03:00
Bénédikt Tran
af3f6fcb7e
gh-127604: ensure -ldl is passed only once to the linker (#133071) 2025-04-28 11:55:02 +02:00
Serhiy Storchaka
6677c2c165
gh-132987: Support __index__() for unsigned integers in Argument Clinic (GH-133011) 2025-04-28 11:02:18 +03:00
Serhiy Storchaka
ed8e886f4f
gh-132742: Improve tests for fcntl.ioctl() (GH-132791)
* Use better tests for integer argument.
* Add also parallel tests for tcflush() and tcflow().
2025-04-28 10:42:40 +03:00
Emma Smith
632978f005
gh-132983: Install compression package contents (#133063)
Include compression package contents as part of installs.
2025-04-28 14:44:20 +08:00