Commit graph

30788 commits

Author SHA1 Message Date
Steve Dower
54607eec34
Add PyManager documentation for index signatures (GH-148631) 2026-04-15 22:48:14 +01:00
Hugo van Kemenade
eb2f634b83
gh-148100: Soft deprecate re.match and re.Pattern.match in favour of prefixmatch (#148101) 2026-04-15 23:09:47 +03:00
Hugo van Kemenade
55c9d60a3a
Docs: Use bash lexer for http.server CLI commands, not Python (#148612) 2026-04-15 18:18:49 +03:00
Pieter Eendebak
aee63e2dae
gh-139038: Add whatsnew entry for jit unique reference tracking (GH-148572)
Co-authored-by: Ken Jin <kenjin4096@gmail.com>
2026-04-15 18:53:47 +08:00
Anerdw
d14e31ed68
gh-147957: pop items from UserDict in LIFO order (gh-147958) 2026-04-14 23:29:41 -05:00
Stan Ulbrych
d0e7c6acc9
GH-70647: Remove support for %d (and deprecate for %e) without year in strptime() (GH-144570)
* Add deprecation for %e with no year
* schedule `%e` for 3.17, and remove `%d` now
2026-04-14 17:15:27 -07:00
Kliment Lamonov
94d42bf5c2
gh-148186: Improve assertCountEqual description in docs. (#148463) 2026-04-14 19:39:16 -04:00
Gregory P. Smith
236aa0a4e2
tiny edit, fix a couple of minor typos in enum and sqlite3 docs (GH-148580)
pair of minor doc typo fixes
2026-04-14 23:29:35 +00:00
Hugo van Kemenade
bdb0b36192
gh-86519: Update docs for prefixmatch (#148096)
Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com>
2026-04-14 20:15:06 +03:00
Santi Hernandez
4286227308
gh-72406: Document argument ordering in argparse help output (#148534)
Co-authored-by: Savannah Ostrowski <savannah@python.org>
2026-04-14 16:24:16 +00:00
Geoffrey Thomas
c88c27b0c1
gh-133312: configure: add --enable-static-libpython-for-interpreter (#133313)
This option changes the behavior of --enable-shared to continue to build
the libpython3.x.so shared library, but not use it for linking the
python3 interpreter executable. Instead, the executable is linked
directly against the libpython .o files as it would be with
--disable-shared.

There are two benefits of this change. First, libpython uses
thread-local storage, which is noticeably slower when used in a loaded
module instead of in the main program, because the main program can take
advantage of constant offsets from the thread state pointer but loaded
modules have to dynamically call a function __tls_get_addr() to
potentially allocate their thread-local storage area. (There is another
thread-local storage model for dynamic libraries which mitigates most of
this performance hit, but it comes at the cost of preventing
dlopen("libpython3.x.so"), which is a use case we want to preserve.)

Second, this improves the user experience around relocatable Python a
little bit, in that we don't need to use an $ORIGIN-relative path to
locate libpython3.x.so, which has some mild benefits around musl (which
does not support $ORIGIN-relative DT_NEEDED, only $ORIGIN-relative
DT_RPATH/DT_RUNPATH), users who want to make the interpreter setuid or
setcap (which prevents processing $ORIGIN), etc.
2026-04-14 16:26:19 +01:00
Loïc Simon
74a4f8c1d0
gh-134551: Add t-strings support to pprint (#134577)
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
2026-04-14 14:37:41 +03:00
Gleb Popov
8ecb6b8b0c
Fix "encodings" typo in argparse.FileType documentation (#148502) 2026-04-13 11:12:25 -07:00
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