Commit graph

15432 commits

Author SHA1 Message Date
Raymond Hettinger
c25400a4b6
Revert gh-139075. The sumprod fix needs more work. (gh-139092) 2025-09-18 02:05:27 -05:00
Raymond Hettinger
b485e50fde
gh-139074: Fix missing high precision case in sumprod() (gh-139075) 2025-09-17 16:50:15 -05:00
Stefan Tatschner
a9b6b09141
gh-86819: Add ISO-TP CAN socket constants (#23794)
Co-authored-by: Stefan Tatschner <stefan@rumpelsepp.org>
Co-authored-by: Patrick Menschel <menschel.p@posteo.de>
2025-09-17 17:18:04 +00:00
Adam Turner
4b78fe9665
GH-137630: Convert `_interpqueues` to use Argument Clinic (#137685) 2025-09-17 17:35:00 +01:00
Victor Stinner
82e1920a01
gh-129813, PEP 782: Use PyBytesWriter in _testclinic (#139048)
Replace PyBytes_FromStringAndSize(NULL, size) with the new public
PyBytesWriter API.
2025-09-17 17:55:30 +02:00
chiri
8eb106240f
gh-138736: Fix sqlite3.Connection.blobopen 'row' parameter type and naming (#138738)
The 'row' parameter represents a ROWID. Clarify this in docs and docstrings.
2025-09-17 15:51:14 +00:00
Victor Stinner
77a22ef76a
gh-129813, PEP 782: Use PyBytesWriter in _multiprocessing (#139047)
Replace PyBytes_FromStringAndSize(NULL, size) and _PyBytes_Resize()
with the new public PyBytesWriter API.

Change also 'read' variable type from int to Py_ssize_t.
2025-09-17 17:44:13 +02:00
Stan Ulbrych
64c876dd68
gh-138998: Upgrade vendored expat to 2.7.2 (#138999) 2025-09-17 13:46:35 +03:00
AN Long
6393068bde
fix some typos (#138977) 2025-09-16 18:33:39 +05:30
Stan Ulbrych
fc3e22a06c
gh-88473: Implement fast path in date.today() for date types (#130980)
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2025-09-16 10:28:54 +01:00
Victor Stinner
4554486f15
gh-129813, PEP 782: Use PyBytesWriter in bufferedio.c (#138954)
Replace PyBytes_FromStringAndSize(NULL, size) and _PyBytes_Resize()
with the new public PyBytesWriter API.
2025-09-15 21:50:09 +00:00
Victor Stinner
e814e6b38b
gh-129813, PEP 782: Use PyBytesWriter in FileIO.read() (#138955)
Replace PyBytes_FromStringAndSize(NULL, size) and _PyBytes_Resize()
with the new public PyBytesWriter API.
2025-09-15 23:49:28 +02:00
Victor Stinner
f62b495f79
gh-129813, PEP 782: Use PyBytesWriter in _sha3 (#138923)
Replace PyBytes_FromStringAndSize(NULL, size) with the new public
PyBytesWriter API.
2025-09-15 22:53:03 +02:00
Cody Maloney
71defb6943
gh-129813, PEP 782: Use PyBytesWriter in _io.FileIO.readall (#138901)
Performance about the same, using the benchmark from gh-120754:

```
pyperf compare_to main.json pep782.json
read_file_small: Mean +- std dev: [main] 5.71 us +- 0.05 us -> [pep782] 5.68 us +- 0.05 us: 1.01x faster
read_file_large: Mean +- std dev: [main] 89.7 us +- 0.9 us -> [pep782] 86.9 us +- 0.8 us: 1.03x faster
read_all_rst_bytes: Mean +- std dev: [main] 926 us +- 8 us -> [pep782] 920 us +- 12 us: 1.01x faster
read_all_rst_text: Mean +- std dev: [main] 2.24 ms +- 0.02 ms -> [pep782] 2.17 ms +- 0.04 ms: 1.03x faster

Benchmark hidden because not significant (1): read_all_py_bytes

Geometric mean: 1.01x faster
```
2025-09-15 22:38:01 +02:00
Victor Stinner
c5fb72ea6c
gh-129813, PEP 782: Use PyBytesWriter in _winapi.PeekNamedPipe() (#138930)
Replace PyBytes_FromStringAndSize(NULL, size) and _PyBytes_Resize()
with the new public PyBytesWriter API.
2025-09-15 21:25:47 +01:00
Mehdi Hassan
dfd52e7a8b
gh-97517: Add documentation links to datetime strftime/strptime docstrings (#138559)
* Add documentation links to datetime strftime/strptime docstrings

- Add links to format codes documentation for all strftime methods
- Add links to format codes documentation for all strptime methods
- Addresses issue #97517

* Update C extension docstrings with format codes documentation

* Regenerate clinic code for updated docstrings

* Add clinic-generated header file for updated docstrings

* Fix docstring spacing consistency in both Python and C files

* Update Lib/_pydatetime.py

Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>

---------

Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
2025-09-15 19:50:46 +01:00
Victor Stinner
a68efdf09c
gh-129813, PEP 782: Use PyBytesWriter in _hashopenssl (#138922)
Replace PyBytes_FromStringAndSize(NULL, size) with the new public
PyBytesWriter API.
2025-09-15 18:41:43 +02:00
Serhiy Storchaka
07d0b95b05
gh-137490: Fix signal.sigwaitinfo() on NetBSD (GH-137523)
Handle ECANCELED in the same way as EINTR to work around the Posix
violation in the NetBSD's implementation.
2025-09-15 19:20:31 +03:00
Serhiy Storchaka
a003112821
gh-138712: Add os.NODEV (GH-138728) 2025-09-15 14:36:32 +00:00
Victor Stinner
67cc1cf68a
gh-129813, PEP 782: Use PyBytesWriter in _codecs.escape_decode() (#138919)
Replace PyBytes_FromStringAndSize(NULL, size) and _PyBytes_Resize()
with the new public PyBytesWriter API.
2025-09-15 16:32:43 +02:00
Victor Stinner
21c80cadc8
gh-129813, PEP 782: Use PyBytesWriter in _curses (#138920)
Replace PyBytes_FromStringAndSize(NULL, size) and _PyBytes_Resize()
with the new public PyBytesWriter API.
2025-09-15 16:24:34 +02:00
Victor Stinner
f07ae274b8
gh-129813, PEP 782: Use PyBytesWriter in fcntl (#138921)
Replace PyBytes_FromStringAndSize(NULL, size) with the new public
PyBytesWriter API.

Don't build the fcntl with the limited C API anymore, since
the PyBytesWriter API is not part of the limited C API.
2025-09-15 16:21:43 +02:00
Serhiy Storchaka
43013f72f0
gh-138779: Use the dev_t converter for st_rdev (GH-138780)
This allows to support device numbers larger than 2**63-1.
2025-09-15 17:07:34 +03:00
Abdul
aa9ceb1721
gh-137017: Ensure Thread.is_alive() only returns False after the underlying OS thread exits (gh-137315) 2025-09-15 11:13:37 +00:00
Pablo Galindo Salgado
f01181b595
gh-138794: Communicate to PyRefTracer when they are being replaced (#138797) 2025-09-15 11:12:09 +01:00
Victor Stinner
7168e98c80
gh-129813, PEP 782: Use PyBytesWriter in lzma and zlib (#138832)
Replace PyBytes_FromStringAndSize(NULL, size) with the new public
PyBytesWriter API.
2025-09-13 19:27:04 +02:00
Victor Stinner
af386fd361
gh-129813, PEP 782: Use PyBytesWriter in posix extension (#138829)
Replace PyBytes_FromStringAndSize(NULL, size) and _PyBytes_Resize()
with the new public PyBytesWriter API.
2025-09-13 18:57:46 +02:00
Victor Stinner
bb743b684b
gh-129813, PEP 782: Use PyBytesWriter in socket and mmap (#138831)
Replace PyBytes_FromStringAndSize(NULL, size) and _PyBytes_Resize()
with the new public PyBytesWriter API.
2025-09-13 18:31:26 +02:00
Victor Stinner
06b7891f12
gh-129813, PEP 782: Use Py_GetConstant(Py_CONSTANT_EMPTY_BYTES) (#138830)
Replace PyBytes_FromStringAndSize(NULL, 0) with
Py_GetConstant(Py_CONSTANT_EMPTY_BYTES). Py_GetConstant() cannot
fail.
2025-09-13 18:30:25 +02:00
Victor Stinner
a65236bb39
gh-129813, PEP 782: Use PyBytesWriter in pickle and struct (#138833)
Replace the private _PyBytesWriter API with the new public
PyBytesWriter API.
2025-09-13 18:26:49 +02:00
Victor Stinner
ca99af3c5e
gh-129813, PEP 782: Use PyBytesWriter in binascii (#138825)
Replace the private _PyBytesWriter API with the new public
PyBytesWriter API.
2025-09-13 18:25:16 +02:00
Victor Stinner
eec8c98d06
gh-129813, PEP 782: Use PyBytesWriter in _hashopenssl (#138835)
Replace PyBytes_FromStringAndSize(NULL, size) with the new public
PyBytesWriter API.
2025-09-12 15:39:16 +02:00
Victor Stinner
c3fca5d478
gh-129813, PEP 782: Add PyBytesWriter_Format() (#138824)
Modify PyBytes_FromFormatV() to use the public PyBytesWriter API
rather than the _PyBytesWriter private API.
2025-09-12 14:21:57 +02:00
Victor Stinner
adb414044f
gh-129813, PEP 782: Add PyBytesWriter C API (#138822) 2025-09-12 13:41:59 +02:00
Peter Bierma
f96f7c9f5b
Revert "gh-116946: fully implement GC protocol for _tkinter.Tk{app,tt}Object (#138331)" (#138807)
This reverts commit 283380a941.
2025-09-11 17:05:37 -04:00
Benjamin Peterson
5bd4bf04c4
closes gh-138706: update Unicode to 17.0.0 (#138719) 2025-09-11 09:58:39 -07:00
Bénédikt Tran
283380a941
gh-116946: fully implement GC protocol for _tkinter.Tk{app,tt}Object (#138331) 2025-09-11 12:59:30 +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
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
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
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
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
Pablo Galindo Salgado
03ee060ec8
gh-138385: Sample all interpreters in the tachyon profiler (#138398) 2025-09-09 00:41:08 +01: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
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
mqudah
2f5ace780b
fix comment reference from man 7 signal to man 7 signal-safety (#138554)
docs: fix comment reference from man 7 signal to man 7 signal-safety
2025-09-06 18:40:15 +00:00
AN Long
c919d02ede
gh-138205: Remove the resize method on mmap object on platforms don't support it (#138276)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
2025-09-06 14:10:04 +05:30
Alper
8554c0917e
gh-116738: make cProfile module thread-safe (#138229)
Co-authored-by: Kumar Aditya <kumaraditya@python.org>
2025-09-06 13:19:14 +05:30
Petr Viktorin
0c74fc8af0
gh-137210: Add a struct, slot & function for checking an extension's ABI (GH-137212)
Co-authored-by: Steve Dower <steve.dower@microsoft.com>
2025-09-05 16:23:18 +02:00
Christoph Walcher
ed53c63769
gh-138401: Check arg count>=0 in os.sendfile() (#138403)
Co-authored-by: Victor Stinner <vstinner@python.org>
Co-authored-by: Kumar Aditya <kumaraditya@python.org>
2025-09-05 09:16:55 +00:00