Commit graph

29839 commits

Author SHA1 Message Date
Bénédikt Tran
7ce2f101c4
gh-136929: ensure that hashlib.<name> does not raise AttributeError (#136933)
Previously, if OpenSSL was not present and built-in cryptographic extension modules
were disabled, requesting `hashlib.<name>` raised `AttributeError` and an ERROR log
message with the exception traceback is emitted when importing `hashlib`. 

Now, the named constructor function will always be available but raises a `ValueError`
at runtime indicating that the algorithm is not supported. The log message has also
been reworded to be less verbose.
2025-07-25 14:49:09 +00:00
Raymond Hettinger
ea06ae5b5e
Fix Queue.shutdown docs for condition to unblock a join (gh-137088) 2025-07-25 07:56:28 -06:00
Raymond Hettinger
245671555b
Fix docs for Queue.shutdown (gh-137028) 2025-07-24 11:23:03 -06:00
FredericDT
dc27218225
gh-136980: Remove unused C tracing code in bdb (#136981) 2025-07-24 09:58:54 +09:00
Petr Viktorin
777159fa31
gh-135676: Lexical analysis: Reword String literals and related sections (GH-135942)
Co-authored-by: Blaise Pabon <blaise@gmail.com>
Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2025-07-23 15:57:54 +00:00
Guido Imperiale
38b936cc99
gh-137043: mention PyList_GET_ITEM as unsafe borrowed API in free-threading docs (#137042) 2025-07-23 20:06:06 +05:30
Cornelius Roemer
80a7017d26
Fix typos in Doc/extending/extending.rst and Doc/library/shelve.rst (GH-136890) 2025-07-23 15:04:59 +03:00
Petr Viktorin
fac4964fdb
gh-136516: Mention installation artifacts as de-facto resources (GH-136419)
Files like NUL on windows are, from `importlib.resources` point of
view, an artifact caused by installing to a filesystem directory.
Mention these.
2025-07-23 14:01:38 +02:00
Nathan Goldbaum
b13a5df52f
gh-133296: Fix versionadded for C API functions that were backported (#137024) 2025-07-22 21:27:50 +01:00
Adam Turner
d6cf05b5d0
Fix tables in 'Using on Windows' for the text writer (#137012) 2025-07-22 16:15:29 +00:00
Nazım Can Altınova
a667800558
gh-136459: Add perf trampoline support for macOS (#136461) 2025-07-22 16:47:24 +01:00
Victorien
c13cc4af79
Fix code example in annotationlib documentation (#136972) 2025-07-22 13:48:02 +00:00
Serhiy Storchaka
3a89dfe32b
Revert "gh-112068: C API: Add support of nullable arguments in PyArg_Parse (GH-121303)" (#136991) 2025-07-22 16:39:50 +03:00
sobolevn
b31e5d6de1
gh-136437: Convert more `os.path` functions to positional-only in the docs (#136970) 2025-07-22 14:38:33 +01:00
Dave Peck
22c8658906
gh-132661: Document t-strings and templatelib (#135229)
Co-authored-by: Petr Viktorin <encukou@gmail.com>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
Co-authored-by: Loïc Simon <loic.pano@gmail.com>
Co-authored-by: pauleveritt <pauleveritt@me.com>
2025-07-22 12:44:13 +03:00
Emma Smith
6bf1c0ab34
gh-136170: Revert adding ZipFile.data_offset (GH-136950)
* Revert "gh-84481: Make ZipFile.data_offset more robust (#132178)"

This reverts commit 6cd1d6c6b1.

* Revert "gh-84481: Add ZipFile.data_offset attribute (#132165)"

This reverts commit 0788948dcb.

---------

Co-authored-by: Gregory P. Smith <greg@krypto.org>
2025-07-21 23:16:30 +00:00
Nathan Goldbaum
89c220b93c
gh-133296: Publicly expose critical section API that accepts PyMutex (gh-135899)
This makes the following APIs public:

* `Py_BEGIN_CRITICAL_SECTION_MUTEX(mutex),`
* `Py_BEGIN_CRITICAL_SECTION2_MUTEX(mutex1, mutex2)`
* `void PyCriticalSection_BeginMutex(PyCriticalSection *c, PyMutex *mutex)`
* `void PyCriticalSection2_BeginMutex(PyCriticalSection2 *c, PyMutex *mutex1, PyMutex *mutex2)`

The macros are identical to the corresponding `Py_BEGIN_CRITICAL_SECTION` and
`Py_BEGIN_CRITICAL_SECTION2` macros (e.g., they include braces), but they
accept a `PyMutex` instead of an object.

The new macros are still paired with the existing END macros
(`Py_END_CRITICAL_SECTION`, `Py_END_CRITICAL_SECTION2`).
2025-07-21 17:25:43 -04:00
sobolevn
3224429450
gh-136437: Document os.path.dirname as accepting only pos-only (#136946) 2025-07-21 18:22:58 +00:00
sobolevn
b5428bb0e7
gh-136437: Document some os.path functions as requiring pos-only (#136812) 2025-07-21 21:01:43 +03:00
Barney Gale
80b2d60a51
GH-136874: url2pathname(): discard query and fragment components (#136875)
In `urllib.request.url2pathname()`, ignore any query or fragment components
in the given URL.
2025-07-21 17:33:20 +00:00
Josh Cannon
4b68289ca6
Pedantic rewording of why relative importing doesn't work in main modules (GH-136846)
Pedantically reword the section about relative imports and main modules.
2025-07-21 09:30:17 -07:00
Nacho Caballero
5f9e38f9b9
gh-136859: Improve StrEnum docs (GH-136864)
Co-authored-by: Nacho Caballero <nacho.caballero@astrazeneca.com>
Co-authored-by: Antonio Spadaro <ilovelinux@users.noreply.github.com>
2025-07-21 08:18:40 -07:00
Petr Viktorin
658599c15d
gh-121028: Soft-deprecate sys.api_version (GH-136463) 2025-07-21 14:22:48 +02:00
Vinay Sajip
1e672935b4
gh-136882: Update stale link in the basic logging tutorial. (#136885)
Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
2025-07-21 10:29:12 +02:00
Bénédikt Tran
5798348a07
gh-136428: amend UUIDv8 performance improvements (#136903)
UUIDv8 has been added in Python 3.14.0a2 and its construction time
has been improved in Python 3.14.0a4, but since those changes will
not be visible when comparing the latest Python 3.13 and 3.14 together,
we do not document them on the What's New page to avoid confusion.
2025-07-21 08:23:16 +00:00
Pablo Galindo Salgado
acbe896cb1
GH-130645: Default to color help in argparse (#136809)
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
Co-authored-by: Adam Turner <9087854+aa-turner@users.noreply.github.com>
2025-07-20 14:55:44 -07:00
Peter Bierma
8f59fbb082
gh-136492: Add FrameLocalsProxyType to types (GH-136546)
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2025-07-20 20:49:00 +02:00
morotti
e24c66d55a
gh-91349: Adjust default compression level to 6 (down from 9) in gzip and tarfile (GH-131470)
gh-91349: Adjust default compression level to 6 (down from 9) in gzip and tarfile

It is the default level used by most compression tools and a
better tradeoff between speed and performance.

Co-authored-by: rmorotti <romain.morotti@man.com>
Co-authored-by: Pieter Eendebak <pieter.eendebak@gmail.com>
2025-07-20 09:43:40 -07:00
Alexander Urieles
958657bbc3
gh-131724: Add a new max_response_headers param to HTTP/HTTPSConnection (GH-136814)
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Co-authored-by: Petr Viktorin <encukou@gmail.com>
2025-07-20 13:53:54 +00:00
Dominic H.
cc81b4e501
gh-86608: Improve and restructure tarfile examples (#121771)
Add an example on how to write a tarfile to stdout; general improvements.

Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2025-07-20 12:19:47 +00:00
Nacho Caballero
9c2f91cde8
gh-136854: Exit on error in make venv (#136856)
Co-authored-by: Nacho Caballero <nacho.caballero@astrazeneca.com>
2025-07-20 12:08:00 +00:00
Hugo van Kemenade
dda9d0011f
gh-108362: Retarget incremental GC changes to 3.14 (#125453) 2025-07-20 12:56:55 +03:00
sobolevn
67036f1ee1
gh-133875: Remove deprecated pathlib.PurePath.is_reserved (#133876) 2025-07-19 17:07:46 +00:00
Slavaqq
1ba23244f3
gh-136793: Update the sampling rate in the documentation (#136829) 2025-07-19 15:00:46 +00:00
Matthieu Lienart
6293d8a1a6
gh-136752: Clarify documentation for `IPv{N}Address.is_reserved` (#136794)
Co-authored-by: Matthieu Lienart <matthieu.lienart@axians.com>
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2025-07-19 14:43:56 +00:00
Valerio Gianella
57acd65a30
gh-135468: Improve `BaseHandler.http_error_default()` parameter descriptions (#136797)
Co-authored-by: Adam Turner <9087854+aa-turner@users.noreply.github.com>
2025-07-19 15:43:00 +01:00
jdunter
8ffc3ef01e
gh-54732: Make argparse error caused by empty rows in option files explicit (#136795)
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2025-07-19 14:08:19 +00:00
aggshruti99
f575588ccf
gh-135730: Clarify multiprocessing.Queue close() documentation (#136803)
Add a copy of the text from SimpleQueue.close()

---------

Co-authored-by: saggarwal145 <saggarwal145@bloomberg.net>
Co-authored-by: Petr Viktorin <encukou@gmail.com>
2025-07-19 14:24:39 +02:00
Disconnect3d
d19bb44713
Doc/c-api/memory.rst: extend --without-pymalloc doc with ASan information (GH-136790)
* Doc/c-api/memory.rst: extend --without-pymalloc doc with ASan information

This commit extends the documentation for disabling pymalloc with the `--without-pymalloc` flag regarding why it is worth to use it when enabling AddressSanitizer for Python build (which is done, e.g., in CPython's CI builds).

I have tested the CPython latest main build with both ASan and pymalloc enabled and it seems to work just fine. I did run the `python -m test` suite which didn't uncover any ASan crashes (though, it detected some memory leaks, which I believe are irrelevant here).

I have discussed ASan and this flag with @encukou on the CPython Core sprint on EuroPython 2025. We initially thought that the `--without-pymalloc` flag is needed for ASan builds due to the fact pymalloc must hit the begining of page when determining if the memory to be freed comes from pymalloc or was allocated by the system malloc. In other words, we thought, that ASan would crash CPython during free of big objects (allocated by system malloc). It may be that this was the case in the past, but it is not the case anymore as the `address_in_range` function used by pymalloc is annotated to be skipped from the ASan instrumentation.

This code can be seen here:
acefb978dc/Objects/obmalloc.c (L2096-L2110)

While the annotation macro is defined here:
acefb978dc/Include/pyport.h (L582-L598)

And the corresponding attribute is documented in:
* for gcc: https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#index-no_005fsanitize_005faddress-function-attribute
* for clang: https://clang.llvm.org/docs/AttributeReference.html#no-sanitize-address-no-address-safety-analysis

* Update Doc/c-api/memory.rst

* Improve --with-address-sanitizer and pymalloc docs

---------

Co-authored-by: Petr Viktorin <encukou@gmail.com>
2025-07-19 13:52:54 +02:00
nacind
eb8ac4c857
gh-122450: Indicate that Fraction denominators are always positive (#136789) 2025-07-19 13:26:50 +02:00
Sina Zel taat
acefb978dc
gh-136769: Include fixed-width integers in the fundamental data types table (#136784)
Fixed-sized types, like ``c_int32``, are currently missing from the fundamental data types table
in the ``ctypes`` documentation. This commit adds them, and  notes that ``c_[u]int8`` is an alias
of ``c_[u]byte``.
2025-07-19 11:19:41 +01:00
Gergely Elias
263e451c41
gh-74598: document that fnmatch.filterfalse is affected by cache limitation (#136781) 2025-07-19 09:51:11 +00:00
RafaelWO
3eecc72ac7
Docs: Improve example for `itertools.batched()` (#136775)
The current example `batched('ABCDEFG', n=3) → ABC DEF G` can confuse readers because both, the size of the tuples and the number of tuples are 3.
By using a batch size of n=2, it is clearer that the `n` argument refers to the size of the resulting tuples.
I.e. the new example is: `batched('ABCDEFG', n=2) → AB CD EF G`
2025-07-19 10:29:44 +01:00
Tian Gao
28937d3a21
gh-136697: Use the standard audit event format for sys.monitoring docs (#136747) 2025-07-17 11:10:10 -07:00
Bartosz Sławecki
69d8fe50dd
gh-126548: Add a thread-unsafety warning for importlib.reload() (GH-136704) 2025-07-16 12:34:14 -04:00
Facundo Batista
8e2f4b4483
Improved venv docs to indicate that isolation is the default. (#136698)
* Improved venv docs to note that isolation is the default.

* Insert "that" so that a sentence reads better.

* Improved wording.

---------

Co-authored-by: Vinay Sajip <vinay_sajip@yahoo.co.uk>
2025-07-16 08:55:31 -03:00
William Andrea
e89923d366
fix grammar typo in logging.rst (#136584) 2025-07-16 12:31:26 +05:30
Serhiy Storchaka
7689407fa4
Fix index entry and anchor for module.__test__ (GH-136674)
It was "doctest.module attribute". Now it is "module attribute".
2025-07-15 18:52:51 +03:00
Ran Benita
7e10a103df
gh-136682: Remove incorrect statement that os.path.samestat accepts file-like objects (#136683) 2025-07-15 14:49:11 +02:00
Maciej Olko
624bf52c83
gh-136155: Docs: check for EPUB fatal errors in CI (#134074)
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
2025-07-15 15:26:24 +03:00