Commit graph

14178 commits

Author SHA1 Message Date
Serhiy Storchaka
35759fe2fa
gh-137668: Document that ord() supports also bytes and bytearray (GH-137669) 2025-08-13 12:12:16 +03:00
RafaelWO
003bd8cc63
gh-136672: Docs: Move Enum functions and add examples (GH-136791)
* Docs: Move Enum functions and add examples

When the `Enum` functions `_add_alias_` and `_add_value_alias_` were added in de6bca9564, the documentation for them was done under `EnumType` instead of `Enum`.

This change moves them to the docs of the `Enum` class and adds an example for each function.

---------

Co-authored-by: Ethan Furman <ethan@stoneleaf.us>
2025-08-12 12:28:27 -07:00
Evan Kohilas
dd079db4b9
gh-131885: Use positional-only markers for `max() and min()` (#131868) 2025-08-12 00:29:17 +01:00
Brett Cannon
7140b99b0d
GH-137426: Remove code deprecation of importlib.abc.ResourceLoader (GH-137567)
Enough other classes in `importlib.abc` inherit from the class and the deprecation was to redirect people to `TraversableResources`. The documentation now makes it clear the class only exists for backwards compatibility.

---------

Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2025-08-11 16:18:54 -07:00
Konstantin Baikov
0c83daaf45
gh-125897: Mark range function parameters as positional only (#125945) 2025-08-11 19:12:55 -04:00
Serhiy Storchaka
046a4e39b3
gh-136571: Convert more code in datetime to Argument Clinic (GH-136573)
This adds signatures for some classes and methods.

date.fromisocalendar() can now raise OverflowError for arguments that
don't fit in the C int.
2025-08-09 18:25:49 +00:00
Alexander Nordin
3964f97489
gh-137026: Add an explainer guide for asyncio (GH-137215)
* - Add an explainer guide (aka HOWTO, not how-to) for asyncio.

* Fix linter errors.

* - Enforce max line length of roughly 79 chars.
- Start sentences on new lines to minimize disruption of diffs.

* Add reference to subinterpreters.

* - Significantly reduce article size. Remove both example sections & "Which concurrency do I want" section.

* Align section-header lengths with section names.

* - Remove reference to deleted section.

* - Fix a variety of rote style guide items like title-alignment, use of ie and $, and so forth.
- Add links to other parts of the docs for keywords and objects like await, coro, task, future, etc.

* - One last title alignment.

* - Style nit.

* - Rework a variety of I statements.

* Lint fix.

* - Firm up commentary on yield from in corotuines.

* Update language comparing await and yield from.

* - Remove await-ing Tasks and futures section

* Update Doc/howto/a-conceptual-overview-of-asyncio.rst

Co-authored-by: Peter Bierma <zintensitydev@gmail.com>

* Update Doc/howto/a-conceptual-overview-of-asyncio.rst

Co-authored-by: Peter Bierma <zintensitydev@gmail.com>

* - Address comments related to style & writing flow.

* per-thread event loop note.

* Add section describing coroutines roots in generators.

* Phrasing tweak.

* Use asyncio.create_task instead of asyncio.Task

* Update Doc/howto/a-conceptual-overview-of-asyncio.rst

Co-authored-by: Peter Bierma <zintensitydev@gmail.com>

* Update Doc/howto/a-conceptual-overview-of-asyncio.rst

Co-authored-by: Peter Bierma <zintensitydev@gmail.com>

* small phrasing.

* Update Doc/howto/a-conceptual-overview-of-asyncio.rst

Co-authored-by: Peter Bierma <zintensitydev@gmail.com>

* phrasing nit.

* style nits

* Update Doc/howto/a-conceptual-overview-of-asyncio.rst

Co-authored-by: Peter Bierma <zintensitydev@gmail.com>

* phrasing nit

* Fix misnaming of async generator.

* phrasing nits.

* Update Doc/howto/a-conceptual-overview-of-asyncio.rst

Co-authored-by: Peter Bierma <zintensitydev@gmail.com>

* Update Doc/howto/a-conceptual-overview-of-asyncio.rst

Co-authored-by: Peter Bierma <zintensitydev@gmail.com>

* consistent spacing

* Update Doc/howto/a-conceptual-overview-of-asyncio.rst

Co-authored-by: Peter Bierma <zintensitydev@gmail.com>

* phrasing nits

* Update Doc/howto/a-conceptual-overview-of-asyncio.rst

Co-authored-by: Peter Bierma <zintensitydev@gmail.com>

* Update Doc/howto/a-conceptual-overview-of-asyncio.rst

Co-authored-by: Peter Bierma <zintensitydev@gmail.com>

* Update Doc/howto/a-conceptual-overview-of-asyncio.rst

Co-authored-by: Peter Bierma <zintensitydev@gmail.com>

* Update Doc/howto/a-conceptual-overview-of-asyncio.rst

Co-authored-by: Peter Bierma <zintensitydev@gmail.com>

* add conclusion

* nits

* - Variety of style & grammar improvements thanks to ZeroIntensity's comments.

* - Make all directives start with a 3 space indent. Then 4 thereafter.

* - Use :linenos: instead of manually writing the line numbers.

* - Fix label typo for article.

* fix label link.

* Apply suggestions from code review

Co-authored-by: 🇺🇦 Sviatoslav Sydorenko (Святослав Сидоренко) <wk.cvs.github@sydorenko.org.ua>
Co-authored-by: Carol Willing <carolcode@willingconsulting.com>
Co-authored-by: Peter Bierma <zintensitydev@gmail.com>

* - introduce async-sleep name

* Phrasing

* nit

* ungendered octopus

* teammates

* jobs

* rework fella to penguin

* - remove byline; add seealso

* Change ref from asyncio to use seealso block.

* Remove typehints. Fix indentation in one code example.

* Slight rephrase for clarity.

* Make references point to asyncio. Wrap some long lines.

* - Variety of style/phrasing improvements based on PR feedback.

* phrasing.

* phrasing nit.

* Apply suggestions from code review

Co-authored-by: Peter Bierma <zintensitydev@gmail.com>

* Update Doc/howto/a-conceptual-overview-of-asyncio.rst

Co-authored-by: Carol Willing <carolcode@willingconsulting.com>

* nit

* Apply suggestions from code review

Co-authored-by: Carol Willing <carolcode@willingconsulting.com>

* fix backticks.

* nits

* nit

* add section on asyncio.run

* title change under the hood.

* modify task coro example.

* howtos article link.

* prefer await without backticks.

* phrasing tweak.

* Rework phrasing around how await tasks pauses and returns control in the await section.

* move code block to beforfe explanation in coroutine under the hood.

* phrasing.

* link to yield from.

* style nits

* nit

* - Modify language re: event-loop cycling endlessly.
- Discuss why await was designed to not yield for coros.

* - Add a note about debug=True on asyncio.run to await coro section.

* clarity nit

* - Add two other references in seealso block.

* nit

* Language simplification

* Apply suggestions from code review

Co-authored-by: Peter Bierma <zintensitydev@gmail.com>

* nit

* grammar fix.

* fix

* worker bees

* rework event loop paragraph to significantly deemphasize queues

* remove all references to queue besides the initial analogy.

* add note about garbage collection of tasks

* add practical note re: garbage collection

* phrasing nits

* re arrange note on task gc.

* line wrap nit

* Update Doc/howto/a-conceptual-overview-of-asyncio.rst

Co-authored-by: Kumar Aditya <kumaraditya@python.org>

* link to debug mode docs.

* readd part2 prefix.

* simplify title.

* fix titles. tihnk I messed this up earlier.

* avoid idiom in title.

* fix titles once agian.

* Apply suggestions from code review

Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>

* rework task gc example.

* phrasing tweak.

* tewak.

* nit

* nit

* nit

* nit

---------

Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
Co-authored-by: 🇺🇦 Sviatoslav Sydorenko (Святослав Сидоренко) <wk.cvs.github@sydorenko.org.ua>
Co-authored-by: Carol Willing <carolcode@willingconsulting.com>
Co-authored-by: Kumar Aditya <kumaraditya@python.org>
Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
2025-08-08 22:29:51 -07:00
Douglas Thor
34d7351ac7
gh-133722: Add Difflib theme to _colorize and 'color' option to difflib.unified_diff (#133725) 2025-08-08 18:34:02 +03:00
Tom Forbes
64ee1babfb
Replace "ordered arguments" with "positional arguments" in unittest.mock documentation (GH-137552) 2025-08-08 14:00:18 +00:00
Adorilson Bezerra
f06fcb7f4b
[Doc] Remove unnecessary quotes from typing module (#137207)
* gh-106320: Remove private _PyInterpreterState functions (#106335)

Remove private _PyThreadState and _PyInterpreterState C API
functions: move them to the internal C API (pycore_pystate.h and
pycore_interp.h). Don't export most of these functions anymore, but
still export functions used by tests.

Remove _PyThreadState_Prealloc() and _PyThreadState_Init() from the C
API, but keep it in the stable API.

* Doc: minor change

* Revert "Doc: minor change"

This reverts commit ebfa0937c2.

* [Doc] Remove unnecessary quotes from typing (See Also section)

* [Doc] Remove unnecessary quotes from typing

---------

Co-authored-by: Victor Stinner <vstinner@python.org>
2025-08-07 19:04:59 -07:00
Sergey B Kirpichev
37b5a0d671
gh-130102: drop "require numeric arguments" from pow() docs (#137456)
Co-authored-by: Senthil Kumaran <senthil@python.org>
2025-08-07 23:43:18 +00:00
Sebastien Williams-Wynn
244c7b8c4c
gh-137526: Fix broken link to drdobbs journal in difflib.rst (#137527) 2025-08-07 12:36:05 -07:00
tobiasjcat
3c1471d971
gh-137499: Fixed dead link to NIST website (#137500) 2025-08-07 08:41:16 +03:00
Mendel Feygelson
37b9a5df93
Docs: Use the correct example module in warnings.rst (#137402) 2025-08-06 22:51:59 +01:00
Erlend E. Aasland
247dab27fd
gh-133390: Amend gh-135659 (sqlite3 docs update) (#137447)
* gh-133390: Amend gh-135659 (sqlite3 docs update)
2025-08-06 10:47:18 +02:00
Stan Ulbrych
525784aa65
gh-123441: Correct the supported languages of the iso-8859-4 codec (GH-137034) 2025-08-05 17:55:05 +03:00
Adam Turner
4dae9b1ff1
gh-132661: PEP 750 documentation: second pass (#137020) 2025-08-04 22:45:51 +01:00
Peter Bierma
e8251dc0ae
gh-134170: Add colorization to unraisable exceptions (#134183)
Default implementation of sys.unraisablehook() now uses traceback._print_exception_bltin() to print exceptions with colorized text.

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
2025-08-04 14:35:00 +00:00
Petr Viktorin
8943bb722f
gh-136520: Clarify docs for _pack_ & _align_ (GH-137036)
Move docs to the reference section & reduce the “tutorial” part to a quick intro & link.

Clarify what values are accepted.

Add macro/attribute equivalents.

Discourage _align_ values that aren't powers of two.
2025-08-04 15:40:42 +02:00
Sergey B Kirpichev
b266fbc9ec
gh-122450: Expand documentation for `Rational and Fraction` (#136800)
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2025-08-04 02:15:59 +00:00
Serhiy Storchaka
1612dcbafe
gh-137341: Remove more word duplications (GH-137342) 2025-08-03 19:41:12 +03:00
Inada Naoki
f195c28030
Doc: remove unused images (#137323) 2025-08-02 15:32:18 +01:00
Dzmitry Plashchynski
438cbd857a
gh-131146: Fix month names in a "standalone form" in calendar module (GH-131147)
The calendar module displays month names in some locales using the genitive case.
This is grammatically incorrect, as the nominative case should be used when the month
is named by itself. To address this issue, this change introduces new lists
`standalone_month_name` and `standalone_month_abbr` that contain month names in
the nominative case -- or more generally, in the form that should be used to
name the month itself, rather than form a date.

The module now uses the `%OB` format specifier to get month names in this form
where available.
2025-07-31 14:06:33 +02:00
Victorien
5e2f0b976a
gh-119180: Refer to annotationlib.get_annotations() in typing.get_type_hints() documentation (#137247) 2025-07-30 20:21:56 -07:00
Raymond Hettinger
dc05d475c1
Add example of min-heap and max-heap working together (gh-137251) 2025-07-30 15:53:33 -05:00
Serhiy Storchaka
9d3b53c47f
gh-71189: Support all-but-last mode in os.path.realpath() (GH-117562) 2025-07-30 10:19:19 +03:00
Neil Schemenauer
5236b0281b
GH-116738: document thread-safety of bisect (GH-136555) 2025-07-30 02:44:10 +00:00
Akuli
0b4e13c265
gh-137183: Document that array.array typecode w is new in 3.13 (GH-137184) 2025-07-29 17:23:44 +02:00
Ron Frederick
377b787618
gh-136306: Add support for getting and setting SSL groups (#136307)
Add support for getting and setting groups used for key agreement.

* `ssl.SSLSocket.group()` returns the name of the group used
  for the key agreement of the current session establishment.
  This feature requires Python to be built with OpenSSL 3.2 or later.

* `ssl.SSLContext.get_groups()` returns the list of names of groups
  that are compatible with the TLS version of the current context.
  This feature requires Python to be built with OpenSSL 3.5 or later.

* `ssl.SSLContext.set_groups()` sets the groups allowed for key agreement
  for sockets created with this context. This feature is always supported.
2025-07-28 19:33:31 +02:00
AN Long
1481384141
gh-119711: describe create_datagram_endpoint's behavior in asyncio when local_addr is None (#136913) 2025-07-28 16:25:59 +05:30
Duprat
4e40f2bea7
gh-132898: Add a note in multiprocessing.Process docs about creating a process in a REPL (GH-137118)
* Reword, expand, and clarify the limitation, highlighting the REPL case.
* Mention in the high level Process description.
* added a pointer to the GH issue from the doc note

---------

Co-authored-by: Gregory P. Smith <greg@krypto.org>
2025-07-27 12:59:08 -07:00
Toshaksha
6784ef7da7
gh-136278: Document codecs.escape_encode() and codecs.escape_decode() (#136314)
Closes #136278
2025-07-27 16:37:52 +00:00
Iqra Khan
ae8b7d7100
gh-136992: Add "None" as valid SameSite value as per RFC 6265bis (#137040)
The "SameSite" attribute defined in RFC 6265bis [1] allows the "Strict", "Lax" and "None"
enforcement modes. We already documented "Strict" and "Lax" as being valid values
but "None" was missing from the list. While the RFC has not been formally approved,
modern browsers support the "None" value [2, 3] thereby making sense to document it.

[1]: https://datatracker.ietf.org/doc/html/draft-ietf-httpbis-rfc6265bis
[2]: https://developers.google.com/search/blog/2020/01/get-ready-for-new-samesitenone-secure
[3]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Set-Cookie#none

---------

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2025-07-27 10:27:08 +02:00
soolabettu
1e69cd1634
gh-137090: Remove redundant statement in `Doc/library/concurrent.interpreters.rst` (#137091)
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2025-07-25 16:50:53 +01:00
Raymond Hettinger
ea06ae5b5e
Fix Queue.shutdown docs for condition to unblock a join (gh-137088) 2025-07-25 07:56:28 -06:00
Raymond Hettinger
245671555b
Fix docs for Queue.shutdown (gh-137028) 2025-07-24 11:23:03 -06:00
FredericDT
dc27218225
gh-136980: Remove unused C tracing code in bdb (#136981) 2025-07-24 09:58:54 +09:00
Cornelius Roemer
80a7017d26
Fix typos in Doc/extending/extending.rst and Doc/library/shelve.rst (GH-136890) 2025-07-23 15:04:59 +03:00
Petr Viktorin
fac4964fdb
gh-136516: Mention installation artifacts as de-facto resources (GH-136419)
Files like NUL on windows are, from `importlib.resources` point of
view, an artifact caused by installing to a filesystem directory.
Mention these.
2025-07-23 14:01:38 +02:00
Victorien
c13cc4af79
Fix code example in annotationlib documentation (#136972) 2025-07-22 13:48:02 +00:00
sobolevn
b31e5d6de1
gh-136437: Convert more `os.path` functions to positional-only in the docs (#136970) 2025-07-22 14:38:33 +01:00
Dave Peck
22c8658906
gh-132661: Document t-strings and templatelib (#135229)
Co-authored-by: Petr Viktorin <encukou@gmail.com>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
Co-authored-by: Loïc Simon <loic.pano@gmail.com>
Co-authored-by: pauleveritt <pauleveritt@me.com>
2025-07-22 12:44:13 +03:00
Emma Smith
6bf1c0ab34
gh-136170: Revert adding ZipFile.data_offset (GH-136950)
* Revert "gh-84481: Make ZipFile.data_offset more robust (#132178)"

This reverts commit 6cd1d6c6b1.

* Revert "gh-84481: Add ZipFile.data_offset attribute (#132165)"

This reverts commit 0788948dcb.

---------

Co-authored-by: Gregory P. Smith <greg@krypto.org>
2025-07-21 23:16:30 +00:00
sobolevn
3224429450
gh-136437: Document os.path.dirname as accepting only pos-only (#136946) 2025-07-21 18:22:58 +00:00
sobolevn
b5428bb0e7
gh-136437: Document some os.path functions as requiring pos-only (#136812) 2025-07-21 21:01:43 +03:00
Barney Gale
80b2d60a51
GH-136874: url2pathname(): discard query and fragment components (#136875)
In `urllib.request.url2pathname()`, ignore any query or fragment components
in the given URL.
2025-07-21 17:33:20 +00:00
Nacho Caballero
5f9e38f9b9
gh-136859: Improve StrEnum docs (GH-136864)
Co-authored-by: Nacho Caballero <nacho.caballero@astrazeneca.com>
Co-authored-by: Antonio Spadaro <ilovelinux@users.noreply.github.com>
2025-07-21 08:18:40 -07:00
Petr Viktorin
658599c15d
gh-121028: Soft-deprecate sys.api_version (GH-136463) 2025-07-21 14:22:48 +02:00
Pablo Galindo Salgado
acbe896cb1
GH-130645: Default to color help in argparse (#136809)
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
Co-authored-by: Adam Turner <9087854+aa-turner@users.noreply.github.com>
2025-07-20 14:55:44 -07:00
Peter Bierma
8f59fbb082
gh-136492: Add FrameLocalsProxyType to types (GH-136546)
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2025-07-20 20:49:00 +02:00