Commit Graph

128337 Commits

Author SHA1 Message Date
Peter Bierma
1da989be74 gh-138479: Ensure that __typing_subst__ returns a tuple (GH-138482)
Raise an exception if __typing_subst__ returns a non-tuple object.

---------

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2025-09-11 06:39:09 -04:00
Sergey B Kirpichev
011179a79a gh-71810: Fix corner case (length==0) for int.to_bytes() (#138739)
```pycon
>>> (0).to_bytes(0, 'big', signed=True)
b''
>>> (-1).to_bytes(0, 'big', signed=True)  # was b''
Traceback (most recent call last):
  File "<python-input-0>", line 1, in <module>
    (-1).to_bytes(0, 'big', signed=True)
    ~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
OverflowError: int too big to convert
```

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2025-09-11 12:30:53 +02:00
yihong
a1707e4516 gh-138081: fix some dead links in InternalDocs (#138082) 2025-09-11 10:54:16 +02:00
Bénédikt Tran
4978bfca10 gh-116946: add Py_TPFLAGS_IMMUTABLETYPE to several internal types (#138582)
The following types are now immutable:

* `_curses_panel.panel`,
* `[posix,nt].ScandirIterator`, `[posix,nt].DirEntry` (exposed in `os.py`),
* `_remote_debugging.RemoteUnwinder`,
* `_tkinter.Tcl_Obj`, `_tkinter.tkapp`, `_tkinter.tktimertoken`,
* `zlib.Compress`, and `zlib.Decompress`.
2025-09-11 09:56:20 +02:00
Stephen Morton
859aecc33b gh-138432: Improved invalid path checking in zoneinfo.reset_tzpath() (GH-138433)
* Improve error messages for path-like relative paths and path-like bytes paths.
* TZPATH is now always a tuple of strings.
2025-09-11 10:08:53 +03:00
Adam Turner
d0c9943869 GH-138562: Remove `sort()` from the common sequence methods in the data model (#138563) 2025-09-10 15:52:57 +00:00
Hugo van Kemenade
6e78a539bf gh-138744: GitHub Actions: pin to windows-2022 (#138743) 2025-09-10 17:28:27 +03:00
Jelle Zijlstra
7a6fd4a45d gh-138349: Fix crash when combining module-level annotation and listcomp (#138363) 2025-09-10 15:18:39 +02:00
sobolevn
f5fa336579 gh-138729: Cover inspect.formatannotationrelativeto with tests (#138730) 2025-09-10 16:06:16 +03:00
sobolevn
cf8f36fe0a gh-138716: Fix assert a := b syntax error message (#138718) 2025-09-10 16:05:16 +03:00
Dung Nguyen
1ce05537a3 gh-138008: Fix segfaults in _ctypes due to invalid argtypes (GH-138285)
Signed-off-by: Nguyen Viet Dung <29406816+magnified103@users.noreply.github.com>
Signed-off-by: Nguyen Viet Dung <dung@ekluster.com>
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Co-authored-by: Yongzi Li <204532581+Yzi-Li@users.noreply.github.com>
2025-09-10 14:01:19 +02:00
Bénédikt Tran
d54b1091d4 gh-136006: fix Py_NAN expansion on Solaris systems (#136575)
On Solaris, `Py_NAN` may expand as a function address instead of a floating-point number.
This amends commit 7a3b03509e.
2025-09-10 11:11:04 +02:00
Bénédikt Tran
b9c50b4988 gh-134531: use EVP_MAC API for _hashlib.HMAC when possible (#135235)
Use `EVP_MAC` API for HMAC on builds with OpenSSL 3.0 or later.
2025-09-10 10:35:01 +02:00
Bénédikt Tran
d6d054853d gh-137371: refactor and fortify test.support.hashlib_helper (#137375) 2025-09-10 09:14:38 +02:00
Dino Viehland
04c7f36205 gh-138230: Remove dead code in code gen - codegen_check_annotation is only calle… (#138228)
Remove dead code in code gen - codegen_check_annotation is only called if future annotations are enabled, and if future annotations are enabled it does nothing.
2025-09-09 18:17:00 -07:00
Pablo Galindo Salgado
766e7f150a gh-135953: Fix refleak in cache method (#138721) 2025-09-10 00:08:09 +00:00
László Kiss Kollár
137519a38c gh-135953: Add flamegraph reporter to sampling profiler (#138715) 2025-09-09 23:06:45 +01:00
sobolevn
6bc65c30ff gh-136616: Improve assert syntax error messages (#136653) 2025-09-09 23:26:22 +03:00
Samuel Sloniker
66ef16105a gh-85076: Document exceptions that can be raised by importlib.import_module (GH-94662) 2025-09-09 12:52:00 -07:00
Serhiy Storchaka
af58a6f883 gh-88886: Remove excessive encoding name normalization (GH-137167)
The codecs lookup function now performs only minimal normalization of
the encoding name before passing it to the search functions:
all ASCII letters are converted to lower case, spaces are replaced
with hyphens.

Excessive normalization broke third-party codecs providers, like
python-iconv.

Revert "bpo-37751: Fix codecs.lookup() normalization (GH-15092)"

This reverts commit 20f59fe1f7.
2025-09-09 21:07:21 +03:00
Victor Stinner
6b7b9d00a9 gh-138535: Pass directly state to posix fill_time() (#138693)
Pass directly the module state instead of passing the module to avoid
a call to get_posix_state().
2025-09-09 16:31:13 +02:00
Petr Viktorin
a92aec101e gh-133143: Use _Py_ID for the other literals in sys (GH-138698)
Follow-up refactoring after GH-133143, where we use `_Py_ID` for "big" and "little"
in `abi_info.byteorder`.
This uses `_Py_ID` for `sys.byteorder`, but also `float_repr_style` and a module name.
2025-09-09 14:57:07 +02:00
yagggi
074f3b20b3 gh-138577: Mention Unix-specific limitations of getpass.getpass(echo_char=...) (#138677)
In bf8bbe9a81, `getpass.getpass` gained
the ability to provide keyboard feedback through `echo_char`.

On Unix, line editing shortcuts such as Ctrl+U were previously handled
as the terminal operates in canonical mode (see termios(3)). However,
since keyboard feedback requires to switch to noncanonical mode, this
now results in an inconsistency when `getpass.getpass` uses `echo_char`
as those shortcuts are no more supported. This limitation is specific
to Unix and does not affect Windows users where line editing shortcuts
were never supported.
2025-09-09 11:41:13 +02:00
Sergey B Kirpichev
fd2e3d1633 Add impl-detail block for PyLong_FromLong docs (#126422)
Co-authored-by: Brian Schubert <brianm.schubert@gmail.com>
2025-09-09 11:22:40 +02:00
Jeffrey Bosboom
d4825ac27c gh-138535: Optimize fill_time for typical timestamps (#138537)
While file timestamps can be anything the file system can store, most
lie between the recent past and the near future.  Optimize fill_time()
for typical timestamps in three ways:

- When possible, convert to nanoseconds with C arithmetic.
- When using C arithmetic and the seconds member is not required (for
  st_birthtime), avoid creating a long object.
- When using C arithmetic, reorder the code to avoid the null checks
  implied in Py_XDECREF().

Co-authored-by: Victor Stinner <vstinner@python.org>
2025-09-09 11:05:54 +02:00
Donghee Na
5edfe55acf gh-137838: Fix JIT trace buffer overrun by increasing possible exit stubs (gh-138177) 2025-09-09 09:51:08 +09:00
Pablo Galindo Salgado
03ee060ec8 gh-138385: Sample all interpreters in the tachyon profiler (#138398) 2025-09-09 00:41:08 +01:00
Victor Stinner
01895d233b gh-137242: Add a --no-randomize option, and use it in Android CI (#138649)
Adds a --no-randomize option to the CI runner, so that randomisation can be easily
disabled for --fast-ci and --slow-ci configurations on single-threaded testing platforms
like Android, iOS, and Emscripten.

---------

Co-authored-by: Malcolm Smith <smith@chaquo.com>
2025-09-09 06:45:42 +08:00
Adam Turner
22cb9ba8f9 GH-101100: Remove some entries from `nitpick_ignore` (#138464) 2025-09-08 22:10:26 +00:00
Dino Viehland
1561385863 gh-138679: Opcodes which consume no inputs should indicate they produced the val… (#138678)
Opcodes which consume no inputs should indicate they produced the value, not an arbitrary local
2025-09-08 13:53:12 -07:00
Adam Turner
6831634eb7 gh-101100: Resolve reference warnings in reference/ (#138418) 2025-09-08 19:31:24 +00:00
Adam Turner
5443b9e52f gh-133143: Condense the implementation for `sys.abi_info` (#138672) 2025-09-08 19:21:28 +00:00
Bénédikt Tran
49b351e832 gh-133879: Improve consistency of full stops and whitespace in What's New (#138635) 2025-09-08 20:12:03 +01:00
Bruce Merry
7d435cfde6 gh-136234: Fix SelectorSocketTransport.writelines to be robust to connection loss (#136743) 2025-09-08 21:39:52 +05:30
Shamil
c6f8b2fdb1 gh-138665: Move platform.invalidate_caches docs (#138667) 2025-09-08 17:20:46 +02:00
Klaus Zimmermann
1acb718ea2 gh-133143: Add sys.abi_info (GH-137476)
This makes information about the interpreter ABI more accessible.

Co-authored-by: Petr Viktorin <encukou@gmail.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2025-09-08 14:35:44 +00:00
Aalaap Dey
c006a623e7 gh-138659: Typo in the gc module docstring (#138660)
docs(gc): fix typo in get_threshold() docstring

Removes a duplicate "the" from the docstring for the `gc.get_threshold()` function.
2025-09-08 14:16:33 +00:00
sobolevn
4f0c267b40 gh-138644: Update c-api docs of PyInterpreterState about PEP-684 (#138651)
Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
2025-09-08 16:44:44 +03:00
Christoph Walcher
59edf12705 gh-57911: Fix failing symlink test in tarfile (GH-138626) 2025-09-08 15:42:54 +02:00
yihong
7a3bca50e0 gh-138318, PyREPL: builtins should not be highlighted when used as attribute names (#138319) 2025-09-08 14:04:22 +01:00
Adorilson Bezerra
921f61bd82 Doc: Apply keyword role around finally (in sys module doc) (GH-138544) 2025-09-08 14:02:36 +02:00
Bénédikt Tran
4ef51fa75c gh-138633: fix Sphinx references in ssl documentation (#138648) 2025-09-08 11:31:40 +00:00
Petr Viktorin
097c563e7b gh-137210: Move PYTHON_API_VERSION & PYTHON_ABI_VERSION to patchlevel.h (GH-138545)
Move PYTHON_API_VERSION & PYTHON_ABI_VERSION to patchlevel.h

This allows removing #include "modsupport.h" from python_ver_rc.h,
which allows modsupport.h to use common helpers from Python.h --
specifically, `_Py_PACK_VERSION` for defining limited API.
2025-09-08 12:02:13 +02:00
Bénédikt Tran
3255c0c870 gh-138633: synchronize documented signatures of SSL objects with runtime ones (#138639) 2025-09-08 09:28:10 +00:00
Adam Turner
057ee17410 gh-136264: Fix `--relative-paths` for PEP 739's build-details.json (#138510)
* KeyError is not raised for defaultdict
* Fix relative paths on different drives on Windows
* Add a round-trip test

Co-authored-by: Itamar Oren <itamarost@gmail.com>
2025-09-08 10:14:05 +01:00
Ron Frederick
6401823db3 gh-138252: Add support in SSL module for getting and setting TLS signature algorithms (#138269)
The signature algorithms allowed for certificate-based client authentication or
for the server to complete the TLS handshake can be defined on a SSL context via
`ctx.set_client_sigalgs()` and `ctx.set_server_sigalgs()`.

With OpenSSL 3.4 or later, the list of available TLS algorithms can be retrieved
by `ssl.get_sigalgs()`.

With OpenSSL 3.5 or later, the selected signature algorithms can be retrieved from
SSL sockets via `socket.client_sigalg()` and `socket.server_sigalg()`.

This commit also partially amends 377b787618
by using `PyUnicode_DecodeFSDefault` instead of `PyUnicode_DecodeASCII` in
`_ssl._SSLContext.get_groups`, so that functions consistently decode strings
obtained from OpenSSL.

---------

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2025-09-08 08:36:12 +00:00
Adam Turner
919c7e806e GH-123299: Copyedit 3.14 What's New: Build Changes (#138488) 2025-09-08 10:09:45 +03:00
sobolevn
b0420b505e gh-105487: Fix __dir__ entries of GenericAlias (#138578)
Co-authored-by: Emma Smith <emma@emmatyping.dev>
2025-09-08 00:33:24 +03:00
dbXD320
d7b9ea5cab gh-138584: Increase test coverage for collections.UserList (#138590)
Some common tests in `test.list_tests.CommonTest` explicitly tested `list`
instead of testing the underlying list-like type defined in `type2test`.

---------

Co-authored-by: Devansh Baghla <devanshbaghla34@gmail.com>
2025-09-07 10:53:22 +02:00
Emma Smith
4ed046c481 Add Emma Smith to CODEOWNERS (#138588)
Added myself as a code owner for build system files, WASM platform files, and compression.zstd files.
2025-09-07 01:11:19 -07:00