Commit graph

13485 commits

Author SHA1 Message Date
Ethan Furman
875e49fb63
[3.13] gh-112328: Make EnumDict usable on its own and document it (GH-123669) (GH-128142)
Co-authored-by: Petr Viktorin <pviktori@redhat.com>
2024-12-24 10:50:23 -08:00
Miss Islington (bot)
6f3c2c8d04
[3.13] gh-126180: Remove getopt and optparse deprecation notices (GH-128191)
* Remove getopt and optparse deprecation notices
* Add new docs sections for command line app helper libraries
* Add guidance on choosing a CLI parsing library to the optparse docs
* Link to the new guidance from the argparse and getopt docs
* Reword intro in docs section for superseded stdlib modules
* Reframe the optparse->argparse guide as a migration guide
  rather than as an upgrade guide

---------
(cherry picked from commit 831b6de6d7)

Co-authored-by: Alyssa Coghlan <ncoghlan@gmail.com>
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2024-12-23 04:40:59 +00:00
Miss Islington (bot)
f8e7b5cc8d
[3.13] gh-122706: fix docs for asyncio ssl sockets (GH-128092) (#128094)
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:26:05 +05:30
Miss Islington (bot)
71a1e79134
[3.13] Minor readability improvements for the itertools recipes (gh-127928) (gh-127999) 2024-12-16 17:33:20 +00:00
Miss Islington (bot)
28e684b330
[3.13] Simplify and speed-up an itertools recipe (gh-127848) (gh-127998) 2024-12-16 11:26:58 -06:00
Miss Islington (bot)
231c93923d
[3.13] Fix typo in itertools docs (gh-127995) (gh-127996) 2024-12-16 11:20:14 -06:00
Miss Islington (bot)
89f4b23f9e
[3.13] Clarify ast docs to use a less confusing example for ast.ParamSpec (GH-127955) (#127959)
Clarify ast docs to use a less confusing example for `ast.ParamSpec` (GH-127955)

Fix typo in ast docs: ParamSpec defaults
(cherry picked from commit 7900a85019)

Co-authored-by: Steve C <diceroll123@gmail.com>
2024-12-15 12:35:25 +00:00
Miss Islington (bot)
9c6bd272b4
[3.13] gh-127852: add remark about ',' separator (GH-127854) (#127941)
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:34:18 +00:00
Miss Islington (bot)
8384279863
[3.13] link to the correct output method in documentation (GH-127857) (#127900)
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:46 +05:30
Miss Islington (bot)
d3d478eff1
[3.13] Fix typo in traceback docs (GH-127884) (#127890)
Co-authored-by: Daniel Haag <121057143+denialhaag@users.noreply.github.com>
2024-12-12 21:51:10 +00:00
Miss Islington (bot)
c6c9ff56a5
[3.13] Docs: Fix indents in xmlrpc.client.rst (GH-127782) (#127799)
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:41:01 +00:00
Miss Islington (bot)
00d60623e9
[3.13] gh-101100: Fix sphinx warnings in whatsnew/3.0.rst (GH-127662) (#127783)
Co-authored-by: Yuki Kobayashi <drsuaimqjgar@gmail.com>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2024-12-10 10:45:30 +00:00
Miss Islington (bot)
a1c52d1265
[3.13] gh-127347: Document traceback.print_list (GH-127348) (#127569)
Add an documentation entry about `traceback.print_list`

Co-authored-by: Tomas R. <tomas.roun8@gmail.com>
2024-12-04 10:28:14 +02:00
Miss Islington (bot)
bb46b74d9d
[3.13] Itertool recipe additions (gh-127483) (gh-127585) 2024-12-03 18:34:42 -06:00
Thomas Wouters
0671451779 Python 3.13.1 2024-12-03 18:59:52 +01:00
Miss Islington (bot)
d9bbb52c7e
[3.13] gh-122838: Document missing opcodes (GH-123073) (#126492)
gh-122838: Document missing opcodes (GH-123073)
(cherry picked from commit 9cba47d9f1)

Co-authored-by: Kamil Turek <kamil.turek@hotmail.com>
2024-12-02 15:07:38 +01:00
Miss Islington (bot)
23ab1f9ff1
[3.13] gh-99880: document rounding mode for new-style formatting (GH-121481) (#126334)
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 15:05:13 +01:00
Miss Islington (bot)
26f1e88aae
[3.13] gh-101100: Fix Sphinx warnings about list methods (GH-127054) (#127511)
Co-authored-by: Yuki Kobayashi <drsuaimqjgar@gmail.com>
2024-12-02 13:57:40 +00:00
Miss Islington (bot)
4cba0e66c2
[3.13] gh-127303: Add docs for token.EXACT_TOKEN_TYPES (GH-127304) (#127390)
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-30 08:13:13 +00:00
Miss Islington (bot)
ee57221872
[3.13] Link to correct class methods in asyncio primitives docs (GH-127270) (#127423)
Link to correct class methods in asyncio primitives docs (GH-127270)
(cherry picked from commit 15d6506d17)

Co-authored-by: Ollanta Cuba Gyllensten <ollantaster@gmail.com>
2024-11-29 16:26:42 +00:00
Miss Islington (bot)
d5a08f0ecb
[3.13] Fix indentation for contextlib.asynccontextmanager docs (GH-127333) (#127334)
Fix indentation for contextlib.asynccontextmanager docs (GH-127333)
(cherry picked from commit 9328db7652)

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2024-11-27 14:45:07 +00:00
Miss Islington (bot)
a6e61fd9d8
[3.13] Improve pathname2url() and url2pathname() docs (GH-127125) (#127232)
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:46:54 +00:00
Miss Islington (bot)
a8e69fc68d
[3.13] gh-126896: Fix docs about asyncio.start_server() (GH-126897) (GH-126934)
gh-126896: Fix docs about `asyncio.start_server()` (GH-126897)
(cherry picked from commit 0c5c80928c)

Co-authored-by: beavailable <beavailable@proton.me>
2024-11-23 18:55:58 -08:00
Miss Islington (bot)
9291095a74
[3.13] Fix a few typos found in the docs (GH-127126) (GH-127181)
Fix a few typos found in the docs (GH-127126)
(cherry picked from commit 39e60aeb38)

Co-authored-by: Rafael Fontenelle <rffontenelle@users.noreply.github.com>
2024-11-23 00:09:35 +00:00
Miss Islington (bot)
7f22b87d35
[3.13] gh-127001: Fix PATHEXT issues in shutil.which() on Windows (GH-127035) (GH-127156)
* 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)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2024-11-22 16:18:44 +00:00
Miss Islington (bot)
1b58c0f308
[3.13] GH-122679: Add register() to argparse docs (GH-126939) (GH-127149)
(cherry picked from commit fcfdb55465)

Co-authored-by: Savannah Ostrowski <savannahostrowski@gmail.com>
2024-11-22 16:12:05 +02:00
Jun Komoda
af00c58652
[3.13] gh-127082: Replace "Windows only" with the availability: Windows in ctypes doc (GH-127099) (#127144)
(cherry picked from commit 3c770e3f09)
2024-11-22 14:09:53 +01:00
Serhiy Storchaka
6e5e7bc5f8
[3.13] gh-126727: Fix locale.nl_langinfo(locale.ERA) (GH-126730) (GH-127097)
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:49:19 +00:00
Sergey B Kirpichev
190d710e68
[3.13] Doc: Reorganize math module documentation (GH-126337) (#126998)
(cherry picked from commit ce453e6c2f)

Co-authored-by: Joseph Martinot-Lagarde <contrebasse@gmail.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2024-11-19 09:02:01 +01:00
Miss Islington (bot)
9b06a8d2f5
[3.13] Docs: re-create pages for removed modules to document their removal. (GH-126622) (#126709)
Co-authored-by: Ned Batchelder <ned@nedbatchelder.com>
2024-11-17 22:20:32 +02:00
Miss Islington (bot)
c8962104f2
[3.13] Added a warning to the urljoin docs, indicating that it is not safe to use with attacker controlled URLs (GH-126659) (#126888)
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:15:27 +00:00
Miss Islington (bot)
9a02690513
[3.13] gh-123832: Adjust socket.getaddrinfo docs for better POSIX compliance (GH-126182) (GH-126825)
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:06:57 +01:00
Miss Islington (bot)
75d643166c
[3.13] gh-126731: Update outdated project information in pprint.pp doc (GH-126732) (#126818)
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:04:03 +00:00
Miss Islington (bot)
02cd3ce0f2
[3.13] gh-116510: Fix a Crash Due to Shared Immortal Interned Strings (gh-124865) (gh-125709) (GH-125204)
* gh-116510: Fix a Crash Due to Shared Immortal Interned Strings (gh-124865)

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.
(cherry picked from commit f2cb399470)

Co-authored-by: Eric Snow <ericsnowcurrently@gmail.com>

* [3.13] gh-125286: Share the Main Refchain With Legacy Interpreters (gh-125709)

They used to be shared, before 3.12.  Returning to sharing them resolves a failure on Py_TRACE_REFS builds.

---------

Co-authored-by: Eric Snow <ericsnowcurrently@gmail.com>
2024-11-12 13:45:12 +01:00
Miss Islington (bot)
e5e70c5f09
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:18:01 +00:00
Miss Islington (bot)
3d8f5490e2
[3.13] gh-126543: Docs: change "bound type var" to "bounded" when used in the context of the 'bound' kw argument to TypeVar (GH-126584) (#126657)
(cherry picked from commit 434b29767f)

Co-authored-by: Pedro Fonini <fonini@protonmail.ch>
2024-11-10 18:48:44 -08:00
Miss Islington (bot)
8ebb6a051b
gh-125298: Remove misleading text in os.kill documentation (GH-125749)
Windows has not accepted process handles in many releases.
(cherry picked from commit 75ffac296e)

Co-authored-by: RUANG (James Roy) <longjinyii@outlook.com>
2024-11-08 15:47:52 +00:00
Miss Islington (bot)
05da4eea5a
[3.13] gh-125436: Doc: Add missing `allow_unnamed_section parameter to ConfigParser` documentation (GH-125437) (#126421)
gh-125436: Doc: Add missing ``allow_unnamed_section`` parameter to ``ConfigParser`` documentation (GH-125437)

Add missing ``allow_unnamed_section`` parameter to ``ConfigParser`` doc, as well as to it's parent ``RawConfigParser``.
Split too long line on ``ConfigParser`` signature.
Add some sections about when some of ``RawConfigParser`` parameters were added.
(cherry picked from commit d960226547)

Co-authored-by: lit <litlighilit@foxmail.com>
2024-11-05 03:04:32 +00:00
Miss Islington (bot)
9e72a3f2e1
[3.13] Doc: Fix typo in documentation for `MAKE_FUNCTION` opcode (GH-126396) (#126406)
Doc: Fix typo in documentation for  ``MAKE_FUNCTION`` opcode (GH-126396)
(cherry picked from commit e5a4b402ae)

Co-authored-by: Mikhail Efimov <efimov.mikhail@gmail.com>
2024-11-04 17:35:12 +00:00
Miss Islington (bot)
6245ee279d
[3.13] Docs: turn getopt examples into doctests (GH-126377) (#126385)
(cherry picked from commit 0d80777981)

Co-authored-by: Erlend E. Aasland <erlend@python.org>
2024-11-04 08:34:36 +00:00
Miss Islington (bot)
d89d78bfdf
[3.13] gh-126165: Improve docs of function math.isclose (GH-126215) (#126380)
gh-126165: Improve docs of function `math.isclose` (GH-126215)
(cherry picked from commit 081706f873)

Co-authored-by: Zhikang Yan <2951256653@qq.com>
Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>
Co-authored-by: Carol Willing <carolcode@willingconsulting.com>
Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
2024-11-04 04:14:05 +00:00
Miss Islington (bot)
2f7793196a
[3.13] gh-125761: Clarify repeated warning suppression criteria in warnings module (gh-126330)
(cherry picked from commit 10eeec2d4f)

Co-authored-by: 고병찬 <70642609+byungchanKo99@users.noreply.github.com>
2024-11-02 11:43:30 +00:00
Miss Islington (bot)
6e4b7eadf5
[3.13] gh-125875: Fix docs typo FORMAT_SPEC to FORMAT_WITH_SPEC (gh-126319) (gh-126320) 2024-11-02 05:16:24 +00:00
Miss Islington (bot)
bdda85ec87
[3.13] docs: add a more precise example in enum doc (GH-121015) (#126306)
docs: add a more precise example in enum doc (GH-121015)

* docs: add a more precise example

Previous example used manual integer value assignment in class based declaration but in functional syntax has been used auto value assignment what could be confusing for the new users. Additionally documentation doesn't show how to declare new enum via functional syntax with usage of the manual value assignment.

* docs: remove whitespace characters

* refactor: change example

---------

(cherry picked from commit ff257c7843)

Co-authored-by: Filip "Ret2Me" Poplewski <37419029+Ret2Me@users.noreply.github.com>
Co-authored-by: Ethan Furman <ethan@stoneleaf.us>
2024-11-01 16:17:35 -07:00
Miss Islington (bot)
f8a9a1ced1
[3.13] Doc: Add a single table as summary to math documentation (GH-125810) (GH-126308)
Doc: Add a single table as summary to math documentation (GH-125810)

* Summary for math module with separate tables

* Forgot remainder description

* Single table

* data instead of func

* Add arguments in the table

* Fix inconsistencies in pow documentation

* Remove full stops from the table



* Fix math.pow link

* Fix spacing

---------

(cherry picked from commit 74cf5967f3)

Co-authored-by: Joseph Martinot-Lagarde <contrebasse@gmail.com>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2024-11-01 16:11:40 -07:00
Miss Islington (bot)
5c04055082
[3.13] gh-122767: document "new style" formatting for complexes (GH-122848) (#126128)
gh-122767: document "new style" formatting for complexes (GH-122848)

(cherry picked from commit 0bbbe15f56)

Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2024-11-01 12:29:29 -07:00
Miss Islington (bot)
2e20a49cae
[3.13] gh-126259: Fix "unclosed database" warning in sqlite3 doctest (GH-126260) (#126265)
(cherry picked from commit 295262c8ec)

Co-authored-by: sobolevn <mail@sobolevn.me>
2024-11-01 07:23:11 +00:00
Miss Islington (bot)
256fc5529a
[3.13] gh-126256: Update time.rst to use the same clock as instead of the same clock than (GH-126257) (#126258)
gh-126256: Update time.rst to use the same clock as instead of the same clock than (GH-126257)

Update time.rst to use `the same clock as` instead of `the same clock than`

The time documentation uses the same clock than time.monotonic instead of the same clock as time.monotonic, which is grammatically false. This PR fixes changes two instances of `the same clock than` to `the same clock as`.
(cherry picked from commit d0abd0b826)

Co-authored-by: Alperen Keleş <alpkeles99@gmail.com>
2024-10-31 21:50:20 +00:00
Miss Islington (bot)
57668a4be5
[3.13] gh-125818: Fix incorrect signature of argument skip_file_prefixes in warnings docs (GH-125823) (#126216)
gh-125818: Fix incorrect signature of argument `skip_file_prefixes` in warnings docs (GH-125823)

Change documentation
(cherry picked from commit d467d9246c)

Co-authored-by: RUANG (James Roy) <longjinyii@outlook.com>
2024-10-30 18:32:04 -07:00
Richard Hansen
2db2b5ea9c
[3.13] gh-124872: Refine contextvars documentation (GH-124773) (#125233)
[3.13] gh-124872: Refine contextvars documentation

  * Add definitions for "context", "current context", and "context
    management protocol".
  * Update related definitions to be consistent with the new
    definitions.
  * Restructure the documentation for the `contextvars.Context` class
    to prepare for adding context manager support, and for consistency
    with the definitions.
  * Use `testcode` and `testoutput` to test the `Context.run` example.

(cherry-picked from commit 99400930ac)

Co-authored-by: Carol Willing <carolcode@willingconsulting.com>
2024-10-30 20:48:02 +00:00