Commit graph

30775 commits

Author SHA1 Message Date
Ram Vikram Singh
b3b0cef0c2
gh-100305: Deemphasize that ast.literal_eval is safe in eval documentation (#100326)
Co-authored-by: Éric <merwok@netwok.org>
2026-04-12 03:07:42 +00:00
WYSIATI
22290ed011
gh-147965: Add shutdown() to multiprocessing.Queue excluded methods (GH-147970)
The multiprocessing.Queue documentation states it implements all
methods of queue.Queue except task_done() and join(). Since
queue.Queue.shutdown() was added in Python 3.13,
multiprocessing.Queue also does not implement it. Update the docs
to include shutdown() in the list of excluded methods.
2026-04-11 17:46:06 -07:00
Gregory P. Smith
64afa947f4
gh-146302: make Py_IsInitialized() thread-safe and reflect true init completion (GH-146303)
## Summary

- Move the `runtime->initialized = 1` store from before `site.py` import to the end of `init_interp_main()`, so `Py_IsInitialized()` only returns true after initialization has fully completed
- Access `initialized` and `core_initialized` through new inline accessors using acquire/release atomics, to also protect from data race undefined behavior
- `PySys_AddAuditHook()` now uses the accessor, so with the flag move it correctly skips audit hook invocation during all init phases (matching the documented "after runtime initialization" behavior) ... We could argue that running these earlier would be good even if the intent was never explicitly expressed, but that'd be its own issue.

## Motivation

`Py_IsInitialized()` returned 1 while `Py_InitializeEx()` was still running — specifically, before `site.py` had been imported. See https://github.com/PyO3/pyo3/issues/5900 where a second thread could acquire the GIL and start executing Python with an incomplete `sys.path` because `site.py` hadn't finished.

The flag was also a plain `int` with no atomic operations, making concurrent reads a C-standard data race, though unlikely to manifest.

## Regression test:

The added test properly fails on `main` with `ERROR: Py_IsInitialized() was true during site import`.

---

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-11 21:54:23 +00:00
Jonathan Dung
d7c9f1877c
gh-148320: document that import sys.monitoring raises ModuleNotFoundError (#148365)
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2026-04-11 17:22:48 +02:00
Kumar Aditya
dd88e77fad
gh-142518: add thread safety docs for set C-APIs (#146562)
Co-authored-by: Victor Stinner <vstinner@python.org>
2026-04-10 19:33:24 +00:00
Ken Jin
c4d95124b1
gh-139038: Credit more people for JIT in 3.15 (GH-148359) 2026-04-11 02:59:18 +08:00
Lysandros Nikolaou
15d10a8243
gh-142518: annotate dict C-APIs for thread safety (#145875) 2026-04-10 18:41:12 +00:00
Ken Jin
e007631e99
gh-148284: Block inlining of gigantic functions in ceval.c for clang 22 (GH-148334)
Co-authored-by: Victor Stinner <vstinner@python.org>
2026-04-11 00:52:23 +08:00
Stan Ulbrych
70b86e7829
gh-148337: Document importlib.resources security model (#148340) 2026-04-10 17:02:22 +01:00
Stan Ulbrych
1b691564a7
Remove dead links to pkg_resources in importlib docs (#148344) 2026-04-10 17:02:00 +01:00
Hugo van Kemenade
fc5df4d723
Fix mixed line endings with pre-commit (#148336)
Co-authored-by: Zachary Ware <zachary.ware@gmail.com>
2026-04-10 18:33:11 +03:00
Manoj K M
2acb8d9257
gh-148091: clarify asyncio.Future.cancel(msg) behaviour (#148248) 2026-04-09 19:41:31 +05:30
Adorilson Bezerra
d11e9ff8ca
gh-106318: Add example for str.swapcase() method (#144575) 2026-04-09 16:33:31 +03:00
Victor Stinner
8c524503cd
gh-148250: Mention str subclasses in PyUnicodeWriter_WriteStr() doc (#148251) 2026-04-09 13:53:10 +02:00
WYSIATI
8000a9de3c
gh-146646: Document that glob functions suppress OSError (#147996) 2026-04-09 12:44:24 +02:00
Michiel W. Beijen
eab7dbda3b
gh-148257: move wave whatsnew to correct section (#148262) 2026-04-08 20:53:33 +03:00
Raymond Hettinger
096212d3c0
Minor edit: Four space indent in example (#148264) 2026-04-08 12:48:54 -05:00
Hugo van Kemenade
8687b9d731
gh-146609: Add colour to timeit CLI output (#146610)
Co-authored-by: Stan Ulbrych <stan@python.org>
2026-04-08 16:18:53 +03:00
Hugo van Kemenade
2c8f26cf5c
gh-146292: Add colour to http.server logs (GH-146293)
Co-authored-by: Brian Schubert <brianm.schubert@gmail.com>
2026-04-08 14:10:05 +02:00
Petr Viktorin
8923ca418c
gh-145921: Add "_DuringGC" functions for tp_traverse (GH-145925)
There are newly documented restrictions on tp_traverse:

    The traversal function must not have any side effects.
    It must not modify the reference counts of any Python
    objects nor create or destroy any Python objects.

* Add several functions that are guaranteed side-effect-free,
  with a _DuringGC suffix.
* Use these in ctypes
* Consolidate tp_traverse docs in gcsupport.rst, moving unique
  content from typeobj.rst there

Co-authored-by: Lysandros Nikolaou <lisandrosnik@gmail.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
2026-04-08 09:15:11 +02:00
Kumar Aditya
03d712e9ba
gh-142518: add thread safety annotations for tuple C-API (#148012) 2026-04-08 01:55:44 +05:30
Hugo van Kemenade
d518f15ea4 Merge branch 'main' of https://github.com/python/cpython 2026-04-07 20:34:01 +03:00
Victor Stinner
feee573f36
gh-148014: Accept a function name in -X presite option (#148015) 2026-04-07 14:05:39 +00:00
Hugo van Kemenade
55ea59e7dc Python 3.15.0a8 2026-04-07 14:24:03 +03:00
Petr Viktorin
cf59bf7647
gh-146121: Clarify security model of pkgutil.getdata; revert checks (GH-148197)
This reverts commit bcdf231946,
and clarifies get_data's security model.


Co-authored-by: Stan Ulbrych <stan@python.org>
2026-04-07 11:39:50 +02:00
Semyon Moroz
132abfd135
gh-112632: Add optional keyword-only argument expand to pprint (#136964)
Co-authored-by: stodoran <stefan.todoran@uipath.com>
Co-authored-by: StefanTodoran <stefan.alex4@gmail.com>
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2026-04-07 07:42:54 +03:00
Gregory P. Smith
bac4fee745
gh-73613: clarify padding= docs in for base64 & binascii modules (GH-148183)
Based on mayeut's comment in https://github.com/python/cpython/pull/147974#discussion_r3038498019.
2026-04-06 16:45:13 -07:00
Pablo Galindo Salgado
ca960b6f38
gh-148110: Resolve lazy import filter names for relative imports (#148111) 2026-04-06 22:29:02 +01:00
Hugo van Kemenade
acf5229081
Docs: Update "Installing Python modules" (#146249) 2026-04-06 14:21:59 +03:00
Serhiy Storchaka
d0e204fb1d
gh-148153: Do not use assert for parameter validation in base64 (GH-148154)
base64.b32encode() now always raises ValueError instead of
AssertionError for the value of map01 with invalid length.
2026-04-06 13:47:27 +03:00
Gregory P. Smith
a1cf4430ed
gh-94632: document the subprocess need for extra_groups=() with user= (GH-148129) 2026-04-05 11:07:07 -07:00
Antonio Cuni
1c4408aeca
gh-130472: Integrate fancycompleter with the new repl, to get colored tab completions (#130473)
Co-authored-by: Pablo Galindo <pablogsal@gmail.com>
2026-04-05 14:23:07 +00:00
Serhiy Storchaka
8bf8bf9292
gh-73613: Support Base32 and Base64 without padding (GH-147974)
Add the padded parameter in functions related to Base32 and Base64 codecs
in the binascii and base64 modules.  In the encoding functions it controls
whether the pad character can be added in the output, in the decoding
functions it controls whether padding is required in input.

Padding of input no longer required in base64.urlsafe_b64decode() by default.
2026-04-04 21:26:16 +03:00
Stan Ulbrych
75be902a13
Docs: Standardize documentation authors (#148102) 2026-04-04 19:02:16 +01:00
Stan Ulbrych
b1d2d9829c
Docs: Fix a typo in the 'Non-ASCII characters in names' section (#148043) 2026-04-04 17:45:52 +01:00
Hugo van Kemenade
fbdbea949f
Regex HOWTO: invalid string literals result in SyntaxWarning (#148092)
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2026-04-04 19:13:17 +03:00
TT
611d606a18
gh-148067: Fix typo in asyncio event loop docs: 'signals' -> 'signal' (#148073) 2026-04-04 16:02:58 +05:30
Joshua Swanson
80d0a85d96
gh-126676: Expand argparse docs for type=bool with warning and alternatives (#146435)
Co-authored-by: joshuaswanson <joshuaswanson@users.noreply.github.com>
Co-authored-by: Savannah Ostrowski <savannah@python.org>
2026-04-03 18:07:03 +00:00
Stan Ulbrych
80ab6d958a
gh-125895: Fix static asset location for sphinx-notfound-page (#147984) 2026-04-03 16:19:30 +01:00
Pablo Galindo Salgado
edab6860a7
gh-148022: Add threat model to remote debugging docs (#148024)
The remote debugging protocol has been generating spurious
vulnerability reports from automated scanners that pattern-match
on "remote access" and "memory operations" without understanding
the privilege model. This section documents the security boundaries
so reporters can self-triage before submitting.

The threat model clarifies three points: attaching requires the
same OS-level privileges as GDB (ptrace, task_for_pid, or
SeDebugPrivilege), crashes caused by reading corrupted target
process memory are not security issues, and a compromised target
process is out of scope. A subsection explains when operators
should use PYTHON_DISABLE_REMOTE_DEBUG for defence-in-depth.
2026-04-03 14:20:50 +00:00
Miikka Koskinen
f3b74d6269
gh-80642: timeit - make target time of autorange configurable (#140283)
Co-authored-by: Alessandro Cucci <alessandro.cucci@gmail.com>
Co-authored-by: blurb-it[bot] <blurb-it[bot]@users.noreply.github.com>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
Co-authored-by: Stan Ulbrych <stan@python.org>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2026-04-03 06:47:21 +00:00
Tadej Magajna
617f4cc1c2
gh-142533: Document CRLF injection vulnerabilities in http.server doc (#143395)
Co-authored-by: Victor Stinner <vstinner@python.org>
2026-04-02 23:26:21 +02:00
Ken Jin
74a82a29ba
gh-139038: Update JIT results in preparation for 3.15a8 (GH-148018)
Update JIT results in preparation for 3.15a8
2026-04-03 03:10:04 +08:00
Petr Viktorin
a86963b3e2
gh-146636: Py_mod_abi mandatory for modules created from slots array (GH-146855) 2026-04-02 13:54:21 +02:00
Peter Sutton
021ee7fd6a
Docs: Use !r in __repr__ example (gh-146273) 2026-04-01 11:16:36 -05:00
konsti
03f3b9ade9
gh-146907: Clarify ABI compatibility between debug and release builds (GH-146925) 2026-04-01 16:17:56 +02:00
Petr Viktorin
2452324001
gh-146636: PEP 803: add Py_TARGET_ABI3T and .abi3t.so extension (GH-146637)
- Add Py_TARGET_ABI3T macro.
- Add ".abi3t.so" to importlib EXTENSION_SUFFIXES.
- Remove ".abi3.so" from importlib EXTENSION_SUFFIXES on Free Threading.
- Adjust tests

This is part of the implementation for PEP-803.
Detailed documentation to come later.

Co-authored-by: Nathan Goldbaum <nathan.goldbaum@gmail.com>
2026-04-01 16:14:59 +02:00
Stan Ulbrych
08c5d3d423
gh-145000: Run check-html-ids.py in CI (#145632)
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2026-04-01 15:10:27 +02:00
Serhiy Storchaka
42825e6387
gh-146431: Add the wrapcol and ignorechars parameters for more Base XX codec (GH-146434)
Add the wrapcol parameter to base64 functions b16encode(), b32encode(),
b32hexencode(), b85encode() and z85encode(), and binascii functions
b2a_base32() and b2a_base85().

Add the ignorechars parameter to base64 functions b16decode(), b32decode(),
b32hexdecode(), b85decode() and z85decode(), and binascii functions
a2b_hex(), unhexlify(), a2b_base32() and a2b_base85().
2026-04-01 10:48:50 +03:00
Boy Steven
9e1f1644cd
Docs: fill in descriptor C API docs (GH-146644) 2026-03-31 17:52:11 -04:00