Commit graph

13142 commits

Author SHA1 Message Date
Miss Islington (bot)
ea143e67b3
[3.12] gh-85046: Document errno constants (GH-126420) (#129384)
(cherry picked from commit 1c3bb200da)

Co-authored-by: RUANG (James Roy) <longjinyii@outlook.com>
2025-01-28 00:20:13 +00:00
Miss Islington (bot)
22c1d895fc
[3.12] gh-129020: Remove ambiguous sentence from tokenize.untokenize docs (GH-129021) (#129036)
gh-129020: Remove ambiguous sentence from `tokenize.untokenize` docs (GH-129021)
(cherry picked from commit bca35f0e78)

Co-authored-by: Tomas R <tomas.roun8@gmail.com>
2025-01-20 00:12:39 +00:00
Miss Islington (bot)
104d37ad99
[3.12] gh-121542: Document trailing newline behavior in set_content() (GH-121543) (#128996)
gh-121542: Document trailing newline behavior in `set_content()` (GH-121543)
(cherry picked from commit fba475ae6f)

Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
Co-authored-by: Yizheng Meng <dev@rapidcow.org>
2025-01-18 18:41:59 +00:00
Bénédikt Tran
3d9b14c19b
[3.12] gh-125997: suggest efficient alternatives for time.sleep(0) (GH-128752) (#128985) 2025-01-18 11:13:03 +00:00
Miss Islington (bot)
1c85f1bc44
[3.12] gh-128017: Make a note that sys variables are read-only (GH-128887) (#128909)
gh-128017: Make a note that sys variables are read-only (GH-128887)
(cherry picked from commit 313b96eb8b)

Co-authored-by: Srinivas Reddy Thatiparthy (తాటిపర్తి శ్రీనివాస్  రెడ్డి) <thatiparthysreenivas@gmail.com>
2025-01-16 10:23:48 +00:00
Miss Islington (bot)
0308bcfa04
[3.12] gh-97850: Suggest TraversableResources as the alternative for ResourceLoader (GH-128601) (GH-128896)
gh-97850: Suggest `TraversableResources` as the alternative for `ResourceLoader` (GH-128601)

Suggest TraversableResources as the alternative for ResourceLoader.

Previously, ResourceReader was the suggested alternative, but it
is itself deprecated in favour of TraversableResources.
(cherry picked from commit 256d6d2131)

Co-authored-by: Tomas R <tomas.roun8@gmail.com>
2025-01-15 20:55:06 +00:00
Miss Islington (bot)
85255c4df2
[3.12] gh-67206: Document that string.printable is not printable in the POSIX sense (GH-128820) (#128867)
gh-67206: Document that `string.printable` is not printable in the POSIX sense (GH-128820)
(cherry picked from commit d906bde250)

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2025-01-15 14:28:21 +00:00
Miss Islington (bot)
54c9597a50
[3.12] Fix a "doctest" block in Doc/library/turtle.rst (GH-128831) (#128836)
Fix a "doctest" block in `Doc/library/turtle.rst` (GH-128831)
(cherry picked from commit 1598e18a65)

Co-authored-by: Rafael Fontenelle <rffontenelle@users.noreply.github.com>
2025-01-14 15:26:46 +00:00
Miss Islington (bot)
8448552579
[3.12] gh-123345: improve fnmatch docs (GH-123346) (#128775)
gh-123345: improve `fnmatch` docs (GH-123346)
(cherry picked from commit 29fe8072cf)

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2025-01-13 10:40:22 +00:00
Miss Islington (bot)
8bfc68f0f5
[3.12] gh-124433: fix docs for asyncio.Queue.task_done (GH-128669) (#128672)
gh-124433: fix docs for `asyncio.Queue.task_done` (GH-128669)
(cherry picked from commit 4322a318ea)

Co-authored-by: Kumar Aditya <kumaraditya@python.org>
2025-01-09 12:28:15 +00:00
Miss Islington (bot)
182234f5ea
[3.12] gh-126137: improve docs for loop.add_reader and loop.add_writer (GH-128666) (#128668)
gh-126137: improve docs for `loop.add_reader` and `loop.add_writer` (GH-128666)
(cherry picked from commit b2adf55674)

Co-authored-by: Kumar Aditya <kumaraditya@python.org>
2025-01-09 10:18:23 +00:00
Miss Islington (bot)
a784cdf6e7
[3.12] gh-79149: document reentrant safety of loop.call_soon_threadsafe (GH-128662) (#128665)
gh-79149: document reentrant safety of `loop.call_soon_threadsafe` (GH-128662)
(cherry picked from commit 4685401845)

Co-authored-by: Kumar Aditya <kumaraditya@python.org>
Co-authored-by: Thomas Grainger <tagrain@gmail.com>
2025-01-09 09:26:40 +00:00
Miss Islington (bot)
e903b8ad13
[3.12] gh-87506: Document that json.load*() can raise UnicodeDecodeError (GH-127355) (#128608)
(cherry picked from commit 15372d0112)
(cherry picked from commit cdfb8bc93a)

Co-authored-by: Srinivas Reddy Thatiparthy (తాటిపర్తి శ్రీనివాస్  రెడ్డి) <thatiparthysreenivas@gmail.com>
Co-authored-by: Erlend Aasland <erlend@python.org>
2025-01-08 08:51:19 +00:00
Miss Islington (bot)
82b061d711
[3.12] Docs: mark up json.load() using parameter list (GH-128488) (#128597)
(cherry picked from commit a21e31ec54)

Co-authored-by: Erlend E. Aasland <erlend@python.org>
2025-01-07 21:14:50 +00:00
Miss Islington (bot)
adddbc3de9
[3.12] gh-108202: Document calendar.Calendar.firstweekday (GH-128566) (#128580)
(cherry picked from commit b3cbd8f1b5)

Co-authored-by: Erlend E. Aasland <erlend@python.org>
2025-01-07 08:06:52 +00:00
Miss Islington (bot)
fb8bb36f56
[3.12] gh-108202: Document calendar.Calendar methods getfirstweekday and setfirstweekday (GH-127579) (#128565)
(cherry picked from commit 953b49e546)

Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
2025-01-06 23:46:16 +00:00
Miss Islington (bot)
8ba72caf26
[3.12] gh-114990: Add missing mixin methods in collections.abc's document (GH-114991) (#128536)
Co-authored-by: AN Long <aisk@users.noreply.github.com>
Co-authored-by: Carol Willing <carolcode@willingconsulting.com>
2025-01-06 10:04:57 +00:00
Miss Islington (bot)
4016be2775
[3.12] Docs: fix MessageDefect references in email.policy docs (GH-128468) (#128527)
(cherry picked from commit 3b231be8f0)

Co-authored-by: Yuki Kobayashi <drsuaimqjgar@gmail.com>
2025-01-05 22:05:48 +00:00
Miss Islington (bot)
e3e4852fe0
[3.12] Docs: amend json.dump() post gh-128482 (GH-128489) (#128494)
(cherry picked from commit 87ee76062a)

Co-authored-by: Erlend E. Aasland <erlend@python.org>
2025-01-04 19:04:13 +00:00
Miss Islington (bot)
98d3f2bc6e
[3.12] gh-126719: Clarify math.fmod docs (GH-127741) (#128492)
(cherry picked from commit f28d471fbe)

Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2025-01-04 17:45:19 +00:00
Miss Islington (bot)
731fc4052c
[3.12] Docs: mark up json.dump() using parameter list (GH-128482) (#128487)
(cherry picked from commit a0088b40bb)

Co-authored-by: Erlend E. Aasland <erlend@python.org>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2025-01-04 15:50:55 +00:00
Miss Islington (bot)
0d3f4b6a2f
[3.12] gh-108202: Document calendar.TextCalendar formatting helpers (GH-127608) (#128441)
Document the following TextCalendar methods:
- formatday()
- formatmonthname()
- formatweekday()
- formatweekheader()

(cherry picked from commit bb73426caf)

Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
2025-01-03 10:03:38 +00:00
Miss Islington (bot)
487caa9579
[3.12] gh-128349: Use .. data:: instead of .. class:: for pre-defined decimal Context objects (GH-128379) (#128402)
gh-128349: Use `.. data::` instead of `.. class::` for pre-defined decimal `Context` objects (GH-128379)
(cherry picked from commit 60c6518469)

Co-authored-by: abkmystery <36216019+abkmystery@users.noreply.github.com>
2025-01-02 07:30:39 +00:00
Miss Islington (bot)
b22d0fcbe1
[3.12] gh-128317: Document calendar.TextCalendar.formatweek (GH-128353) (#128358)
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2024-12-30 19:40:31 +02:00
Miss Islington (bot)
34ea7bf56f
[3.12] gh-122706: fix docs for asyncio ssl sockets (GH-128092) (#128093)
gh-122706: fix docs for asyncio ssl sockets (GH-128092)
(cherry picked from commit 19c5134d57)

Co-authored-by: Kumar Aditya <kumaraditya@python.org>
2024-12-19 18:25:54 +05:30
Miss Islington (bot)
073b52bc53
[3.12] Fix typo in itertools docs (gh-127995) (gh-127997) 2024-12-16 11:18:15 -06:00
Miss Islington (bot)
3d7b5b369a
[3.12] gh-127852: add remark about ',' separator (GH-127854) (#127942)
Specify that it is valid for floats and ints with 'd' presentation and an error otherwise.
---------

(cherry picked from commit e2325c9db0)

Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>
Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
2024-12-14 13:37:00 +00:00
Miss Islington (bot)
793059eb4c
[3.12] link to the correct output method in documentation (GH-127857) (#127901)
link to the correct output method in documentation (GH-127857)
(cherry picked from commit 11ff3286b7)

Co-authored-by: Viktor Kálmán <kviktor@users.noreply.github.com>
2024-12-13 15:07:59 +05:30
Miss Islington (bot)
9081ea4135
[3.12] Fix typo in traceback docs (GH-127884) (#127891)
Co-authored-by: Daniel Haag <121057143+denialhaag@users.noreply.github.com>
2024-12-12 21:54:23 +00:00
Miss Islington (bot)
019e858529
[3.12] Docs: Fix indents in xmlrpc.client.rst (GH-127782) (#127800)
Docs: Fix indents in `xmlrpc.client.rst` (GH-127782)
(cherry picked from commit 035f512046)

Co-authored-by: Yuki Kobayashi <drsuaimqjgar@gmail.com>
2024-12-10 17:44:45 +00:00
Miss Islington (bot)
8159d0c39e
[3.12] gh-101100: Fix sphinx warnings in whatsnew/3.0.rst (GH-127662) (#127784)
Co-authored-by: Yuki Kobayashi <drsuaimqjgar@gmail.com>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2024-12-10 10:52:22 +00:00
Miss Islington (bot)
8e3c2d2425
[3.12] gh-127347: Document traceback.print_list (GH-127348) (#127570)
Add an documentation entry about `traceback.print_list`

Co-authored-by: Tomas R. <tomas.roun8@gmail.com>
2024-12-04 10:29:10 +02:00
Thomas Wouters
2dc476bcb9 Python 3.12.8 2024-12-03 19:42:41 +01:00
Miss Islington (bot)
49da170709
[3.12] gh-116510: Fix a Crash Due to Shared Immortal Interned Strings (gh-125205)
Fix a crash caused by immortal interned strings being shared between
sub-interpreters that use basic single-phase init. In that case, the string
can be used by an interpreter that outlives the interpreter that created and
interned it. For interpreters that share obmalloc state, also share the
interned dict with the main interpreter.

This is an un-revert of gh-124646 that then addresses the Py_TRACE_REFS
failures identified by gh-124785 (i.e. backporting gh-125709 too).

(cherry picked from commit f2cb399470, AKA gh-124865)

Co-authored-by: Eric Snow <ericsnowcurrently@gmail.com>
2024-12-03 10:26:25 -07:00
Miss Islington (bot)
179b134014
[3.12] gh-101100: Fix Sphinx warnings about list methods (GH-127054) (#127512)
Co-authored-by: Yuki Kobayashi <drsuaimqjgar@gmail.com>
2024-12-02 14:01:46 +00:00
Miss Islington (bot)
22f8e430f8
[3.12] gh-99880: document rounding mode for new-style formatting (GH-121481) (#126335)
The CPython uses _Py_dg_dtoa(), which does rounding to nearest with half
to even tie-breaking rule.

If that functions is unavailable, PyOS_double_to_string() fallbacks to
system snprintf().  Since CPython 3.12, build requirements include C11
compiler *and* support for IEEE 754 floating point numbers (Annex F).
This means that FE_TONEAREST macro is available and, per default,
printf-like functions should use same rounding mode as _Py_dg_dtoa().

(cherry picked from commit 7d7d56d8b1)

Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2024-12-02 14:52:49 +01:00
Bénédikt Tran
ea8a85bb9e
[3.12] Link to correct class methods in asyncio primitives docs (GH-127270) (#127438) 2024-11-30 10:02:07 +00:00
Miss Islington (bot)
91399c3984
[3.12] gh-127303: Add docs for token.EXACT_TOKEN_TYPES (GH-127304) (#127391)
gh-127303: Add docs for token.EXACT_TOKEN_TYPES (GH-127304)

---------

(cherry picked from commit dd3a87d2a8)

Co-authored-by: Илья Любавский <100635212+lubaskinc0de@users.noreply.github.com>
Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
Co-authored-by: Tomas R. <tomas.roun8@gmail.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2024-11-29 09:22:27 +00:00
Rafael Fontenelle
3806772b3d
[3.12] Fix a few typos found in the docs (GH-127126) (GH-127185)
(cherry picked from commit 39e60aeb38)
2024-11-25 11:48:00 -08:00
Miss Islington (bot)
b52ab48a10
[3.12] Improve pathname2url() and url2pathname() docs (GH-127125) (#127233)
Improve `pathname2url()` and `url2pathname()` docs (GH-127125)

These functions have long sown confusion among Python developers. The
existing documentation says they deal with URL path components, but that
doesn't fit the evidence on Windows:

    >>> pathname2url(r'C:\foo')
    '///C:/foo'
    >>> pathname2url(r'\\server\share')
    '////server/share'  # or '//server/share' as of quite recently

If these were URL path components, they would imply complete URLs like
`file://///C:/foo` and `file://////server/share`. Clearly this isn't right.
Yet the implementation in `nturl2path` is deliberate, and the
`url2pathname()` function correctly inverts it.

On non-Windows platforms, the behaviour until quite recently is to simply
quote/unquote the path without adding or removing any leading slashes. This
behaviour is compatible with *both* interpretations -- 1) the value is a
URL path component (existing docs), and 2) the value is everything
following `file:` (this commit)

The conclusion I draw is that these functions operate on everything after
the `file:` prefix, which may include an authority section. This is the
only explanation that fits both the  Windows and non-Windows behaviour.
It's also a better match for the function names.
(cherry picked from commit 307c633586)

Co-authored-by: Barney Gale <barney.gale@gmail.com>
2024-11-24 17:48:12 +00:00
Serhiy Storchaka
29648980d4
[3.12] gh-127001: Fix PATHEXT issues in shutil.which() on Windows (GH-127035) (GH-127158)
* Name without a PATHEXT extension is only searched if the mode does not
  include X_OK.
* Support multi-component PATHEXT extensions (e.g. ".foo.bar").
* Support files without extensions in PATHEXT contains dot-only extension
  (".", "..", etc).
* Support PATHEXT extensions that end with a dot (e.g. ".foo.").
(cherry picked from commit 8899e85de1)
2024-11-22 16:33:50 +00:00
Miss Islington (bot)
32bc8e83db
[3.12] GH-122679: Add register() to argparse docs (GH-126939) (GH-127148)
(cherry picked from commit fcfdb55465)

Co-authored-by: Savannah Ostrowski <savannahostrowski@gmail.com>
2024-11-22 14:13:43 +00:00
Jun Komoda
caad9047cb
[3.12] gh-127082: Replace "Windows only" with the availability: Windows in ctypes doc (GH-127099) (#127145)
(cherry picked from commit 3c770e3f09)
2024-11-22 14:08:37 +01:00
Serhiy Storchaka
4b4e0dbdf4
[3.12] gh-126727: Fix locale.nl_langinfo(locale.ERA) (GH-126730) (GH-127098)
It now returns multiple era description segments separated by semicolons.
Previously it only returned the first segment on platforms with Glibc.
(cherry picked from commit 4803cd0244)
2024-11-21 11:44:37 +00:00
Miss Islington (bot)
797a6327cc
[3.12] Added a warning to the urljoin docs, indicating that it is not safe to use with attacker controlled URLs (GH-126659) (#126889)
Added a warning to the urljoin docs, indicating that it is not safe to use with attacker controlled URLs (GH-126659)

This was flagged to me at a party today by someone who works in red-teaming as a frequently encountered footgun. Documenting the potentially unexpected behavior seemed like a good place to start.
(cherry picked from commit d6bcc154e9)

Co-authored-by: Alex Gaynor <alex.gaynor@gmail.com>
2024-11-15 23:17:37 +00:00
Miss Islington (bot)
ef0a0059e1
[3.12] gh-123832: Adjust socket.getaddrinfo docs for better POSIX compliance (GH-126182) (GH-126824)
gh-123832: Adjust `socket.getaddrinfo` docs for better POSIX compliance (GH-126182)

* gh-123832: Adjust `socket.getaddrinfo` docs for better POSIX compliance

This changes nothing changes for CPython supported platforms,
but hints how to deal with platforms that stick to the letter of
the spec.
It also marks `socket.getaddrinfo` as a wrapper around `getaddrinfo(3)`;
specifically, workarounds to make the function work consistently across
platforms are out of scope in its code.

Include wording similar to the POSIX's “by providing options and by
limiting the returned information”, which IMO suggests that the
hints limit the resulting list compared to the defaults, *but* can
be interpreted differently. Details are added in a note.

Specifically say that this wraps the underlying C function. So, the
details are in OS docs. The “full range of results” bit goes away.

Use `AF_UNSPEC` rather than zero for the *family* default, although
I don't think a system where it's nonzero would be very usable.

Suggest setting proto and/or type (with examples, as the appropriate
values aren't obvious). Say why you probably want to do that that
on all systems; mention the behavior on the “letter of the spec”
systems.

Suggest that the results should be tried in order, which is,
AFAIK best practice -- see RFC 6724 section 2, and its predecessor
from 2003 (which are specific to IP, but indicate how people use this):

> Well-behaved applications SHOULD iterate through the list of
> addresses returned from `getaddrinfo()` until they find a working address.

(cherry picked from commit ff0ef0a54b)

Co-authored-by: Petr Viktorin <encukou@gmail.com>
Co-authored-by: Carol Willing <carolcode@willingconsulting.com>
2024-11-15 14:07:04 +01:00
Miss Islington (bot)
3ed99b3eb3
[3.12] gh-126731: Update outdated project information in pprint.pp doc (GH-126732) (#126819)
gh-126731: Update outdated project information in `pprint.pp` doc (GH-126732)
(cherry picked from commit 6a93a1adbb)

Co-authored-by: Wulian <xiguawulian@gmail.com>
2024-11-14 05:08:18 +00:00
Ned Batchelder
73dedbd223
[3.12] Docs: re-create pages for removed modules to document their removal, based on GH-126622 (#126781)
[3.12] Docs: re-create pages for removed modules to document their removal, based on #126622
2024-11-13 19:02:09 -05:00
Miss Islington (bot)
5cd35fb8e0
Update documentation links to Microsoft's documentation pages (GH-126379)
(cherry picked from commit 6e25eb1541)

Co-authored-by: 谭九鼎 <109224573@qq.com>
2024-11-11 17:20:33 +00:00
Miss Islington (bot)
55c5305690
[3.12] gh-126543: Docs: change "bound type var" to "bounded" when used in the context of the 'bound' kw argument to TypeVar (GH-126584) (#126658)
(cherry picked from commit 434b29767f)

Co-authored-by: Pedro Fonini <fonini@protonmail.ch>
2024-11-10 18:52:20 -08:00