Commit graph

31044 commits

Author SHA1 Message Date
Stan Ulbrych
9620f69cd4
Drop historical :author:s from HOWTOs (#151091) 2026-06-11 09:46:39 +01:00
glennglazer
84630e2cb9
gh-136880: Add warning about PYTHONPATH (GH-151098) 2026-06-11 07:14:34 +01:00
Petr Viktorin
7bbb9607a2
gh-141984: Reword the Generator expressions section (GH-150518)
Co-authored-by: Blaise Pabon <blaise@gmail.com>
Co-authored-by: Stan Ulbrych <stan@python.org>
2026-06-10 16:45:30 +02:00
Kumar Aditya
e2bd50d2e1
add asyncio guide for Free-Threaded Python (#150456) 2026-06-10 14:02:11 +00:00
Manoj K M
8c0e2515bb
Docs: Fix typos in the "Memory Management" section (GH-151243) 2026-06-10 09:13:17 -04:00
Bernát Gábor
a621e8ad81
gh-89554: Document socket.SocketType as a class (#150683)
socket.SocketType is a class (re-exported from _socket as an alias of
_socket.socket, the base class of socket.socket), but was documented with
the ".. data::" directive, so ":class:" cross-references to it cannot
resolve against a py:class target.

Switch the entry to ".. class::", correct the misleading description
(SocketType is the base class of the socket type, not "type(socket(...))"
which is socket.socket; addresses gh-88427), move it into the Socket
Objects section, and document the socket object methods and attributes
nested under the socket class, dropping the redundant "socket." prefix.
2026-06-10 15:01:01 +02:00
sobolevn
44a533fa1b
gh-150671: Deprecate PyAsyncGen_New, PyCoro_New, PyGen_New, PyGen_NewWithQualName functions (#150672)
Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
2026-06-10 15:57:09 +03:00
Serhiy Storchaka
ca32ebf793
gh-80384: Check that callback is callable at weak reference creation (GH-151145)
* Python functions weakref.ref() and weakref.proxy() now raise TypeError
  if the callback argument is not callable or None.
* C functions PyWeakref_NewRef() and PyWeakref_NewProxy() now raise TypeError
  if the callback argument is not callable, None, or NULL.

Co-authored-by: Maxwell Bernstein <emacs@fb.com>
2026-06-10 13:34:55 +03:00
Taeknology
11c93d6df3
gh-149716: Document PySlot_DATA for Py_mod_gil and Py_mod_multiple_interpreters (GH-150053)
Add short code examples mirroring the existing Py_mod_abi example,
so it is clear which slot definition macro (PySlot_DATA, PySlot_INT64,
or PySlot_UINT64) to use for these two slots.
2026-06-10 12:10:15 +02:00
Savannah Ostrowski
82cb7d4bf6
GH-59633: Clarify dest collisions in argparse docs (#150987) 2026-06-09 10:07:03 -07:00
Savannah Ostrowski
bc37a227b2
GH-61082: Clarify nargs='*' positional default behavior (#150989) 2026-06-09 15:37:24 +00:00
Savannah Ostrowski
528550e0e7
GH-54732: Tweak wording around empty lines in argument files (#150980) 2026-06-09 15:37:15 +00:00
Sergio López Gómez
3266edefd7
Docs: add cross-references to improve navigation in getpass.rst (#151092) 2026-06-09 11:36:05 -04:00
Robsdedude
b2e2cd3912
gh-150898: Assume OpenSSL supports keylogging (#150870)
Since version 3.10, CPython requires OpenSSL 1.1.1 or higher.
Therefore, support for keylogging can be assumed.

Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
2026-06-09 16:37:38 +02:00
Stan Ulbrych
0a179e748b
Docs: Only add profiling-sampling-visualization.{css,js} to files when necessary (#151150) 2026-06-09 14:16:03 +01:00
Arshal Aromal
29a920e80e
gh-151070: Fix class referencing typo in collections.abc docs (GH-151088) 2026-06-08 22:38:14 +03:00
Eduardo Villalpando Mello
5c13217314
gh-148932: Fix profiling.sampling on Windows virtual environments (#150541) 2026-06-08 17:25:43 +00:00
Adorilson Bezerra
f051c68923
gh-106318: Add examples to the str.isdigit() method docs (#144721)
Co-authored-by: Stan Ulbrych <stan@python.org>
2026-06-08 12:51:35 +00:00
Doron Behar
bd5fa31c5f
gh-141623: operator.rst: don't use term "bitwise" (GH-141846) 2026-06-08 15:12:48 +03:00
Jonathan Dung
e3762114e5
Mention frozendict in object.__hash__() documentation (#148867) 2026-06-08 12:39:41 +01:00
Christian Zinck
a1873300ee
gh-101100: Fix Sphinx warnings in 'Buffer Object Structures' documentation (#151058) 2026-06-08 11:24:26 +01:00
Sergio López Gómez
16ede813eb
Docs: Fix missing colon in bisect example function (GH-151061) 2026-06-08 05:39:03 -04:00
きょうすけ
4084141073
gh-69619: Clarify "whitespace" in the str.{l,r}strip() documentation (#150901)
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2026-06-07 19:25:50 +01:00
saber-bit
81965c1683
Update an error message in the 'Functional Programming HOWTO' (#151047) 2026-06-07 17:47:50 +01:00
Alexander Shadchin
fded34d6fe
Delete mention encoding and errors for importlib.resources.path() (GH-143111) 2026-06-06 14:52:01 +03:00
Inada Naoki
4833b2031e
Doc: fix order of PyLong_FromUnsignedLongLong (#150937) 2026-06-06 20:37:49 +09:00
Jeff Epler
b6e66136cc
gh-150534: Add C23 half-turn trigonometric *pi functions (GH-150555)
Add the the following functions to the math module:
acospi, asinpi, atanpi, atan2pi, cospi, sinpi, tanpi.
2026-06-06 10:19:45 +00:00
Serhiy Storchaka
b18b6a49c6
gh-84649: Use statx() in TimedRotatingFileHandler if available (ПР-150968)
This allows to support rotation based on the file birth time on Linux.
2026-06-06 11:49:07 +03:00
Ilya Nikolaev
ea4c85552b
Use time.monotonic in OrderedDict LRU cache example (#150986) 2026-06-06 01:42:59 +03:00
Ezio Melotti
6544bf4263
gh-110631: Fix wrong blocks indentation in difflib.rst (GH-110885) 2026-06-05 17:02:10 +00:00
Cody Maloney
e4db68b9c9
gh-129011: Update docs for Raw I/O read, readinto, and write (#135328)
Update `RawIOBase` and `FileIO` documentation to match implementation
behavior around `.read`, `.readinto`, `.readall` and `.write`.

In particular:

 - They may make more than one system call (PEP-475)
 - Add warnings if `.write()` requires a wrapping retry loop (see: gh-126606)
    - "Raw I/O" `.write`` may not write all bytes
    - `buffering=0` example results in a "Raw I/O"

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
2026-06-05 14:00:59 +02:00
Steve Dower
e28a2f4930
Add shebang documentation for PyManager 26.3b1 (GH-150931) 2026-06-04 21:37:18 +01:00
Adorilson Bezerra
a96cba5c4a
gh-106318: Add doctest role and a 'See also' to the str.split() docs (#144367) 2026-06-04 12:39:14 +01:00
Miro Hrončok
cb064e746d
Fix 2 broken links in documentation (#150892)
Co-authored-by: Stan Ulbrych <stan@python.org>
2026-06-04 10:42:06 +01:00
jb2170
ae507e3b14
gh-119670: Add force keyword only argument to shlex.quote (#148846)
There are propositions to add a single-quote-double-quote switch
(gh-90630), so to avoid hiccups of people passing `force` as a
positional and it being used for the single-double switch, we make
kwargs kwargs-only.

Co-authored-by: Bartosz Sławecki <bartosz@ilikepython.com>
2026-06-04 11:06:02 +02:00
Stan Ulbrych
7a468a1012
gh-150032: Tidy up 3.15 pending removals (#149594)
Co-authored-by: Savannah Ostrowski <savannah@python.org>
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
Co-authored-by: Brett Cannon <brett@python.org>
2026-06-03 17:29:13 +03:00
Hugo van Kemenade
b643826c11
Docs: Replace hardcoded SOURCE_URI with patchlevel check (#150850) 2026-06-03 16:37:09 +03:00
Abduaziz π
5915a1fb9d
gh-132467: Document and test that generic aliases are not classes (#133504)
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2026-06-03 13:35:25 +00:00
da-woods
58beae7319
Correct Stable ABI documentation for METH_FASTCALL (GH-149593)
* Correct Stable ABI documentation for METH_FASTCALL

The current documentation says:

> 
> METH_FASTCALL
>    Part of the Stable ABI since version 3.7.
>
> [...]
>
>   Added in version 3.7.
>
>    Changed in version 3.10: METH_FASTCALL is now part of the stable ABI.

so is contradictory about when it was added to the Stable ABI.  Looking at the header it seems like 3.10 is right.
2026-06-03 15:20:35 +02:00
Victorien
deb33ecba3
gh-105812: Make use of the Sphinx deco role in documentation (#139598) 2026-06-03 13:14:47 +00:00
Yashraj
6453065db9
gh-141004: Document unstable perf map functions in ceval.h (GH-143492) 2026-06-03 12:36:25 +00:00
Robsdedude
5553e003ca
Fix a typo in SSLSocket docs (GH-150839) 2026-06-03 08:18:06 -04:00
Petr Viktorin
c720e18c94
gh-146636: Add Free-threaded Stable ABI migration guide (GH-150580)
Co-authored-by: Charlie Lin <tuug@gmx.us>
Co-authored-by: da-woods <dw-git@d-woods.co.uk>
Co-authored-by: Stan Ulbrych <stan@python.org>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2026-06-03 14:02:36 +02:00
Stephen Rosen
50fe49c879
gh-150319: Replace all documentation which says "See PEP 585" (#150325)
* Replace all documentation which says "See PEP 585"

The following classes in the stdlib get simple updates:

- array.array
- asyncio.Future
- asyncio.Task
- collections.defaultdict
- collections.deque
- contextvars.ContextVar
- contextvars.Token
- ctypes.Array
- os.DirEntry
- re.Match
- re.Pattern
- string.templatelib.Interpolation
- string.templatelib.Template
- types.MappingProxyType
- queue.SimpleQueue
- weakref.ref

The following classes are documented publicly as functions, and are
therefore updated internally (`__class_getitem__.__doc__`) but not in the
public docs:

- functools.partial
- itertools.chain

The following builtin types have updates to `__class_getitem__.__doc__`
but not to any documentation pages:

- BaseExceptionGroup
- coroutines (from generators)
- dict
- enumerate
- frozendict
- frozenset
- generators (and async generators)
- list
- memoryview
- set
- slice
- tuple

Special cases:

- union objects are now documented as "supporting class-level []",
  rather than anything to do with generics.

- Templates might be generic over a single type (union, in theory) or
  over a TypeVarTuple. As this is not currently fully settled, it is
  marked with a comment and a mild hint that it is a single type is used
  (namely, "type" is singular rather than "types", plural)

* Apply suggestions from code review

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>

* Correct several class getitem docs

And expand the text for tuples.

Co-authored-by: Jelle Zijlstra <906600+JelleZijlstra@users.noreply.github.com>

* Add notes on generic typing of builtins

* Fix typo in tuple.__class_getitem__ docstring

* Typo fix: malformed refs

Fix `generic` links which weren't marked as `:ref:`.

* Strike unnecessary docs on generic-ness

Co-authored-by: Jelle Zijlstra <906600+JelleZijlstra@users.noreply.github.com>

* Apply suggestions from code review

These are applied at both the originally indicated locations and in the
corresponding docstring definitions.

Co-authored-by: Alex Waygood <66076021+AlexWaygood@users.noreply.github.com>

* Update Doc/library/re.rst

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>

* Update Objects/enumobject.c

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>

* Remove tuple generic doc in 'stdtypes' page

This is covered in more detail in the cross-linked typing documentation.
The other copy of this documentation -- in the docstring for
`tuple.__class_getitem__` -- is left in place.

* Fix whitespace around new doc of generics

Per review, do not introduce or remove whitespace such that section
breaks are altered by the introduction of doc on various generic types.

In most cases, this is a removal of an extra line.

In one case (Arrays), it is the reintroduction of a line.

Additionally, two other minor fixes are included:
- incorrect indent on 'defaultdicts'
- make `mappingproxy.__class_getitem__.__doc__` consistent with other
  mapping type generic docs

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>

* Move placement of memoryview generic note

Previous placement was at the end of the main docstring, which is
consistent with other types but places it after a section on various
methods (which makes it read somewhat inconsistently). Moving it up
helps resolve.

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>

* Ensure sphinxdoc does not start sentences lowercase

Lowercase class names at the start of sentences are marked out with the
`class` role. In the case of `deque`, documentation already refers to
these as `Deques`, so this form is preferred.

* Apply suggestions from code review

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>

* Fix line endings and wrap more tightly

Line endings fixed by pre-commit ; also re-wrapped the MappingProxyType
text which was too long.

* Use 'ContextVars' style in sphinx doc

---------

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
Co-authored-by: Jelle Zijlstra <906600+JelleZijlstra@users.noreply.github.com>
Co-authored-by: Alex Waygood <66076021+AlexWaygood@users.noreply.github.com>
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2026-06-02 21:13:34 +01:00
Brian Schubert
18c6d3ccc3
Fix description of the function parameter of shutil.register_archive_format() (GH-145087) 2026-06-02 22:12:36 +03:00
Mohsin Mehmood
551bc2cb5e
gh-141627: Fix BufferedRandom inheritance documentation (GH-141629)
BufferedRandom does not inherit from BufferedReader and BufferedWriter
in the C implementation.
2026-06-02 18:06:39 +00:00
Bartosz Sławecki
e3fa52d953
gh-148587: Document sys.lazy_modules (#150742) 2026-06-02 16:00:45 +01:00
Øyvind Rønningstad
86867edb84
gh-149187: Document frozendict() under 'Built-in Functions' (#149185) 2026-06-02 14:55:16 +01:00
Bernát Gábor
e37ce56977
gh-89554: Document _thread.LockType as a class (#150684)
_thread.LockType is a class (the type of lock objects), but was documented
with the ".. data::" directive, so ":class:" cross-references to it cannot
resolve against a py:class target.

Switch the entry to ".. class::", move it next to the lock methods, and
document acquire(), release() and locked() as methods of the class.  Keep
the old _thread.lock.* URL fragments working with raw HTML anchors.
2026-06-02 14:55:01 +02:00
Manoj K M
cee3327b92
Fix two typos in 'Exception Handling' C-API documentation (#150674) 2026-06-02 10:14:13 +01:00