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
Serhiy Storchaka
482fd0c811
gh-60462: Fix locale.strxfrm() on Solaris (GH-138242)
...
It should interpret the result of wcsxfrm() as a sequence of abstract
integers, not a sequence of Unicode code points or using other encoding
scheme that does not preserve ordering.
2025-09-03 15:49:28 +03:00
Serhiy Storchaka
7274d07607
gh-78502: Add a trackfd parameter to mmap.mmap() on Windows (GH-138238)
...
If trackfd is False, the file handle corresponding to fileno
will not be duplicated.
2025-09-03 11:31:34 +03:00
Serhiy Storchaka
4a33077fdb
gh-138264: Fix gcc 14 compiler warnings (GH-138265)
2025-09-03 11:26:56 +03:00
Bénédikt Tran
572df47840
gh-116946: fully implement GC protocol for _curses_panel.panel ( #138333 )
...
This commit fixes possible reference loops via `panel.set_userptr`
by implementing `tp_clear` and `tp_traverse` for panel objects.
2025-09-03 10:17:17 +02:00
Bénédikt Tran
51244ba16a
gh-116946: add Py_TPFLAGS_IMMUTABLETYPE to _random.Random ( #138341 )
2025-09-03 09:55:53 +02:00
Adam Turner
98b4cd6fe9
GH-135763: AC: Use `Py_ssize_t(allow_negative=False)` ( #138394 )
2025-09-02 21:29:05 +01:00
Zackery Spytz
32032ee376
gh-87595: Support mmap.size() for anonymous mapping on Unix (GH-24781)
...
Previously, the size would be returned on Windows and an OSError would
be raised on Unix.
Also, raise ValueError instead of OSError for trackfd=False.
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2025-09-02 23:24:06 +03:00
Bénédikt Tran
3ff00c76c9
gh-116946: add Py_TPFLAGS_IMMUTABLETYPE to select.poll and select.epoll ( #138340 )
2025-09-02 17:53:44 +00:00
Serhiy Storchaka
33fcb0c4a0
gh-138204: Forbid expansion of a shared anonymous mmap on Linux (GH-138220)
...
This is a Linux kernel bug which caused a bus error.
https://bugzilla.kernel.org/show_bug.cgi?id=8691
2025-09-02 19:00:39 +03:00
jadonduff
c19db1d2b8
gh-138004: Fix setting a thread name on OpenIndiana (GH-138017)
...
Encode Solaris/Illumos thread names to ASCII, since
OpenIndiana does not support non-ASCII names.
Add tests for setting non-ASCII name for the main thread.
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2025-09-02 15:26:25 +00:00
Christoph Walcher
47bc10e6b3
gh-135763: AC: Implement `allow_negative for Py_ssize_t` ( #138150 )
...
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2025-09-01 22:55:22 +01:00
Victor Stinner
aec006be97
gh-135755: Make Py_MAX_SCRIPT_PATH_SIZE private ( #138350 )
2025-09-01 20:01:01 +01:00
Peter Bierma
4f6ecd10c2
gh-138342: Use a common utility for visiting an object's type (GH-138343)
...
Add `_PyObject_VisitType` in place of `tp_traverse` functions that only visit the object's type.
2025-09-01 16:20:33 +00:00
Bénédikt Tran
c9b252c2c0
gh-116946: Revert GC protocol for immutable empty heap types (GH-138266, GH-138288, GH-138289) ( #138338 )
...
* Revert "gh-116946: fully implement GC protocol for `bz2` objects (#138266 )"
This reverts commit 9be91f6a20 .
* Revert "gh-116946: fully implement GC protocol for `lzma` objects (#138288 )"
This reverts commit 3ea16f990f .
* Revert "gh-116946: fully implement GC protocol for `_hashlib` objects (#138289 )"
This reverts commit 6f1dd9551a .
2025-09-01 21:15:11 +05:30
Bénédikt Tran
2a54acf3c3
gh-116946: fully implement GC protocol for zlib objects ( #138290 )
2025-09-01 10:24:23 +02:00
Bénédikt Tran
6f1dd9551a
gh-116946: fully implement GC protocol for _hashlib objects ( #138289 )
2025-09-01 10:23:01 +02:00
Bénédikt Tran
3ea16f990f
gh-116946: fully implement GC protocol for lzma objects ( #138288 )
2025-09-01 10:22:43 +02:00
Bénédikt Tran
9be91f6a20
gh-116946: fully implement GC protocol for bz2 objects ( #138266 )
2025-09-01 10:21:39 +02:00
Pieter Eendebak
43573028c6
gh-116738: Make _json module thread-safe in the free-threading ( #119438 )
...
Co-authored-by: Kumar Aditya <kumaraditya@python.org>
2025-08-31 09:42:45 +05:30
Ron Frederick
bacb7771fb
gh-137197: Add SSLContext.set_ciphersuites to set TLSv1.3 ciphers ( #137198 )
...
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2025-08-30 09:32:11 +00:00
Sergey B Kirpichev
ef4dd1d655
gh-73487: Convert _decimal to use Argument Clinic (part 6) (GH-138015)
2025-08-28 12:36:00 +02:00
Jakub Kulík
bbcb75c986
bpo-41839: Fix error checking in sched_get_priority_ functions (GH-22374)
2025-08-27 20:41:14 +03:00
Rani Pinchuk
fd8f42d3d1
gh-135427: Fix DeprecationWarning for os.fork when run in threads with -Werror (GH-136796)
...
Don't ignore errors raised by `PyErr_WarnFormat` in `warn_about_fork_with_threads`
Instead, ignore the warnings in all test code that forks. (That's a lot of functions.)
In `test_support`, make `ignore_warnings` a context manager (as well as decorator),
and add a `message` argument to it.
Also add a `ignore_fork_in_thread_deprecation_warnings` helper for the deadlock-in-fork
warning.
2025-08-26 15:33:21 +02:00
Serhiy Storchaka
aa1dbd4dde
gh-137986: Fix and improve the csv functions docstrings (GH-137987)
...
The csv.register_dialect() docstring no longer imply that it returns a
dialect.
All functions have now signatures.
Co-authored-by: maurycy <5383+maurycy@users.noreply.github.com>
2025-08-24 11:13:31 +03:00
Bénédikt Tran
e545bae55a
gh-134531: simplify code for computing HMAC digests ( #138046 )
2025-08-22 09:19:04 +00:00
vict-Yang
ce70a57bc0
gh-137920: Fix semantically relevant typo in curses.window.attron ( #137940 )
2025-08-22 10:27:02 +02:00