Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
Fix Sphinx warning in library/http.cookies.rst (GH-112908)
gh-101100: Improve documentation for attributes on instance methods (GH-112832)
(cherry picked from commit ed21d0c1f4)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
gh-111178: Docs: fix `traverseproc`, `inquiry`, and `destructor` parameters in slot typedefs table (GH-112742)
In the slot typedefs table, the parameter of `destructor`
and the first parameter of `traverseproc` should both be
`PyObject *` rather than `void *`.
Same for `inquiry`.
(cherry picked from commit 00cce0fe49)
Co-authored-by: Christopher Chavez <chrischavez@gmx.us>
gh-101100: Fix most Sphinx nitpicks in the glossary and `stdtypes.rst` (GH-112757)
(cherry picked from commit e3f670e137)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
gh-101100: Fix many easily solvable Sphinx nitpicks in the datamodel docs (GH-112737)
(cherry picked from commit 2f20cafdbf)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
Standardize PyUnicode C API parameter names across the documentation.
(cherry picked from commit b31232ddf7)
Co-authored-by: Rune Tynan <runetynan@gmail.com>
gh-101100: Fix Sphinx warning in `library/gettext.rst` (GH-112668)
(cherry picked from commit 489aeac3a2)
Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
gh-101100: Fix most Sphinx nitpicks in `inspect.rst` (GH-112662)
(cherry picked from commit 45650d1c47)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
Use author link to 'The Perils of Floating Point'.
(cherry picked from commit c27b09c813)
Co-authored-by: Marco Aurélio A. Barbosa <aureliobarbosa@gmail.com>
[3.12] gh-112316: improve docs for `inspect.signature` and `inspect.Signature` (GH-112631) (GH-112649)
(cherry-picked from commit fc9e24b01f)
(cherry picked from commit 6221482f0c)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
Docs: fix markup for `importlib.machinery.NamespaceLoader` (GH-112479)
(cherry picked from commit 2e632fa07d)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
Backport PR #112477: correct socket AF_PACKET docs
Network byte order is not involved in the `int` on the Python side.
That happens under the hood.
Correctly use the term addresses instead of packets.
* Remove mention of "vsapi" element type from the documentation.
* Add tests for element_create() and other ttk.Style methods.
* Add examples for element_create() in the documentation.
(cherry picked from commit 005d1e8fc8)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
gh-101100: Define `_tkinter` module to fix references (GH-112382)
Define _tkinter module to fix references
(cherry picked from commit 6b961b8cea)
Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
gh-101100: Define `test.regrtest` module to fix references (GH-112381)
Define test.regrtest module to fix references
(cherry picked from commit d525d01e27)
Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
gh-59254: mention in open() doc that line buffering is for writing (GH-112318)
(cherry picked from commit fafae08cc7)
Co-authored-by: Irit Katriel <1055913+iritkatriel@users.noreply.github.com>
Fix docstring and var name of itertools recipe (GH-112113)
`prepend()` works with arbitrary iterables, not only iterators. In fact,
the example given uses a `list`, which is iterable, but not an iterator.
(cherry picked from commit 6c47eaccfa)
Co-authored-by: Sebastian Rittau <srittau@rittau.biz>
gh-112165: Fix typo in `__main__.py` (GH-112183)
Change '[2]' to '[1]' to get second argument.
(cherry picked from commit 8cd70eefc7)
Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
gh-110812: Isolating Extension Modules HOWTO: List GC-related gotchas (GH-111504)
(cherry picked from commit 985679f05d)
Co-authored-by: Petr Viktorin <encukou@gmail.com>
Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
Co-authored-by: Eric Snow <ericsnowcurrently@gmail.com>
Docs: Add the time to the HTML last updated format (GH-110091)
(cherry picked from commit 6c214dea7c)
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
Augment the list of places where parentheses are
required around assignnment statements. In particular,
'a := 0' and 'a = b := 1' are syntax errors.
(cherry picked from commit 9a2f25d374)
Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
gh-111895: Convert definition list to bullet list for readability on mobile (GH-111898)
Convert definition list to bullet list for readability on mobile
(cherry picked from commit 7d21e3d5ee)
Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
Update old link in bugs.rst to the table of doc translators and translation repositories at Github.
(cherry picked from commit 72e27a67b9)
Co-authored-by: partev <petrosyan@gmail.com>
gh-111724: Fix doctest `ResourceWarning` in `howto/descriptor.rst` (GH-111725)
Close database connection explicitly in test cleanup.
(cherry picked from commit f48e669504)
Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
Co-authored-by: Prometheus3375 <35541026+Prometheus3375@users.noreply.github.com>
Co-authored-by: Stanley <46876382+slateny@users.noreply.github.com>
Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
Fix locale.LC_CTYPE documentation to no longer mention string.lower() et al. Those functions were removed in Python 3.0:
https://docs.python.org/2/library/string.htmlGH-deprecated-string-functions
Also, fix a comment in logging about locale-specific behavior of `str.lower()`.
(cherry picked from commit 6d42759c5e)
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
Add a guide for how to handle non-UTF-8 text encodings.
Link to that guide from the 'text_factory' docs.
(cherry picked from commit 1262e41842)
Co-authored-by: Erlend E. Aasland <erlend@python.org>
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
Co-authored-by: C.A.M. Gerlach <CAM.Gerlach@Gerlach.CAM>
Co-authored-by: Corvin <corvin@corvin.dev>
Co-authored-by: Ezio Melotti <ezio.melotti@gmail.com>
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Remove no longer used functions run_unittest() and run_doctest() from
the test.support module.
(cherry picked from commit f6a45a03d0)
(cherry picked from commit 5c4f9a1c7e)
Revert "Fix a code snippet typo in asyncio docs (GH-108427)" (GH-111271)
This reverts commit 7f31676340.
The change resulted in a tautology and should not have been made. There
may be an opportunity for additional clarity in this section, but this
change wasn't it :)
(cherry picked from commit c7d68f907a)
Ref: https://github.com/python/cpython/pull/108427#-issuecomment-1777525740
Co-authored-by: Zachary Ware <zach@python.org>
gh-101100: Fix Sphinx warnings in `library/tty.rst` (GH-111079)
Fix Sphinx warnings in library/tty.rst
(cherry picked from commit c42c68aa7b)
Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
C-API docs: Clarify the size of arenas (GH-110895)
Clarify the size of arenas
From 3.10.0 alpha 7, the pymalloc allocator uses arenas with a fixed size of 1
MiB on 64-bit platforms instead of 256 KiB on 32-bit platforms.
(cherry picked from commit f07ca27709)
Co-authored-by: Mienxiu <82512658+mienxiu@users.noreply.github.com>
(cherry picked from commit d1f7fae424)
* Remove the content of the Argument Clinic HOWTO
* Update cross-references to the Argument Clinic
* Add a note directing readers to the devguide
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
Remove unused `SPHINXLINT` var from `Doc/Makefile`. (GH-110570)
Remove unused `SPHINXLINT` var.
(cherry picked from commit bdbe43c7d0)
Co-authored-by: Ezio Melotti <ezio.melotti@gmail.com>
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>
gh-110534 fix a URL redirect to wikipedia article on Fibonacci numbers (GH-110535)
(cherry picked from commit 892ee72b36)
Co-authored-by: partev <petrosyan@gmail.com>
Bump various dependencies in `Doc/requirements-oldest-sphinx.txt` (GH-110278)
This resolves a Dependabot security alert on the repository for urllib3==2.0.4.
(cherry picked from commit f1663a492e)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
[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-107298: Document PyMODINIT_FUNC macro (#109236)
Document PyMODINIT_FUNC macro.
Remove links to PyAPI_FUNC() and PyAPI_DATA() macros since they are
not documented. These macros should only be used to define the Python
C API. They should not be used outside Python code base.
(cherry picked from commit d7a27e527d)
GH-95913: Add the release date for Python 3.11 (GH-109750)
(cherry picked from commit b10de68c6c)
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
GH-109209: Bump the minimum Sphinx version to 4.2 (GH-109210)
(cherry picked from commit 712cb173f8)
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.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)
When overriding the `__new__` method of an enum, the underlying data type should be created directly; i.e. .
member = object.__new__(cls)
member = int.__new__(cls, value)
member = str.__new__(cls, value)
Calling `super().__new__()` finds the lookup version of `Enum.__new__`, and will now raise an exception when detected.
(cherry picked from commit d48760b2f1)
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>
* Express functions which take argument as a C string in terms of
functions which take Python object.
* Use "note" directive for PyMapping_HasKey() and
PyMapping_HasKeyString() notes.
(cherry picked from commit 6f97eeec22)
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>
* [3.11] Datamodel: Add headings to the standard type hierarchy (GH-108146)
Dedent content according to the new layout..
(cherry picked from commit 2b7bff0655)
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
* Fix indentation
https://docs.python.org/3/howto/pyporting.html was written for another time. In this patch:
- material that frames Python 3 as "new" is removed
- descriptions and directions have been trimmed
(cherry picked from commit 809ea7c4b6)
Co-authored-by: Daniele Procida <daniele@vurt.org>
gh-70766: Mention the object getstate caveat in 3.11 What's new. (GH-108379)
(cherry picked from commit b6be18812c)
Co-authored-by: Gregory P. Smith <greg@krypto.org>
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>
When changing docs, it was easy to find text in topics.py, and I
wondered whether I was supposed to edit it. Thankfully, the top of the
file says it's auto-generated, so I knew I didn't have to edit it. But I
didn't know what started the auto-generation process.
It's part of the release process, so I'll leave a note here for future
editors.
(cherry picked from commit dac1e36490)
Co-authored-by: Ned Batchelder <ned@nedbatchelder.com>
(cherry picked from commit 8f3d09bf5d)
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
Co-authored-by: Hugo van Kemenade <hugovk@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>
* Use full qualified names for references (even if they do not work now,
they will work in future).
* Silence references to examples.
(cherry picked from commit 622ddc4167)
(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>
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
Resolve reference warnings in faq/programming.rst (GH-108150)
(cherry picked from commit a390ec20f5)
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
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>
GH-92584: Redirect macOS package installation to the PPUG (GH-108044)
(cherry picked from commit 902864256c)
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
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>
Do not use deprecated ``logger.warn()`` in pyspecific (GH-107694)
(cherry picked from commit 9564e31cbc)
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
Docs: skip python-docs-theme 2023.7 to fix mobile menu (GH-107666)
(cherry picked from commit 9641c4d8e2)
Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.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-107432 Fix incorrect indentation in annotations HOWTO (GH-107445)
gh-107432 Fix incorrect indentation in annotations document
Body text in https://docs.python.org/3/howto/annotations.html was
indented throughout, and was being rendered in blockquote elements.
(cherry picked from commit 5e2746d6e2)
Co-authored-by: Daniele Procida <daniele@vurt.org>
Summarise the goals of Argument Clinic in a single sentence.
Mention that Argument Clinic was introduced with PEP-436.
(cherry picked from commit abb71c6a8f)
Co-authored-by: Erlend E. Aasland <erlend@python.org>
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>
Declare the following functions as macros, since they are actually
macros. It avoids a warning on "TYPE" or "macro" argument.
* PyMem_New()
* PyMem_Resize()
* PyModule_AddIntMacro()
* PyModule_AddStringMacro()
* PyObject_GC_New()
* PyObject_GC_NewVar()
* PyObject_New()
* PyObject_NewVar()
(cherry picked from commit 8d61a71f9c)
Co-authored-by: Victor Stinner <vstinner@python.org>
Bump some docs dependencies to resolve a Dependabot security alert (GH-107341)
(cherry picked from commit f84d77b4e0)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
Add targets for PyStructSequence_Desc and PyStructSequence_Field members
and macros like Py_EQ.
Fix target for Py_RETURN_RICHCOMPARE.
(cherry picked from commit abec9a1b20)