Commit graph

14407 commits

Author SHA1 Message Date
Serhiy Storchaka
77cb39e0c7
gh-138697: Fix inferring dest from a single-dash long option in argparse (#138699)
* gh-138697: Fix inferring dest from a single-dash long option in argparse

If a short option and a single-dash long option are passed to add_argument(),
dest is now inferred from the single-dash long option.

* Make double-dash options taking priority over single-dash long options.

---------

Co-authored-by: Savannah Ostrowski <savannah@python.org>
2025-11-20 18:41:58 +00:00
Guo Ci
e5adaafc52
[Docs] Fix typo in bdb: is_skipped_line to is_skipped_module (#141771) 2025-11-19 18:39:54 -08:00
Luciano Ramalho
01713b4342
gh-141721: Improve docstring for LastUpdatedOrderedDict example (gh141724) 2025-11-19 12:22:27 -06:00
Brandt Bucher
598d4c64de
GH-140638: Add a GC "duration" stat (GH-141720) 2025-11-19 08:51:39 -08:00
Guo Ci
52f70a6f60
Correct class name from PullDom to PullDOM (#141207) 2025-11-19 12:30:53 +02:00
Hugo van Kemenade
a62562859d Python 3.15.0a2 2025-11-18 16:51:17 +02:00
Mariusz Felisiak
b87613f214
Add missing backticks in os and decimal docs (#141699) 2025-11-18 12:32:15 +02:00
Semyon Moroz
cc6b62ac56
gh-130160: Add anchors to CLI Usage section for cmdline (#133182) 2025-11-17 14:51:21 +00:00
Brandt Bucher
336366fd7c
GH-140643: Add <native> and <GC> frames to the sampling profiler (#141108)
- Introduce a new field in the GC state to store the frame that initiated garbage collection.
- Update RemoteUnwinder to include options for including "<native>" and "<GC>" frames in the stack trace.
- Modify the sampling profiler to accept parameters for controlling the inclusion of native and GC frames.
- Enhance the stack collector to properly format and append these frames during profiling.
- Add tests to verify the correct behavior of the profiler with respect to native and GC frames, including options to exclude them.

Co-authored-by: Pablo Galindo Salgado <pablogsal@gmail.com>
2025-11-17 13:39:00 +00:00
Thomas Ballard
20b64bdf23
Docs: Fix typo in socketserver documentation (#140956) 2025-11-17 13:47:28 +02:00
dereckduran
d527d3bf8b
gh-62480: De-personalize "Coping with mutable arguments" section in unittest.mock examples (#141323) 2025-11-17 13:44:44 +02:00
Tamzin Hadasa Kelly
df8091d516
gh-141650: Fix typo in xml.sax.saxutils.unescape documentation (#141652) 2025-11-17 13:35:01 +02:00
Yongzi Li
ed81baf81f
gh-140458: xmlrpc.client raises Fault, does not returns it. (GH-140759) 2025-11-15 17:14:23 +01:00
Osama Abdelkader
a486d452c7
gh-140601: Add ResourceWarning to iterparse when not closed (GH-140603)
When iterparse() opens a file by filename and is not explicitly closed,
emit a ResourceWarning to alert developers of the resource leak.

Signed-off-by: Osama Abdelkader <osama.abdelkader@gmail.com>
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2025-11-13 21:05:28 +02:00
Serhiy Storchaka
b2b68d40f8
gh-140873: Add support of non-descriptor callables in functools.singledispatchmethod() (GH-140884) 2025-11-13 19:48:52 +02:00
Cody Maloney
732224e113
gh-139871: Add bytearray.take_bytes([n]) to efficiently extract bytes (GH-140128)
Update `bytearray` to contain a `bytes` and provide a zero-copy path to
"extract" the `bytes`. This allows making several code paths more efficient.

This does not move any codepaths to make use of this new API. The documentation
changes include common code patterns which can be made more efficient with
this API.

---

When just changing `bytearray` to contain `bytes` I ran pyperformance on a
`--with-lto --enable-optimizations --with-static-libpython` build and don't see
any major speedups or slowdowns with this; all seems to be in the noise of
my machine (Generally changes under 5% or benchmarks that don't touch
bytes/bytearray).


Co-authored-by: Victor Stinner <vstinner@python.org>
Co-authored-by: Maurycy Pawłowski-Wieroński <5383+maurycy@users.noreply.github.com>
2025-11-13 13:19:44 +00:00
Serhiy Storchaka
d8e6bdc0d0
gh-135801: Add the module parameter to compile() etc (GH-139652)
Many functions related to compiling or parsing Python code, such as
compile(), ast.parse(), symtable.symtable(),
and importlib.abc.InspectLoader.source_to_code() now allow to pass
the module name used when filtering syntax warnings.
2025-11-13 13:21:32 +02:00
Jacob Austin Lincoln
70748bdbea
gh-131116: Fix inspect.getdoc() to work with cached_property objects (GH-131165) 2025-11-12 10:07:21 +00:00
Mark Byrne
35908265b0
gh-75593: Add support of bytes and path-like paths in wave.open() (GH-140951) 2025-11-12 10:20:55 +02:00
Maurycy Pawłowski-Wieroński
0d7b48a8f5
gh-137952: update csv.Sniffer().has_header() docs to describe the actual off-by-onish behavior (GH-137953)
* checks 21, not 20
* Say "header" instead of "first row" to disambiguate per review.

---------

Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
Co-authored-by: Maurycy Pawłowski-Wieroński <maurycy@maurycy.com>
2025-11-12 00:03:14 +00:00
Serhiy Storchaka
7906f4d96a
gh-132686: Add parameters inherit_class_doc and fallback_to_class_doc for inspect.getdoc() (GH-132691) 2025-11-12 00:01:25 +02:00
Aniket
b5196fa15a
gh-137339: Clarify host and port parameter behavior in smtplib.SMTP{_SSL} initialization (#137340)
This also documents the previously undocumented default_port parameter.

Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
2025-11-11 15:25:26 -05:00
Marco Barbosa
c903d76832
gh-139533: fix refs to code without proper markups on turtledemo doc (GH-139534)
gh-139533: fix refs to code without proper markups on turtledemo documentation
2025-11-11 11:35:55 -08:00
Louis
46b58e1bb9
gh-140578: Doc: Remove sencence implying that concurrent.futures.ThreadPoolExecutor does not exist (#140689)
* Doc: Remove sencence implying that concurrent.futures.ThreadPoolExecutor does not exist

Closes #140578

* Add NEWS.d entry for gh-140578

---------

Co-authored-by: Louis Paternault <spalax@gresille.org>
2025-11-10 20:50:30 -08:00
Yongzi Li
59b793b0dd
gh-141343: Fix swapped words in sorted doc (GH-141348) 2025-11-10 08:55:15 -06:00
Stan Ulbrych
13fa313beb
gh-139707: Specify winreg, msvcrt and winsound module availability in docs (GH-140429) 2025-11-10 14:37:34 +01:00
Stan Ulbrych
df19261621
gh-141004: Document pyctype.h macros (GH-141272) 2025-11-10 05:05:06 -05:00
KarnbirKhera
b618731781
gh-62480: De-personalize "Partial mocking" section in unittest.mock examples (#141321)
* Refine some wording in unittest partial mock doc

Some of the descriptions were addressed in first person,
but have now been changed to address the user reading the documentation instead.

Co-authored-by: C.A.M. Gerlach <CAM.Gerlach@Gerlach.CAM>
2025-11-09 17:45:38 -06:00
Elena O
ec85d3cbfe
gh-62480: De-personalize "Mocking Unbound Methods" section in unittest.mock examples (#141322)
* Rewrite Mocking Unbound Methods paragraph to second person

Co-authored-by: C.A.M. Gerlach <CAM.Gerlach@Gerlach.CAM>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2025-11-09 17:42:22 -06:00
Lakshya Upadhyaya
6f20ea1e2d
gh-140980: document SET_FUNCTION_ATTRIBUTE flag for annotate function (#141306) 2025-11-09 19:59:06 +01:00
Chilla Kalyan
7ae440f262
gh-141127: Clarify o?s.symlink() documentation for argument order (#141144) 2025-11-09 09:57:34 +01:00
Mohsin Mehmood
b36f01d03f
gh-141186: document asyncio.Task cancellation propagation behavior (#141249) 2025-11-09 10:19:29 +05:30
莯凛
6545a4e8f8
gh-141246: Link to correct Windows docs in time.sleep() doc (#141248) 2025-11-08 15:56:48 +01:00
Bénédikt Tran
87942d911b
gh-141004: correctly document Py_HASH_* and PyHASH_* as hash_info attributes (#141233) 2025-11-08 12:22:02 +00:00
Serhiy Storchaka
7e90bac3cc
gh-140793: Improve documentatation and tests for the ensure_ascii option in the json module (GH-140906)
* Document that ensure_ascii=True forces escaping not only non-ASCII, but also
  non-printable characters (the only affected ASCII character is U+007F).
* Ensure that the help output for the json module does not exceed 80
  columns (except one long line in an example and generated lines).
* Add more tests.
2025-11-08 12:07:27 +02:00
Brandon Hubacher
c1785129c3
fix typos in contextvars asyncio support example docs (#141219)
Co-authored-by: Kumar Aditya <kumaraditya@python.org>
2025-11-08 09:08:19 +00:00
Rodrigo Girão Serrão
9bf5100037
Minor documentation improvements (#140626) 2025-11-06 19:11:50 +02:00
Petr Viktorin
d2ce6d708a
gh-139707: Add docs for optional modules (GH-140171)
Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
Co-authored-by: Emma Smith <emma@emmatyping.dev>
Co-authored-by: Author: Terry Jan Reedy <tjreedy@udel.edu>
Co-authored-by: Victor Stinner <vstinner@python.org>
2025-11-06 11:49:44 +01:00
Stan Ulbrych
4e6e208be9
Minor fixes to idle.rst and regenerate help.html (#140037) 2025-11-06 03:21:02 -05:00
Bartosz Sławecki
8822166200
gh-140569: recommend the new REPL in the asyncio REPL docs (#140570)
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2025-11-06 11:09:07 +05:30
Kumar Aditya
101c9c0a21
gh-118516: clarify that subprocess are automatically killed if transport gets garbage collected (#140997) 2025-11-06 10:21:13 +05:30
Savannah Ostrowski
95f6e1275b
GH-108009: Add clarification of parser and argument defaults in argparse docs (#124154)
Co-authored-by: C.A.M. Gerlach <CAM.Gerlach@Gerlach.CAM>
2025-11-05 22:46:30 +00:00
Zenith
227f4abacd
gh-76007: remove curses.__version__ doc (#141052) 2025-11-06 00:00:36 +02:00
Sebastian Pipping
baa9f33897
gh-139313: Improve docs on XML security (GH-139460)
Clarify that:
- it takes parsing for an attack
- that some doors are closed by default
- only Expat version 2.7.2 has all the fixes
- use of the bundle depends on configuration
2025-11-05 20:59:59 +02:00
Clifford Gama
1ae900424b
Docs: Fix cached calls count in factorial example (gh-140882) 2025-11-05 00:29:25 +00:00
alex
fa02422918
gh-141007: update string module source code link (#141008)
In 3.14, the former string.py became `__init__.py` within a new `string` directory that also contains a new submodule file, `templatelib.py`.
2025-11-04 19:05:49 -05:00
Filip Łajszczak
ce1bb85d28
gh-139434: Update selected RFC 2822 references to RFC 5322 (#139435)
Update selected RFC 2822 references to RFC 5322

RFC 2822 was obsoleted by RFC 5322 in 2008. This updates references
to use the current standard in documentation, docstrings, and comments.

It preserves RFC 2822 references in legacy API components to maintain their
historical context.

RFC 822 → RFC 2822 → RFC 5322 progression is explained where relevant.

In some places specific sections of RFC are referenced where it seems helpful.

Scout rule was applied in some places and RFC mentions format was
normalized in doc strings and comments.
2025-11-04 14:46:07 -05:00
Guo Ci
97d8dda980
Docs: Fix typo in email.headerregistry.rst (#140965)
Fix missing 'Header' suffix on header class name in `email.headerregistry.rst`
2025-11-04 14:29:13 -05:00
Vinay Sajip
66c86c6563
gh-134817: Restore accidentally deleted line in documentation. (GH-141013) 2025-11-04 18:29:44 +00:00
Brett Cannon
8a7dbb7a68
Document that returning sys.monitoring.DISABLE in response to a global event raises ValueError (#140726)
Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
2025-11-04 10:28:17 -08:00