gh-110497: Add note about `OSError` being an alias to `IOError` in docs (GH-110498)
(cherry picked from commit 5e7edac771)
Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
[3.12] gh-109649: Enhance os.cpu_count() documentation (GH-110169)
* gh-109649: Enhance os.cpu_count() documentation
* Doc: Specify that os.cpu_count() counts *logicial* CPUs.
* Doc: Specify that os.sched_getaffinity(0) is related to the calling
thread.
* Fix test_posix.test_sched_getaffinity(): restore the old CPU mask
when the test completes!
* Restore removed text
(cherry picked from commit 5245b97e13)
Co-authored-by: Victor Stinner <vstinner@python.org>
As discussed in comments to GH-109544, the semantics of this attribute
are somewhat confusing. Add a note explaining its limitations and
steering users towards __required_keys__ and __optional_keys__ instead.
(cherry picked from commit f49958c886)
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
gh-108973: Fix asyncio SubprocessProtocol doc (#109431)
SubprocessProtocol process_exited() method can be called before
pipe_data_received() and pipe_connection_lost() methods. Document it
and adapt the example in the doc.
Co-authored-by: Davide Rizzo <sorcio@gmail.com>
(cherry picked from commit ced6924630)
Co-authored-by: Colin Watson <cjwatson@debian.org>
Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
gh-107755: Document the correct default value of slice step (GH-107756)
Document the correct default value of slice step.
(cherry picked from commit 9bf350b066)
Co-authored-by: wim glenn <hey@wimglenn.com>
GH-108202: Document ``calendar``'s command-line interface (GH-109020)
(cherry picked from commit f0f96a9f40)
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
(cherry picked from commit 21da4980f5)
Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
gh-104372: Drop the GIL around the vfork() call. (#104782)
On Linux where the `subprocess` module can use the `vfork` syscall for
faster spawning, prevent the parent process from blocking other threads
by dropping the GIL while it waits for the vfork'ed child process `exec`
outcome. This prevents spawning a binary from a slow filesystem from
blocking the rest of the application.
Fixes#104372.
(cherry picked from commit d08679212d)
`ast` docs: Fix incorrect link on `keyword` (GH-108728)
In two places, Sphinx was erroneously adding links to the `keyword` module instead of the `ast.keyword` class
(cherry picked from commit c1e2f3b2f7)
Co-authored-by: Alex Povel <git@alexpovel.de>
Mention Ellipsis pickling in the docs (GH-103660)
(cherry picked from commit 14ec0bb7c3)
Co-authored-by: sterliakov <50529348+sterliakov@users.noreply.github.com>
(cherry picked from commit 8178a88bd8)
- Add param docstrings
- Link to os.SEEK_* constants
- Mention the return value in the initial paragraph
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
Fix grammatical error in stringprep documentation (GH-108414)
Remove the word "them", which didn't make grammatical sense.
(cherry picked from commit cd0a8aece9)
Co-authored-by: Matthew James Kraai <kraai@ftbfs.org>
Co-authored-by: KRAAI, MATTHEW [VISUS] <mkraai@its.jnj.com>
Co-authored-by: Philipp A <flying-sheep@web.de>
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
gh-108267: Dataclasses docs: Fix object.__setattr__ typo (GH-108355)
Fixed a sentence in dataclasses.rst
Changed "__setattr__" to "object.__setattr__" in a section that was specifically supposed to refer to the __setattr__ method of the object class. Also suppressed the link to the data model docs for __setattr__, since we're talking about a specific __setattr__ implementation, not __setattr__ methods in general.
(cherry picked from commit 79fdacc005)
Co-authored-by: FrozenBob <30644137+FrozenBob@users.noreply.github.com>
- no parameters of create_aggregate() are positional-only
- all parameters of create_collation() are positional-only
(cherry picked from commit 893215a4e7)
Co-authored-by: Erlend E. Aasland <erlend@python.org>
(cherry picked from commit 7f87ebbc3f)
Clearly document the supported seek() operations:
- Rewind to the start of the stream
- Restore a previous stream position (given by tell())
- Fast-forward to the end of the stream
(Spawning subprocesses does not require the event loop to run in the main thread -- only signal handling does.)
(cherry picked from commit 1cc391d9e2)
Co-authored-by: temach <tematibr@gmail.com>
(cherry picked from commit f904aa4e1f)
Authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
Co-authored-by: Erlend E. Aasland <erlend@python.org>
Docs: Fix Sphinx warnings in sys.rst (GH-108106)
- Mark up named tuple attributes as attributes
- Remove links for external functions
- io.BufferedIOBase has no 'buffer' attribute;
remove the link and mark up using :attr:`!buffer`
- (Re)format some tables as bullet lists:
- sys._emscripten_info
- sys.hash_info
- sys.int_info
- sys.thread_info
- In the paragraphs mentioning 'f_trace_lines' and 'f_trace_opcodes',
add links to the frame objects reference.
(cherry picked from commit 29fa7afef9)
Co-authored-by: Erlend E. Aasland <erlend@python.org>
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
gh-107659: Improve wording of the description of `ctypes.pointer` and `ctypes.POINTER` (GH-107769)
(cherry picked from commit beffb30dc7)
Co-authored-by: Tomas R <tomas.roun8@gmail.com>
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
Co-authored-by: Kumar Aditya <kumaraditya@python.org>
Fix misspellings in sysconfig docs (GH-108156)
(cherry picked from commit 1dc0c58d2b)
Co-authored-by: Rafael Fontenelle <rffontenelle@users.noreply.github.com>
(cherry picked from commit c31c61c04e)
Co-authored-by: Erlend E. Aasland <erlend@python.org>
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
- name the last parameter *whence*, like it is for seek() methods on
file objects
- add param docstrings
- structure the valid *whence* params
(cherry picked from commit dd4442c8f5)
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
Docs: format sys.float_info properly (GH-108107)
- Normalise capitalisation and punctuation
- Use attribute markup for named tuple attributes
- Use :c:macro: markup for C macros
- Use a list for the 'rounds' attribute values
- Use list-table, for better .rst readability
- Remove one unneeded sys.float_info.dig link
(cherry picked from commit ca0c6c1f1e)
Co-authored-by: Erlend E. Aasland <erlend@python.org>
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
- Mark up parameter and argument names properly
- If possible, link to docs for methods like `seek`, `tell`, `write`, `read`, etc.
(cherry picked from commit 5c76899dad)
Co-authored-by: Erlend E. Aasland <erlend@python.org>
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
(cherry picked from commit 8a19f225b9)
Co-authored-by: Erlend E. Aasland <erlend@python.org>
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
Co-authored-by: Antoine Pitrou <antoine@python.org>
PEP 683 (immortal objects) revealed some ways in which the Python documentation has been unnecessarily coupled to the implementation details of reference counts. In the end users should focus on reference ownership, including taking references and releasing them, rather than on how many reference counts an object has.
This change updates the documentation to reflect that perspective.
Improve cross-references in `runpy` docs (GH-107673)
- Add links to `__main__` and `sys.path` where appropriate
- Ensure each paragraph never has more than one link to the same thing, to avoid visual clutter from too many links
(cherry picked from commit 4e242d1ffb)
Co-authored-by: Kamil Turek <kamil.turek@hotmail.com>
gh-107662: Switch 'any' and 'anext' in functions.rst (GH-107663)
Order was reversed in index at top, not in body.
(cherry picked from commit 9ebc6ecbc3)
Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
gh-105578: Add more usage examples to `typing.AnyStr` docs (GH-107045)
``typing.AnyStr`` has different semantics to ``str | bytes``, which often leads to user confusion
(cherry picked from commit f877b32b87)
Co-authored-by: Michael The <michael-the1@users.noreply.github.com>
Document that `os.link()` is not available on Emscripten (GH-104822)
(cherry picked from commit 737d1da074)
Co-authored-by: Roman Yurchak <rth.yurchak@gmail.com>
It includes standard C types, macros and variables like "size_t",
"LONG_MAX" and "errno", and standard environment variables like "PATH"..
(cherry picked from commit f8b7fe2f26)
LINES and COLS referred in curses.update_lines_cols() documentations are
the module variables, not the environment variables.
(cherry picked from commit 26e08dfdd7)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
gh-106882: Note that `asyncio.Server` is only publicly exposed on 3.11+ (GH-106901)
And later versions of 3.10, 3.9
(cherry picked from commit 1e1f4e91a9)
Co-authored-by: Jack Nelson <jack@jacknelson.xyz>
[3.12] gh-96747: Mention the PyPI `passlib` package in the `crypt` deprecation doc (GH-106660) (GH-106660)
* Added mention to passlib package as alternative to the deprecated crypt module.
(cherry picked from commit ec7b05a0be)
Co-authored-by: Yonatan Bitton <bityob@gmail.com>
gh-101880: add link to object.__hash__() in hash() builtin documentation (GH-101883)
(cherry picked from commit ec7180bd1b)
Co-authored-by: Owain Davies <116417456+OTheDev@users.noreply.github.com>
Clarify state of CancelledError in doc (GH-106453)
This change makes it explicit that asyncio.CancelledError is not a subclass of Exception.
(cherry picked from commit 12a9813808)
Co-authored-by: Kristján Valur Jónsson <sweskman@gmail.com>
RTSPS is the permanent scheme defined in
https://www.iana.org/assignments/uri-schemes/uri-schemes.xhtml
alongside RTSP and RTSPU schemes.
---------
(cherry picked from commit f3266c05b6)
Co-authored-by: zentarim <33746047+zentarim@users.noreply.github.com>
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
gh-105993: Add possible `None` return type to `asyncio.EventLoop.start_tls` docs (GH-105995)
(cherry picked from commit 6b52a581c1)
Co-authored-by: Sam Bull <git@sambull.org>
gh-106107: document correct error that's raised when a mutable default value for a field is detected (gh-106109)
(cherry picked from commit 512f299e55)
Co-authored-by: Roderich Schupp <roderich.schupp@gmail.com>
Improve typing docs on the type of class objects (GH-106081)
(cherry picked from commit 3eeb8c8906)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
Typing docs: improve the guidance on annotating tuples (GH-106021)
(cherry picked from commit 968435ddb1)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
* bpo-44530: Document the change in MAKE_FUNCTION behavior
Fixes dis module documentation for MAKE_FUNCTION due to 2f180ce2cb (bpo-44530, released as part of 3.11) removes the qualified name at TOS.
(cherry picked from commit 486b52a315)
Co-authored-by: Alex Doe <alexdoesh@gmail.com>
The syntax used in the current docs (a / before any args) is invalid.
I think the right approach is for the arguments to arbitrary
filter functions to be treated as positional-only, meaning that users
can supply filter functions with any names for the argument. tarfile.py
only calls the filter function with positional arguments.
(cherry picked from commit 5cdd5ba49d)
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
Cleanup and clarify our hashlib docs. (GH-105624)
Clarify and improve our hashlib docs. Now with 50% less mess!
(cherry picked from commit 0d1d6ab966)
Co-authored-by: Gregory P. Smith <greg@krypto.org>
Miscellaneous improvements to the typing docs (#105529)
Mostly, these are changes so that we use shorter sentences and shorter paragraphs. In particular, I've tried to make the first sentence introducing each object in the typing API short and declarative.
gh-90015: Document that PEP-604 unions do not support forward references (GH-105366)
(cherry picked from commit fbdee000de)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
typing docs: Make the PEPs list an expandable section, hidden by default (GH-105353)
(cherry picked from commit d7645124f5)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
`typing.NewType` docs: the future performance improvements are now in the past (GH-105354)
(cherry picked from commit 5f65ff0370)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
gh-104882: Docs: fix description of relationship between `socket.getblocking()` and `socket.gettimeout()` (GH-105026)
(cherry picked from commit 5a5ed7a3e6)
Co-authored-by: Joe Geisbauer <joegeisbauer@gmail.com>
gh-104984: remove kwargs and starargs from Call & ClassDef (GH-104986)
These fields are removed in 025e9ebd0a
(cherry picked from commit 61c1d6760f)
Co-authored-by: Shaygan Hooshyari <sh.hooshyari@gmail.com>
* gh-103606: Improve error message from logging.config.FileConfig (GH-103628)
(cherry picked from commit 152227b569)
plus backport the followup exception change fix to that in #104701
- AnyStr can be used in type annotations, contrary to the section header
- Unpack can also be used in annotations, and its use is not restricted
to generics. It makes more sense with other building blocks like Required.
- Protocol is not necessarily generic.
Also fix the indentation for two notes associated with Concatenate.
(cherry picked from commit ab71acd67b)
---------
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
gh-49174: document that the effect of calling gc.collect() during a collection is undefined (GH-104699)
(cherry picked from commit 30488fa22a)
Co-authored-by: Irit Katriel <1055913+iritkatriel@users.noreply.github.com>
Add a mention of PYTHONBREAKPOINT to breakpoint() docs (GH-104430)
(cherry picked from commit 1be80ed107)
Co-authored-by: Ned Batchelder <ned@nedbatchelder.com>
* separate documentation and examples for both functions
* add examples demonstrating behaviour with unsupported types
* document return value of `get_origin` for `ParamSpecArgs` and `ParamSpecKwargs` instances
(cherry picked from commit a7a2dbbf72)
Co-authored-by: chgnrdv <52372310+chgnrdv@users.noreply.github.com>
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
gh-102327: Extend docs for "url" and "headers" parameters to HTTPConnection.request()
Added example on how to use the HTTPConnection object for making GET request.
Original issue: https://github.com/python/cpython/issues/102327
---------
(cherry picked from commit 7ba6288feb)
Co-authored-by: David Foster <david@dafoster.net>
Co-authored-by: Éric <earaujo@caravan.coop>
GH-104145: Use fully-qualified cross reference types for the bisect module (GH-104172)
(cherry picked from commit 76eef552f3)
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
gh-102500: Remove mention of bytes shorthand (#104281)
The bytes shorthand was removed in PEP 688:
https://peps.python.org/pep-0688/#no-special-meaning-for-bytes
The reference to collections.abc.ByteString is also removed, since that object is deprecated (#91896) and has different semantics (#102092)
Although PEP 688 is new in Python 3.12, type checkers are expected to implement the new semantics for type annotations even if users are using an older version of Python, so this docs PR is backported to Python 3.11.
Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com>
gh-104254: Document the optional keyword-only "context" argument to Task constructor (GH-104251)
(This was added in 3.11. It was already documented for `create_task()`, but not for `Task()`.)
(cherry picked from commit 4ee2068c34)
Co-authored-by: Itamar Ostricher <itamarost@gmail.com>
GH-97950: Use new-style index directive ('builtin') (GH-104164)
* Uncomment builtin removal in pairindextypes
* Use new-style index directive ('builtin') - C API
* Use new-style index directive ('builtin') - Extending
* Use new-style index directive ('builtin') - Library
* Use new-style index directive ('builtin') - Reference
* Use new-style index directive ('builtin') - Tutorial
(cherry picked from commit f5088006ca)
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
gh-104112: link from cached_property docs to method-caching FAQ (GH-104113)
(cherry picked from commit fa86a77589)
Co-authored-by: Carl Meyer <carl@oddbird.net>
Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com>
GH-97950: Use new-style index directive ('object') (GH-104158)
* Uncomment object removal in pairindextypes
* Use new-style index directive ('object') - C API
* Use new-style index directive ('object') - Library
* Use new-style index directive ('object') - Reference
* Use new-style index directive ('object') - Tutorial
(cherry picked from commit 6ab463684b)
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
Improve assert_type phrasing (GH-104081)
I'd like to make the fact that this does nothing at runtime
really obvious, since I suspect this is unintuitive for users who are
unfamiliar with static type checking.
I thought of this because of
https://discuss.python.org/t/add-arg-check-type-to-types/26384
wherein I'm skeptical that the user really did want `assert_type`.
(cherry picked from commit 82ba6ce303)
Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com>
This removes a section of the `strftime` and `strptime` documentation that refers to a bygone era when `strftime` would return an encoded byte string.
---------
(cherry picked from commit 2aa22f72fb)
Co-authored-by: William Andrea <william.j.andrea@gmail.com>
Co-authored-by: Paul Ganssle <1377457+pganssle@users.noreply.github.com>
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
Clarify that asyncio.Server.sockets is a socket-like TransportSocket
(cherry picked from commit 1c0a9c5a1c)
Co-authored-by: Carol Willing <carolcode@willingconsulting.com>
Cc. @adriangb
The "stub documentation" in `types.rst` does already link to the
in-depth docs in `stdtypes.rst`, but the link isn't obvious for new
users. It deserves to be made more prominent.
- Issue: https://github.com/python/cpython/issues/103721
(cherry picked from commit cef542ca57)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
modernize dataclass example typing `list` rather than `List` and comment
as to that line being the alluded too error.
(cherry picked from commit 7ef614c1ad)
Co-authored-by: Allan Lago <35788148+alago1@users.noreply.github.com>
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
Clarifies that it remains None until a method checking the child process
status has been called and noticed it has terminated.
(cherry picked from commit 68f5836582)
Co-authored-by: Joshua Herman <30265+zitterbewegung@users.noreply.github.com>
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
Co-authored-by: Éric <merwok@netwok.org>
Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
Fix broken links reported by linkcheck (#103608)
gh-68654: Clarify subdirectories used by pkgutil.extend_path (GH-103701)
Clarify sub directories used by pkgutil.extend_path in the docs and the docstring
(cherry picked from commit 7bf94568a9)
Co-authored-by: Randy <69558016+san-juan1667@users.noreply.github.com>
GH-103475: cache() and lru_cache() do not have a "call once" guarantee (GH-103669)
(cherry picked from commit e5eaac6064)
Co-authored-by: Raymond Hettinger <rhettinger@users.noreply.github.com>
STRICT boundary:
- fix bitwise operations
- make default for Flag
(cherry picked from commit 2194071540)
Co-authored-by: Ethan Furman <ethan@stoneleaf.us>