Commit Graph

29405 Commits

Author SHA1 Message Date
sharktide 6b932edc52
gh-130814: Enhance documentation for Python C API type objects (#130817)
The "Type Objects" title in `c-api/typeobj.rst`, duplicating the title of `c-api/type.rst`,
has been changed to "Type Objects Structures", thereby slightly improving Sphinx
search.
2025-03-14 10:53:13 +01:00
Stan Ulbrych e4ac196aaa
gh-124269: Simplify `typing.Annotated` docs (#130770)
---------

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2025-03-14 10:46:57 +01:00
Enzo Bonnal d7d22899e2
gh-74028: update `whatsnew/3.14.rst` post gh-125663 (#131214)
Tail calling interpreter / ${{ matrix.target }} (x86_64, 19, macos-13, x86_64-apple-darwin/clang) (push) Waiting to run Details
Tail calling interpreter / ${{ matrix.target }} (x86_64, 19, ubuntu-24.04, free-threading) (push) Waiting to run Details
Tail calling interpreter / ${{ matrix.target }} (x86_64, 19, ubuntu-24.04, x86_64-unknown-linux-gnu/gcc) (push) Waiting to run Details
Lint / lint (push) Failing after 4m33s Details
mypy / Run mypy on ${{ matrix.target }} (Lib/_pyrepl) (push) Successful in 4m39s Details
mypy / Run mypy on ${{ matrix.target }} (Lib/test/libregrtest) (push) Successful in 4m42s Details
mypy / Run mypy on ${{ matrix.target }} (Tools/build) (push) Successful in 4m37s Details
mypy / Run mypy on ${{ matrix.target }} (Tools/cases_generator) (push) Successful in 4m38s Details
mypy / Run mypy on ${{ matrix.target }} (Tools/clinic) (push) Successful in 4m38s Details
mypy / Run mypy on ${{ matrix.target }} (Tools/jit) (push) Successful in 4m38s Details
Tests / Change detection (push) Failing after 23m50s Details
Tests / Docs (push) Has been skipped Details
Tests / Check if Autoconf files are up to date (push) Has been skipped Details
Tests / Check if generated files are up to date (push) Has been skipped Details
Tests / Windows ${{ fromJSON(matrix.free-threading) && '(free-threading)' || '' }} (Win32, false, windows-latest) (push) Has been skipped Details
Tests / Windows ${{ fromJSON(matrix.free-threading) && '(free-threading)' || '' }} (arm64, false, windows-latest) (push) Has been skipped Details
Tests / Windows ${{ fromJSON(matrix.free-threading) && '(free-threading)' || '' }} (arm64, true, windows-latest) (push) Has been skipped Details
Tests / Windows ${{ fromJSON(matrix.free-threading) && '(free-threading)' || '' }} (x64, false, windows-latest) (push) Has been skipped Details
Tests / Windows ${{ fromJSON(matrix.free-threading) && '(free-threading)' || '' }} (x64, true, windows-latest) (push) Has been skipped Details
Tests / Windows MSI${{ '' }} (arm64) (push) Has been skipped Details
Tests / Windows MSI${{ '' }} (x64) (push) Has been skipped Details
Tests / Windows MSI${{ '' }} (x86) (push) Has been skipped Details
Tests / macOS ${{ fromJSON(matrix.free-threading) && '(free-threading)' || '' }} (false, ${{ github.repository_owner != 'python' }}, ghcr.io/cirruslabs/macos-runner:sonoma) (push) Has been skipped Details
Tests / macOS ${{ fromJSON(matrix.free-threading) && '(free-threading)' || '' }} (false, ${{ github.repository_owner != 'python' }}, macos-13) (push) Has been skipped Details
Tests / macOS ${{ fromJSON(matrix.free-threading) && '(free-threading)' || '' }} (false, ${{ github.repository_owner != 'python' }}, macos-14) (push) Has been skipped Details
Tests / macOS ${{ fromJSON(matrix.free-threading) && '(free-threading)' || '' }} (true, ${{ github.repository_owner != 'python' }}, ghcr.io/cirruslabs/macos-runner:sonoma) (push) Has been skipped Details
Tests / macOS ${{ fromJSON(matrix.free-threading) && '(free-threading)' || '' }} (true, ${{ github.repository_owner != 'python' }}, macos-14) (push) Has been skipped Details
Tests / Ubuntu ${{ fromJSON(matrix.free-threading) && '(free-threading)' || '' }} ${{ fromJSON(matrix.bolt) && '(bolt)' || '' }} (false, false, ubuntu-24.04) (push) Has been skipped Details
Tests / Ubuntu ${{ fromJSON(matrix.free-threading) && '(free-threading)' || '' }} ${{ fromJSON(matrix.bolt) && '(bolt)' || '' }} (false, false, ubuntu-24.04-arm) (push) Has been skipped Details
Tests / Ubuntu ${{ fromJSON(matrix.free-threading) && '(free-threading)' || '' }} ${{ fromJSON(matrix.bolt) && '(bolt)' || '' }} (false, true, ubuntu-24.04) (push) Has been skipped Details
Tests / Ubuntu ${{ fromJSON(matrix.free-threading) && '(free-threading)' || '' }} ${{ fromJSON(matrix.bolt) && '(bolt)' || '' }} (false, true, ubuntu-24.04-arm) (push) Has been skipped Details
Tests / Ubuntu ${{ fromJSON(matrix.free-threading) && '(free-threading)' || '' }} ${{ fromJSON(matrix.bolt) && '(bolt)' || '' }} (true, false, ubuntu-24.04) (push) Has been skipped Details
Tests / Ubuntu SSL tests with OpenSSL (3.0.15, ubuntu-24.04) (push) Has been skipped Details
Tests / Ubuntu SSL tests with OpenSSL (3.1.7, ubuntu-24.04) (push) Has been skipped Details
Tests / Ubuntu SSL tests with OpenSSL (3.2.3, ubuntu-24.04) (push) Has been skipped Details
Tests / Ubuntu SSL tests with OpenSSL (3.3.2, ubuntu-24.04) (push) Has been skipped Details
Tests / Ubuntu SSL tests with OpenSSL (3.4.0, ubuntu-24.04) (push) Has been skipped Details
Tests / WASI (push) Has been skipped Details
Tests / Hypothesis tests on Ubuntu (push) Has been skipped Details
Tests / Address sanitizer (ubuntu-24.04) (push) Has been skipped Details
Tests / Thread sanitizer ${{ fromJSON(matrix.free-threading) && '(free-threading)' || '' }} (false) (push) Has been skipped Details
Tests / Thread sanitizer ${{ fromJSON(matrix.free-threading) && '(free-threading)' || '' }} (true) (push) Has been skipped Details
Tests / Cross build Linux (push) Has been skipped Details
Tests / CIFuzz (address) (push) Has been skipped Details
Tests / CIFuzz (memory) (push) Has been skipped Details
Tests / CIFuzz (undefined) (push) Has been skipped Details
Tests / All required checks pass (push) Has been skipped Details
mypy / Run mypy on ${{ matrix.target }} (Tools/wasm) (push) Successful in 4m37s Details
mypy / Run mypy on ${{ matrix.target }} (Tools/peg_generator) (push) Successful in 4m40s Details
Mark stale pull requests / stale (push) Has been skipped Details
2025-03-13 23:22:04 +01:00
Victor Stinner 10cbd1fe88
gh-130947: Add again PySequence_Fast() to the limited C API (#130948)
Add again PySequence_Fast() to the limited C API.

Add unit tests.
2025-03-13 13:00:57 +01:00
donBarbos 3a189af4b2
gh-93096: Remove CLI interface for `difflib` (#131099) 2025-03-13 13:22:16 +02:00
Oleg Iarygin 328f8b8856
gh-93096: Make `mimetypes` CLI tool public (#93097)
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2025-03-13 13:19:22 +02:00
Enzo Bonnal a005835f69
gh-74028: add `buffersize` parameter to `concurrent.futures.Executor.map` for lazier behavior (#125663)
`concurrent.futures.Executor.map` now supports limiting the number of submitted
tasks whose results have not yet been yielded via the new `buffersize` parameter.

---------

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2025-03-13 11:57:53 +01:00
Russell Keith-Magee dd6d24e9d2
gh-130940: Modify default behavior of `PyConfig.use_system_logger` to enable on iOS (#131172)
Modify default behavior of use_system_log to enable on iOS.
2025-03-13 14:28:49 +08:00
Daniel Pope e0637cebe5
gh-129349: Accept bytes in bytes.fromhex()/bytearray.fromhex() (#129844)
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
2025-03-12 11:40:11 +01:00
Gerardwx e0bc9d2a0c
Replace link to historical TypedDict PEP with current document on typing.python… (#131096)
* Replace link to historical PEP with current document on typing.python.org

* Update Doc/library/typing.rst

Co-authored-by: Ned Batchelder <ned@nedbatchelder.com>

---------

Co-authored-by: Ned Batchelder <ned@nedbatchelder.com>
2025-03-11 12:45:31 -04:00
Petr Viktorin ad0f618ab3
gh-129675: Update documentation for tp_basicsize & tp_itemsize (#129850)
* Update documentation for tp_basicsize & tp_itemsize

- Add alignment requirement
- Mention that ob_size is unreliable if you don't control it
- Add some links for context
- basicsize should include the base type in generaly not just PyObject

This adds a “by-the-way” link to `PyObject_New`, which shouldn't be
used for GC types. In order to be comfortable linking to it, I also
add a link to `PyObject_GC_New` from its docs. And the same for
`*Var` variants, while I'm here.

* Strongly suggest Py_SIZE & Py_SET_SIZE
2025-03-11 11:21:18 +01:00
RUANG (James Roy) faadb446d9
gh-46236: Add missing PyUnicode_Append() doc (#130531)
* Add missing PyUnicode_Append() doc

* Change the copied content

* Add '`` ``'

* Change doc

* Add PyUnicode_AppendAndDel function doc

* Change doc

* Add PyUnicode_AppendAndDel to refcounts

* Change doc

* Change doc

Co-authored-by: Petr Viktorin <encukou@gmail.com>

* Change doc

---------

Co-authored-by: Petr Viktorin <encukou@gmail.com>
2025-03-11 10:28:17 +01:00
Ken Jin fe186d76cf
Minor nits to whats new tail call wording (#130912) 2025-03-11 10:57:35 +08:00
stratakis ecdf6b15b0
gh-118518: Minor improvements to perf docs (#130866)
Minor improvements to perf docs
2025-03-10 21:51:21 +00:00
Jean-Christophe Fillion-Robin c3487c941d
gh-82909: Update PC/pyconfig.h to allow disabling pragma based auto-linking (GH-19740)
Define Py_NO_LINK_LIB to build extension disabling pragma based auto-linking. This is relevant when using build-system generator (e.g CMake) where the linking is explicitly handled
2025-03-10 17:40:17 +00:00
Yuki Kobayashi 7cc99a54b7
gh-101100: Fix sphinx warnings in `library/asyncio-subprocess.rst` (#130994) 2025-03-10 12:38:08 +00:00
Stan Ulbrych 98fa4a49fe
gh-80421: Correct definitions of time (#130984)
Based on the Wikipedia article, UTC is better said to be a successor than a renaming of GTC and language agnostic rather than an English-French compromise.
2025-03-09 16:09:23 -04:00
donBarbos c240c2d88a
gh-130160: use `.. program::` directive for documenting `pdb` CLI (#130996) 2025-03-09 11:55:23 -04:00
donBarbos 92e5f826ac
gh-130160: use `.. program::` directive for documenting `webbrowser` CLI (#130995)
use `.. program::` directive for documenting `webbrowser` CLI
2025-03-09 09:57:59 +03:00
Affan Shaikhsurab a3990df612
gh-123726: Document caveats of zipfile.Path around name sanitization (#130537)
Add a note to the `zipfile.Path` class documentation clarifying that it does not sanitize filenames. This emphasizes the caller's responsibility to validate or sanitize inputs, especially when handling untrusted ZIP archives, to prevent path traversal vulnerabilities. The note also references the `extract` and `extractall` methods for comparison and suggests using `os.path.abspath` and `os.path.commonpath` for safe filename resolution.
2025-03-08 16:37:05 -05:00
morotti b1b4f9625c
gh-117151: IO performance improvement, increase io.DEFAULT_BUFFER_SIZE to 128k (GH-118144)
Co-authored-by: rmorotti <romain.morotti@man.com>
2025-03-07 11:36:12 -08:00
Boris Verkhovskiy e5527f2cdd
Correct function name in `Doc/extending/embedding.rst` (#127539) 2025-03-07 14:06:36 +01:00
Sebastian Rittau c6dd2348ca
gh-127647: Add typing.Reader and Writer protocols (#127648) 2025-03-06 07:36:19 -08:00
Ken Jin 9c691500f9
gh-128563: Clarify wording in Whats new for Tail call (#130911)
Clarify wording in Whats new for Tail call
2025-03-06 13:38:05 +00:00
Ken Jin e4a60248b0
gh-128563: Add correction note to tail call in whats new (#130908)
* Add correction note to tail call in whats new

* Update 3.14.rst
2025-03-06 14:43:53 +08:00
Bartosz Sławecki 293fa3433e
gh-85795: Raise a clear error when `super()` is used in `typing.NamedTuple` subclasses (#130082) 2025-03-05 20:45:47 -08:00
Charles Machalow 5e73ece95e
gh-128041: Fix incorrect bullet placement in "What's new" (GH-130900) 2025-03-05 22:59:56 +00:00
Tshepang Mbambo 1b5db5adfe
GH-130153: Reword the wildcard matching part of the tutorial (GH-129954) 2025-03-05 14:59:47 -08:00
Charles Machalow ba05a4ebcb
gh-128041: Add `terminate_workers` and `kill_workers` methods to ProcessPoolExecutor (GH-130849)
This adds two new methods to `multiprocessing`'s `ProcessPoolExecutor`:
- **`terminate_workers()`**: forcefully terminates worker processes using `Process.terminate()`
- **`kill_workers()`**: forcefully kills worker processes using `Process.kill()`

These methods provide users with a direct way to stop worker processes without `shutdown()` or relying on implementation details, addressing situations where immediate termination is needed.

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Co-authored-by: Sam Gross @colesbury
Commit-message-mostly-authored-by: Claude Sonnet 3.7 (because why not -greg)
2025-03-05 14:31:42 -08:00
Sebastian Rittau 4f6218959e
Update links from typing.readthedocs.io to typing.python.org (#130877) 2025-03-05 17:26:44 +02:00
Adam Turner e53d105872
GH-125722: Increase minimum supported Sphinx to 8.2.0 (#130444) 2025-03-05 00:31:01 +00:00
Tian Gao b6769e9404
gh-125377: Improve tab indentation for pdb multi-line input (#130471) 2025-03-04 15:45:38 -05:00
Jelle Zijlstra dc6d66f44c
gh-105499: Merge typing.Union and types.UnionType (#105511)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
Co-authored-by: Ken Jin <kenjin@python.org>
Co-authored-by: Carl Meyer <carl@oddbird.net>
2025-03-04 11:44:19 -08:00
Tomas R. e091520fdb
gh-126085: Add `tp_iter` to TypeAliasType to allow star unpacking (#127981) 2025-03-04 11:34:59 -08:00
Tian Gao 63b6ec31c4
gh-82987: Stop on calling frame unconditionally for inline breakpoints (#130493) 2025-03-04 11:35:47 -05:00
Sam Gross efadc5874c
Revert "gh-128041: Add `terminate_workers` and `kill_workers` methods to ProcessPoolExecutor (GH-128043)" (#130838)
The test_concurrent_futures.test_process_pool test is failing in CI.

This reverts commit f97e4098ff.
2025-03-04 11:19:06 -05:00
sobolevn 63ffb406bb
gh-129567: Add a note to `typing.TypedDict` docs about name mangling (#130233) 2025-03-04 18:15:00 +03:00
Petr Viktorin d91cc9db15
gh-129666: Add C11/C++11 to docs and -pedantic-errors to GCC/clang test_c[pp]ext tests (GH-130692)
Disable pedantic check for c++03 (unlimited API)

Also add a check for c++03 *limited* API, which passes in pedantic mode
after removing a comma in the `PySendResult` declaration, and allowing
`long long`.
2025-03-04 14:10:09 +01:00
Bénédikt Tran 3929af5e3a
gh-89083: add support for UUID version 7 (RFC 9562) (#121119)
Add support for generating UUIDv7 objects according to RFC 9562, §5.7 [1].

The functionality is provided by the `uuid.uuid7()` function. The implementation
is based on a 42-bit counter as described by Method 1, §6.2 [2] and guarantees
monotonicity within the same millisecond.

[1]: https://www.rfc-editor.org/rfc/rfc9562.html#section-5.7
[2]: https://www.rfc-editor.org/rfc/rfc9562.html#section-6.2

---------

Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
Co-authored-by: Éric <merwok@netwok.org>
2025-03-04 10:47:19 +01:00
Yuki Kobayashi b3c18bfd82
gh-130711: Document `PyBaseObject_Type` (GH-130712)
Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
2025-03-03 15:08:05 +01:00
Yuki Kobayashi a105f99019
gh-101100: Fix sphinx warnings in `library/email.errors.rst` (#130774) 2025-03-03 11:56:45 +02:00
Victorien 373eb1b47a
gh-101100: Fix Sphinx documentation warnings in `collections.rst` (#130629) 2025-03-03 11:46:38 +02:00
Mike Castle a85eeb9771
gh-129015: Improve disambiguation between `NotImplemented` and `NotImplementedError` (#129562)
---------

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2025-03-03 09:23:41 +01:00
Charles Machalow f97e4098ff
gh-128041: Add `terminate_workers` and `kill_workers` methods to ProcessPoolExecutor (GH-128043)
This adds two new methods to `multiprocessing`'s `ProcessPoolExecutor`:
- **`terminate_workers()`**: forcefully terminates worker processes using `Process.terminate()`
- **`kill_workers()`**: forcefully kills worker processes using `Process.kill()`

These methods provide users with a direct way to stop worker processes without `shutdown()` or relying on implementation details, addressing situations where immediate termination is needed.

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Commit-message-mostly-authored-by: Claude Sonnet 3.7 (because why not -greg)
2025-03-02 18:01:45 -08:00
Bénédikt Tran c6513f7a62
gh-128481: indicate that the default value for `FrameSummary.end_lineno` changed in 3.13 (#130755)
The value taken by `FrameSummary.end_lineno` when passing `end_lineno=None` changed in gh-112097.

Previously, a `end_lineno` could be specified to be `None` directly but since 939fc6d, passing None makes
the constructor use the value of `lineno` instead.
2025-03-02 18:16:51 +01:00
Bénédikt Tran 990ad272f6
gh-89083: add support for UUID version 6 (RFC 9562) (#120650)
Add support for generating UUIDv6 objects according to RFC 9562, §5.6 [1].

The functionality is provided by the `uuid.uuid6()` function which takes as inputs an optional 48-bit
hardware address and an optional 14-bit clock sequence. The UUIDv6 temporal fields are ordered
differently than those of UUIDv1, thereby providing improved database locality.

[1]: https://www.rfc-editor.org/rfc/rfc9562.html#section-5.6

---------

Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
2025-03-02 12:41:56 +01:00
Damien 051f0e5683
gh-128481: Improve documentation for `traceback.FrameSummary` (#128484)
Complete the `traceback.FrameSummary` signature and add missing
documentation for the `colno` and `end_{col,line}no` attributes.
2025-03-02 10:29:12 +01:00
Arijit Kumar Das 37145cb89f
Fix grammar typo in `Doc/c-api/arg.rst` (#130741) 2025-03-02 10:24:34 +01:00
Tim Hoffmann c71e55869e
Add link in the `importlib.metadata.version()` docs (#130739)
Link the specification for the returned data makes it clearer what this is
and what the format of the version string can be.
2025-03-02 10:23:32 +01:00
Apostol Fet 5181ddb29f
gh-130160: use `.. program::` directive for documenting `cProfile` CLI (#130314)
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2025-03-01 23:39:25 +03:00
Barney Gale 5326c27fc6
Revert "GH-116380: Speed up `glob.[i]glob()` by making fewer system calls. (#116392)" (#130743)
This broke tests on the 'aarch64 Fedora Stable Clang Installed 3.x' and
'AMD64 Fedora Stable Clang Installed 3.x' build bots.

This reverts commit da4899b94a.
2025-03-01 20:04:01 +00:00
Barney Gale da4899b94a
GH-116380: Speed up `glob.[i]glob()` by making fewer system calls. (#116392)
## Filtered recursive walk

Expanding a recursive `**` segment entails walking the entire directory
tree, and so any subsequent pattern segments (except special segments) can
be evaluated by filtering the expanded paths through a regex. For example,
`glob.glob("foo/**/*.py", recursive=True)` recursively walks `foo/` with
`os.scandir()`, and then filters paths through a regex based on "`**/*.py`,
with no further filesystem access needed.

This fixes an issue where `glob()` could return duplicate results.

## Tracking path existence

We store a flag alongside each path indicating whether the path is
guaranteed to exist. As we process the pattern:

- Certain special pattern segments (`""`, `"."` and `".."`) leave the flag
  unchanged
- Literal pattern segments (e.g. `foo/bar`) set the flag to false
- Wildcard pattern segments (e.g. `*/*.py`) set the flag to true (because
  children are found via `os.scandir()`)
- Recursive pattern segments (e.g. `**`) leave the flag unchanged for the
  root path, and set it to true for descendants discovered via
  `os.scandir()`.

If the flag is false at the end, we call `lstat()` on each path to filter
out missing paths.

## Minor speed-ups

- Exclude paths that don't match a non-terminal non-recursive wildcard
  pattern _prior_ to calling `is_dir()`.
- Use a stack rather than recursion to implement recursive wildcards.
  - This fixes a recursion error when globbing deep trees.
- Pre-compile regular expressions and pre-join literal pattern segments.
- Convert to/from `bytes` (a minor use-case) in `iglob()` rather than
  supporting `bytes` throughout. This particularly simplifies the code
  needed to handle relative bytes paths with `dir_fd`.
- Avoid calling `os.path.join()`; instead we keep paths in a normalized
  form and append trailing slashes when needed.
- Avoid calling `os.path.normcase()`; instead we use case-insensitive regex
  matching.

## Implementation notes

Much of this functionality is already present in pathlib's implementation
of globbing. The specific additions we make are:

1. Support for `dir_fd`
2. Support for `include_hidden`
3. Support for generating paths relative to `root_dir`

This unifies the implementations of globbing in the `glob` and `pathlib`
modules.

Co-authored-by: Pieter Eendebak <pieter.eendebak@gmail.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2025-02-28 20:33:51 +00:00
Barney Gale b545450961
GH-130608: Remove `dirs_exist_ok` argument from `pathlib.Path.copy()` (#130610)
This feature isn't sufficiently motivated.
2025-02-28 19:29:20 +00:00
Petr Viktorin ab11c09705
gh-129666: Revert "gh-129666: Add C11/C++11 to docs and `-pedantic-errors` to GCC/clang test_c[pp]ext tests (GH-130686)" (GH-130688)
This reverts commit 003e6d2b97.
2025-02-28 16:05:36 +00:00
Petr Viktorin 003e6d2b97
gh-129666: Add C11/C++11 to docs and `-pedantic-errors` to GCC/clang test_c[pp]ext tests (GH-130686) 2025-02-28 16:03:02 +01:00
Petr Viktorin e21863ce78
gh-46236: PyUnicode docs improvements (GH-129966)
Move deprecated PyUnicode API docs to new section

Move Py_UNICODE to a new "Deprecated API" section.

Formally soft-deprecate PyUnicode_READY, and move it

Document and soft-deprecate PyUnicode_IS_READY, and move it

Document PyUnicode_IS_ASCII, PyUnicode_CHECK_INTERNED

PyUnicode_New docs: Clarify requirements for "fresh" strings

PyUnicodeWriter_DecodeUTF8Stateful: Link "error-handlers"



Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2025-02-28 15:11:44 +01:00
Adam Turner 043ab3af9a
GH-121970: Extract ``issue_role`` into a new extension (#130615)
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2025-02-27 19:06:13 +00:00
Yuki Kobayashi b26286ca49
Docs: Fix a misplaced statement in the document for `ServerProxy` (GH-130616)
The sentence "If an HTTPS URL ..." explains what the parameter means,
so moved it to the paragraph explaining what the other parameters mean.
2025-02-27 16:14:56 +01:00
Fredrik Ahlberg 45a24f54af
gh-129288: Add optional l2_cid and l2_bdaddr_type in BTPROTO_L2CAP socket address tuple (#129293)
Add two optional, traling elements in the AF_BLUETOOTH socket address tuple:

- l2_cid, to allow e.g raw LE ATT connections
- l2_bdaddr_type. To be able to connect L2CAP sockets to Bluetooth LE devices,
  the l2_bdaddr_type must be set to BDADDR_LE_PUBLIC or BDADDR_LE_RANDOM.
2025-02-27 12:51:47 +00:00
Adam Turner 3f3e1c4095
Doc: Strip trailing whitespace in ``pydoc_topics`` (#130492) 2025-02-26 20:10:55 +00:00
Yuki Kobayashi b536e37104
gh-130433: Update documentation for `MultipartConversionError` (GH-130436) 2025-02-26 08:34:10 +00:00
Sergey B Kirpichev f39a07be47
gh-87790: support thousands separators for formatting fractional part of floats (#125304)
```pycon
>>> f"{123_456.123_456:_._f}"  # Whole and fractional
'123_456.123_456'
>>> f"{123_456.123_456:_f}"    # Integer component only
'123_456.123456'
>>> f"{123_456.123_456:._f}"   # Fractional component only
'123456.123_456'
>>> f"{123_456.123_456:.4_f}"  # with precision
'123456.1_235'
```
2025-02-25 16:27:07 +01:00
Yuki Kobayashi 4d3a7ea354
Docs: Fix some semantic usages of `iterator.__iter__` (GH-130172)
These references to an `__iter__` method mean `object.__iter__`, not `iterator.__iter__`.
2025-02-25 13:38:47 +01:00
Kanishk Pachauri 85f1cc8d60
gh-130461: Remove unnecessary usages of `.. index::` directives in Doc/library/uuid.rst (#130526)
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2025-02-25 14:27:50 +02:00
Mark Shannon 014223649c
GH-130396: Use computed stack limits on linux (GH-130398)
* Implement C recursion protection with limit pointers for Linux, MacOS and Windows

* Remove calls to PyOS_CheckStack

* Add stack protection to parser

* Make tests more robust to low stacks

* Improve error messages for stack overflow
2025-02-25 09:24:48 +00:00
RUANG (James Roy) 9f25c1f012
gh-46236: Add docs for PyUnicode_GetDefaultEncoding() doc (GH-130335)
* Clarify sys.getdefaultencoding() documentation

* Add missing documentation for PyUnicode_GetDefaultEncoding,
  the C equivalent of sys.getdefaultencoding
2025-02-24 15:37:21 +01:00
Petr Viktorin fc8d2cba54
gh-129405: Fix doc for Py_mod_multiple_interpreters default, and add test (GH-129406) 2025-02-24 14:59:19 +01:00
Bénédikt Tran 39ba4b6619
gh-127522: wsgiref: indicate that `start_response` objects should follow a specific protocol (GH-127525) 2025-02-24 13:43:56 +01:00
Petr Viktorin ef29104f7d
GH-91079: Revert "GH-91079: Implement C stack limits using addresses, not counters. (GH-130007)" for now (GH130413)
Revert "GH-91079: Implement C stack limits using addresses, not counters. (GH-130007)" for now

Unfortunatlely, the change broke some buildbots.

This reverts commit 2498c22fa0.
2025-02-24 11:16:08 +01:00
Kanishk Pachauri 0ff1611574
gh-130160: use `.. program::` directive for documenting `idle` CLI (#130278)
---------
Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2025-02-24 02:02:34 +00:00
mingyu 9f81f828c7
gh-129948: Add `set()` to `multiprocessing.managers.SyncManager` (#129949)
The SyncManager provided support for various data structures such as dict, list, and queue, but oddly, not set.
This introduces support for set by defining SetProxy and registering it with SyncManager.

---
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
Co-authored-by: Gregory P. Smith <greg@krypto.org>
2025-02-23 20:07:33 +00:00
Jacob Austin Lincoln 25a7ddf2ef
gh-65697: Prevent configparser from writing keys it cannot properly read (#129270)
---------

Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
2025-02-23 11:06:33 -05:00
Bénédikt Tran b8c313a41c
gh-84559: improve What's New entry for `multiprocessing` start method changes (#128173)
Co-authored-by: Gregory P. Smith <greg@krypto.org>
Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
2025-02-23 10:35:08 +01:00
sobolevn 5ec4bf86b7
gh-121970: Replace `.. coroutine{method,function}` with `:async:` (#130448)
Co-authored-by: Adam Turner <9087854+aa-turner@users.noreply.github.com>
2025-02-22 17:54:43 +00:00
Adam Turner 3cc9e867eb
Docs: Test presence of optional extensions with importlib (#130445) 2025-02-22 17:52:47 +00:00
sobolevn 89d8b2d14b
Add measuring unit to `sys.getswitchinterval` docs (#130457) 2025-02-22 19:05:10 +03:00
Russell Keith-Magee 474c388740
gh-129712: Document the wheels tags corresponding to each universal SDK. (#130389)
Document the architectures supported by macOS universal SDK configuration flags, 
and add details on wheel tag naming.
2025-02-22 16:30:30 +08:00
Adam Turner 30e892473e
GH-121970: Replace custom abstract method directive with the ``:abstract:`` option (#129311) 2025-02-22 01:53:57 +00:00
Adam Turner 8e96adf453
gh-130159: Fix list indentation in collections.abc (#130165) 2025-02-22 01:41:15 +00:00
Hugo van Kemenade 1cf9b6d9b8
gh-129965: Add missing MIME types (#129969)
Co-authored-by: Petr Viktorin <encukou@gmail.com>
2025-02-21 15:44:53 +00:00
sobolevn 9bf73c032f
Add `.. versionadded` directive to `dis` CLI options (#130267) 2025-02-21 15:59:17 +03:00
UV 5d66c55c8a
gh-127805: Clarify Formatter initialization in logging.rst. (GH-127850) 2025-02-21 07:10:04 +00:00
Marc Mueller 0f5b82169e
gh-46236: Document PyUnicode_RSplit, PyUnicode_Partition and PyUnicode_RPartition (#130191)
Co-authored-by: Petr Viktorin <encukou@gmail.com>
2025-02-20 16:41:41 +01:00
Vinay Sajip 8cbcf51d61
[doc]: Update logging cookbook to mention domain socket configuration in a recipe. (GH-130348) 2025-02-20 14:09:15 +00:00
Victor Stinner 519c2c6740
gh-128863: Deprecate the private _PyUnicodeWriter API (#129245)
Deprecate private C API functions:

* _PyUnicodeWriter_Init()
* _PyUnicodeWriter_Finish()
* _PyUnicodeWriter_Dealloc()
* _PyUnicodeWriter_WriteChar()
* _PyUnicodeWriter_WriteStr()
* _PyUnicodeWriter_WriteSubstring()
* _PyUnicodeWriter_WriteASCIIString()
* _PyUnicodeWriter_WriteLatin1String()

These functions are not deprecated in the internal C API (if the
Py_BUILD_CORE macro is defined).
2025-02-20 14:02:02 +01:00
Yuki Kobayashi 3bda821a83
gh-101100: Fix sphinx warnings in `readline.rst` (#130300) 2025-02-20 14:56:27 +02:00
Alcaro 417372bd43
Fix some ctypes docs typos (GH-130307) 2025-02-20 11:58:50 +01:00
Sabfo 47ace53995
gh-130130: Clarify `hash=False` docs in `dataclasses.field` (#130324) 2025-02-20 02:43:27 -05:00
Irit Katriel 6c982aeb54
gh-130250: fix regression in traceback.print_last (#130318) 2025-02-19 21:44:35 +00:00
za 73801864d8
gh-122876: Fix "End of lines" typo (#125310)
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2025-02-19 19:16:38 +00:00
Mark Shannon 2498c22fa0
GH-91079: Implement C stack limits using addresses, not counters. (GH-130007)
* Implement C recursion protection with limit pointers

* Remove calls to PyOS_CheckStack

* Add stack protection to parser

* Make tests more robust to low stacks

* Improve error messages for stack overflow
2025-02-19 11:44:57 +00:00
Adam Turner 736ad664e0
Docs: Upgrade Sphinx to 8.2 (#130171) 2025-02-18 23:45:02 +00:00
Sergey Miryanov bcc9a5dddb
gh-129515: Clarify syntax error messages for conditional expressions (#129880)
Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
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-02-18 21:43:19 +00:00
Pablo Galindo Salgado 51d4bf1e0e
bpo-45325: Add a new 'p' parameter to Py_BuildValue to convert an integer into a Python bool (#28634) 2025-02-18 17:14:11 +00:00
sobolevn 97d0011e7e
gh-130160: use `option` instead of `cmdoption` in `dis.rst` (#130255) 2025-02-18 15:54:14 +03:00
Kanishk Pachauri 8cd7f8bf8d
gh-130160: use `.. program::` directive for documenting `ensurepip` CLI (gh-130253) 2025-02-18 12:09:22 +00:00
Tomas R. 25422561de
gh-125756: Document Pickler.clear_memo() (GH-125762) 2025-02-17 17:48:29 +02:00
Yuki Kobayashi fc8c99a8ce
gh-130214: Document `PyEllipsis_Type` (GH-130215) 2025-02-17 13:56:33 +01:00
Irit Katriel c9b1bf302c
gh-130139: always check ast node type in ast.parse() with ast input (#130140) 2025-02-16 13:32:39 +00:00
Stan Ulbrych 9837c2a214
gh-130169: Fix broken list markup in `Doc/c-api/function.rst` (#130174) 2025-02-16 13:55:31 +03:00
AN Long 798f8d3ea9
Replace non-breaking spaces with normal spaces (#130116)
Using normal spaces in place of non-breaking spaces.
2025-02-16 09:33:14 +08:00
Ken Jin a13460ac44
Add Neil's suggestions to whatsnew wording for tailcall (#130155)
Add Neil's suggestions

Co-authored-by: Neil Schemenauer <690853+nascheme@users.noreply.github.com>
2025-02-15 21:09:37 +08:00
Srinivas Reddy Thatiparthy (తాటిపర్తి శ్రీనివాస్ రెడ్డి) d2e60d8e59
gh-130106: Fix a typo in unittest.mock doc (#130107) 2025-02-15 03:30:12 +00:00
Inada Naoki e65e9f9062
Doc: update term "namespace package" (#129251) 2025-02-14 13:47:54 -05:00
Stan Ulbrych 3402e133ef
gh-82045: Correct and deduplicate "isprintable" docs; add test. (GH-130118)
We had the definition of what makes a character "printable" documented in three places, giving two different definitions.
The definition in the comment on `_PyUnicode_IsPrintable` was inverted; correct that.

With that correction, the two definitions turn out to be equivalent -- but to confirm that, you have to go look up, or happen to know, that those are the only five "Other" categories and only three "Separator" categories in the Unicode character database.  That makes it hard for the reader to tell whether they really are the same, or if there's some subtle difference in the intended semantics.

Fix that by cutting the C API docs' and the C comment's copies of the subtle details, in favor of referring to the Python-level docs. That ensures it's explicit that these are all meant to agree, and also lets us concentrate improvements to the wording in one place.

Speaking of which, borrow some ideas from the C comment, along with other tweaks, to hopefully add a bit more clarity to that one newly-centralized copy in the docs.

Also add a thorough test that the implementation agrees with this definition.

Author:    Greg Price <gnprice@gmail.com>

Co-authored-by: Greg Price <gnprice@gmail.com>
2025-02-14 18:16:47 +01:00
Ken Jin aa28423201
Revert "gh-130048: Reintroduce full LTO as default on Clang (GH-130049)" (#130088)
This reverts commit 34c06ccc4c.
2025-02-13 17:27:19 +00:00
Ken Jin 34c06ccc4c
gh-130048: Reintroduce full LTO as default on Clang (GH-130049) 2025-02-13 22:06:00 +08:00
Ammar Askar f9a7d41bac
gh-96092: Fix traceback.walk_stack(None) skipping too many frames (#129330)
As it says in its documentation, walk_stack was meant to just
follow `f.f_back` like other functions in the traceback module.
Instead it was previously doing `f.f_back.f_back` and then this
changed to `f_back.f_back.f_back.f_back' in Python 3.11 breaking
its behavior for external users.

This happened because the walk_stack function never really had
any good direct tests and its only consumer in the traceback module was
`extract_stack` which passed the result into `StackSummary.extract`.
As a generator, it was previously capturing the state of the stack
when it was first iterated over, rather than the stack when `walk_stack`
was called. Meaning when called inside the two method deep
`extract` and `extract_stack` calls, two `f_back`s were needed.
When 3.11 modified the sequence of calls in `extract`, two more
`f_back`s were needed to make the tests happy.

This changes the generator to capture the stack when `walk_stack` is
called, rather than when it is first iterated over. Since this is
technically a breaking change in behavior, there is a versionchanged
to the documentation. In practice, this is unlikely to break anyone,
you would have been needing to store the result of `walk_stack` and
expecting it to change.
2025-02-13 01:43:09 +00:00
Pablo Galindo Salgado 6fb5138776
gh-88535: Improve syntax error for wrongly closed strings (#26633) 2025-02-13 01:30:20 +00:00
Satyam Kumar 791cdfe141
gh-129912: Fix references to `Py_TPFLAGS_MANAGED_DICT` (gh-130044) 2025-02-12 17:48:14 -05:00
Andrew Svetlov 469d2e416c
gh-129889: Support context manager protocol by contextvars.Token (#129888) 2025-02-12 12:32:58 +01:00
Stan Ulbrych 555ee43d92
gh-59149: Setup documentation for IDLE on Linux and add section in Editors (#130003)
Co-authored-by: Petr Viktorin <encukou@gmail.com>
---------

Co-authored-by: Petr Viktorin <encukou@gmail.com>
2025-02-12 03:16:56 -05:00
Wulian233 06ac157c53
gh-125746: Delay deprecated `zipimport.zipimporter.load_module` removal time to 3.15 (#125748) 2025-02-11 23:59:09 +00:00
Hugo van Kemenade 53e8e72dab Merge branch 'main' of https://github.com/python/cpython 2025-02-11 21:29:11 +02:00
Tomas R. aa81a6f6e4
gh-97850: Update the deprecation warning of `importlib.abc.Loader.load_module` (GH-129855) 2025-02-11 11:04:16 -08:00
Hugo van Kemenade 3ae9101482 Python 3.14.0a5 2025-02-11 19:16:29 +02:00
Yuki Kobayashi 1da412e574
gh-101100: Docs: Fix some typos in the document (#129988)
Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>
2025-02-11 13:06:32 +02:00
Wulian233 12bd15f7b3
gh-129939: Add darkmode support for difflib's comparison pages (#129940) 2025-02-11 10:58:57 +02:00
Hugo van Kemenade 1feaecc2bc
gh-123299: Copyedit "What's New in Python 3.14" (#129970) 2025-02-10 23:46:36 +02:00
Ken Jin 516c70d4dd
Clarify baseline for new interpreter (GH-129972) 2025-02-10 19:07:24 +00:00
Yuki Kobayashi 8d9d3e4ecb
gh-46236: Document `PyUnicode_DecodeCodePageStateful` (GH-127934)
Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
2025-02-10 17:17:37 +01:00
Vinay Sajip 7c156a63d3
gh-129143: Fix incorrect documentation for logging.Handler.close(). (GH-129950) 2025-02-10 11:13:52 +00:00
Victorien 2abb6a4f13
Fix typo in 3.14 `pdb` whatsnew entry (#129886) 2025-02-09 22:17:05 -08:00
Victorien d05053a203
Fix typo in `enum` documentation (#129920) 2025-02-09 21:48:11 +00:00
Stan Ulbrych 6fbf15f98e
gh-129873: IDLE: Improve help.py's method of parsing HTML (#129859)
In `help.copy_strip`, only copy the text `<section>`.  In `help.HelpParser.handle_starttag` and elsewhere, remove code to skip the no longer present html.  Add a reminder at the top of idle.rst to run copy_strip after changes.
---------

Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
2025-02-09 08:17:35 +00:00
Tian Gao 29f8a67ae0
Provide curframe_locals for backward compatibility but deprecate it (#125951) 2025-02-08 23:35:28 +00:00
Gregory P. Smith 5ce70ad129
gh-64414: mention AF_INET6 and IPv6 in socketserver docs. (#129866)
mention AF_INET6 and IPv6 in socketserver docs.
2025-02-08 12:06:28 -08:00
Ned Batchelder f2ae79d29e
Docs: more explanation of the implications of new tail-call interpreter (GH-129863)
Co-authored-by: Ken Jin <kenjin4096@gmail.com>
2025-02-08 19:28:35 +00:00
Stan Ulbrych 33a7094aa6
gh-129699: Add description to IDLE doc title (#129727)
Also extend the 'idlelib' section header. These additions affect both the displayed idle.html file and the contents.html file displayed by clicking the Complete table of contents link on the main docs.python.org page. (The module index entries are generated from the module name and synopsis within module files.)
---------

Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
2025-02-08 14:26:07 -05:00
Hugo van Kemenade 1bccd6c34f
gh-128317: Move CLI calendar highlighting to private class (#129625)
Co-authored-by: Petr Viktorin <encukou@gmail.com>
2025-02-08 15:56:57 +00:00
Brian Ward 421ea1291d
gh-119349: Add ctypes.util.dllist -- list loaded shared libraries (GH-122946)
Add function to list the currently loaded libraries to ctypes.util

The dllist() function calls platform-specific APIs in order to
list the runtime libraries loaded by Python and any imported modules.
On unsupported platforms the function may be missing.


Co-authored-by: Eryk Sun <eryksun@gmail.com>
Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
2025-02-08 14:02:36 +01:00
Tian Gao d3b60fff58
gh-124703: Add documentation and whatsnew entry for pdb exit change (#129818) 2025-02-07 21:02:46 -05:00
Barney Gale 718ab66299
GH-125413: Add `pathlib.Path.info` attribute (#127730)
Add `pathlib.Path.info` attribute, which stores an object implementing the `pathlib.types.PathInfo` protocol (also new). The object supports querying the file type and internally caching `os.stat()` results. Path objects generated by `Path.iterdir()` are initialised with status information from `os.DirEntry` objects, which is gleaned from scanning the parent directory.

The `PathInfo` protocol has four methods: `exists()`, `is_dir()`, `is_file()` and `is_symlink()`.
2025-02-08 01:16:45 +00:00
Irit Katriel a1417b211f
gh-100239: replace BINARY_SUBSCR & family by BINARY_OP with oparg NB_SUBSCR (#129700) 2025-02-07 22:39:54 +00:00
Ken Jin e4a00f70b1
Fix link in 3.14 whatsnew (#129828) 2025-02-07 19:30:23 +00:00
Ken Jin 7b2e01bb55
Remove tail-calling wording as it is confusing (GH-129823) 2025-02-07 18:49:28 +00:00
Garrett Gu 662e88db64
Fix Garrett Gu name misspelling in 3.14 whatsnew (GH-129822)
Update 3.14.rst to fix typo
2025-02-07 17:56:46 +00:00
Adam Turner a93a5a39fb
gh-128563: Clarify clarificatory tail calling wording in What's New (#129812) 2025-02-07 15:12:33 +00:00
Ken Jin 476a78fdd6
gh-128563: Clarify tail calling interpreter is not TCO (#129809)
Clarify tail calling interpreter is not TCO
2025-02-07 14:59:34 +00:00
Ken Jin 3d3a4beefe
gh-128563: Document the tail-calling interpreter (GH-129728)
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2025-02-07 20:18:15 +08:00
Forest 0fef47e5bb
gh-55454: Add IMAP4 IDLE support to imaplib (#122542)
* gh-55454: Add IMAP4 IDLE support to imaplib

This extends imaplib with support for the rfc2177 IMAP IDLE command,
as requested in #55454.  It allows events to be pushed to a client as
they occur, rather than having to continually poll for mailbox changes.

The interface is a new idle() method, which returns an iterable context
manager.  Entering the context starts IDLE mode, during which events
(untagged responses) can be retrieved using the iteration protocol.
Exiting the context sends DONE to the server, ending IDLE mode.

An optional time limit for the IDLE session is supported, for use with
servers that impose an inactivity timeout.

The context manager also offers a burst() method, designed for programs
wishing to process events in batch rather than one at a time.

Notable differences from other implementations:

- It's an extension to imaplib, rather than a replacement.
- It doesn't introduce additional threads.
- It doesn't impose new requirements on the use of imaplib's existing methods.
- It passes the unit tests in CPython's test/test_imaplib.py module
  (and adds new ones).
- It works on Windows, Linux, and other unix-like systems.
- It makes IDLE available on all of imaplib's client variants
  (including IMAP4_stream).
- The interface is pythonic and easy to use.

Caveats:

- Due to a Windows limitation, the special case of IMAP4_stream running
  on Windows lacks a duration/timeout feature. (This is the stdin/stdout
  pipe connection variant; timeouts work fine for socket-based
  connections, even on Windows.) I have documented it where appropriate.

- The file-like imaplib instance attributes are changed from buffered to
  unbuffered mode. This could potentially break any client code that
  uses those objects directly without expecting partial reads/writes.
  However, these attributes are undocumented. As such, I think (and
  PEP 8 confirms) that they are fair game for changes.
  https://peps.python.org/pep-0008/#public-and-internal-interfaces

Usage examples:

https://github.com/python/cpython/issues/55454#issuecomment-2227543041

Original discussion:

https://discuss.python.org/t/gauging-interest-in-my-imap4-idle-implementation-for-imaplib/59272

Earlier requests and suggestions:

https://github.com/python/cpython/issues/55454

https://mail.python.org/archives/list/python-ideas@python.org/thread/C4TVEYL5IBESQQPPS5GBR7WFBXCLQMZ2/

* gh-55454: Clarify imaplib idle() docs

- Add example idle response tuples, to make the minor difference from other
  imaplib response tuples more obvious.
- Merge the idle context manager's burst() method docs with the IMAP
  object's idle() method docs, for easier understanding.
- Upgrade the Windows note regarding lack of pipe timeouts to a warning.
- Rephrase various things for clarity.

* docs: words instead of <=

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

* docs: improve style in an example

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

* docs: grammatical edit

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

* docs consistency

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

* comment -> docstring

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

* docs: refer to imaplib as "this module"

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

* imaplib: simplify & clarify idle debug message

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

* imaplib: elaborate in idle context manager comment

* imaplib: re-raise BaseException instead of bare except

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

* imaplib: convert private doc string to comment

* docs: correct mistake in imaplib example

This is a correction to 8077f2eab2, which
changed a variable name in only one place and broke the subsequent
reference to it, departed from the naming convention used in the rest of
the module, and shadowed the type() builtin along the way.

* imaplib: simplify example code in doc string

This is for consistency with the documentation change in 8077f2eab2
and subsequent correction in 013bbf18fc.

* imaplib: rename _Idler to Idler, update its docs

* imaplib: add comment in Idler._pop()

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

* imaplib: remove unnecessary blank line

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

* imaplib: comment on use of unbuffered pipes

* docs: imaplib: use the reStructuredText :class: role

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

* Revert "docs: imaplib: use the reStructuredText :class: role"

This reverts commit f385e441df, because it
triggers CI failures in the docs by referencing a class that is
(deliberately) undocumented.

* docs: imaplib: use the reST :class: role, escaped

This is a different approach to f385e441df, which was reverted for
creating dangling link references.

By prefixing the reStructuredText role target with a ! we disable
conversion to a link, thereby passing continuous integration checks
even though the referenced class is deliberately absent from the
documentation.

* docs: refer to IMAP4 IDLE instead of just IDLE

This clarifies that we are referring to the email protocol, not the editor with the same name.

Co-authored-by: Guido van Rossum <gvanrossum@gmail.com>

* imaplib: IDLE -> IMAP4 IDLE in exception message

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

* docs: imaplib idle() phrasing and linking tweaks

* docs: imaplib: avoid linking to an invalid target

This reverts and rephrases part of a3f21cd75b
which created links to a method on a deliberately undocumented class.
The links didn't work consistently, and caused sphinx warnings that
broke cpython's continuous integration tests.

* imaplib: update test after recent exception change

This fixes a test that was broken by changing an exception in
b01de95171

* imaplib: rename idle() dur argument to duration

* imaplib: bytes.index() -> bytes.find()

This makes it more obvious which statement triggers the branch.

* imaplib: remove no-longer-necessary statement

Co-authored-by: Martin Panter <vadmium@users.noreply.github.com>

* docs: imaplib: concise & valid method links

The burst() method is a little tricky to link in restructuredText, due
to quirks of its parent class.  This syntax allows sphinx to generate
working links without generating warnings (which break continuous
integration) and without burdening the reader with unimportant namespace
qualifications.  It makes the reST source ugly, but few people read
the reST source, so it's a tolerable tradeoff.

* imaplib: note data types present in IDLE responses

* docs: imaplib: add comma to reST changes header

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>

* imaplib: sync doc strings with reST docs

* docs: imaplib: minor Idler clarifications

* imaplib: idle: emit (type, [data, ...]) tuples

This allows our iterator to emit untagged responses that contain literal
strings in the same way that imaplib's existing methods do, while still
emitting exactly one whole response per iteration.

* imaplib: while/yield instead of yield from iter()

* imaplib: idle: use deadline idiom when iterating

This simplifies the code, and avoids idle duration drift from time spent
processing each iteration.

* docs: imaplib: state duration/interval arg types

* docs: imaplib: minor rephrasing of a sentence

* docs: imaplib: reposition a paragraph

This might improve readability, especially when encountering Idler.burst()
for the first time.

* docs: imaplib: wrap long lines in idle() section

* docs: imaplib: note: Idler objects require 'with'

* docs: imaplib: say that 29 minutes is 1740 seconds

* docs: imaplib: mark a paragraph as a 'tip'

* docs: imaplib: rephrase reference to MS Windows

* imaplib: end doc string titles with a period

* imaplib: idle: socket timeouts instead of select()

IDLE timeouts were originally implemented using select() after
checking for the presence of already-buffered data.
That allowed timeouts on pipe connetions like IMAP4_stream.
However, it seemed possible that SSL data arriving without any
IMAP data afterward could cause select() to indicate available
application data when there was none, leading to a read() call
that would block with no timeout. It was unclear under what
conditions this would happen in practice. This change switches
to socket timeouts instead of select(), just to be safe.

This also reverts IMAP4_stream changes that were made to support IDLE
timeouts, since our new implementation only supports socket connections.

* imaplib: Idler: rename private state attributes

* imaplib: rephrase a comment in example code

* docs: imaplib: idle: use Sphinx code-block:: pycon

* docs: whatsnew: imaplib: reformat IMAP4.idle entry

* imaplib: idle: make doc strings brief

Since we generally rely on the reST/html documentation for details, we
can keep these doc strings short. This matches the module's existing doc
string style and avoids having to sync small changes between two files.

* imaplib: Idler: split assert into two statements

* imaplib: Idler: move assignment out of try: block

* imaplib: Idler: move __exit__() for readability

* imaplib: Idler: move __next__() for readability

* imaplib: test: make IdleCmdHandler a global class

* docs: imaplib: idle: collapse double-spaces

* imaplib: warn on use of undocumented 'file' attr

* imaplib: revert import reformatting

Since we no longer import platform or selectors, the original import
statement style can be restored, reducing the footprint of PR #122542.

* imaplib: restore original exception msg formatting

This reduces the footprint of PR #122542.

* docs: imaplib: idle: versionadded:: next

* imaplib: move import statement to where it's used

This import is only needed if external code tries to use an attribute
that it shouldn't be using. Making it a local import reduces module
loading time in supported cases.

* imaplib test: RuntimeWarning on IMAP4.file access

* imaplib: use stacklevel=2 in warnings.warn()

* imaplib test: simplify IMAP4.file warning test

* imaplib test: pre-idle-continuation response

* imaplib test: post-done untagged response

* imaplib: downgrade idle-denied exception to error

This makes it easier for client code to distinguish a temporary
rejection of the IDLE command from a server responding incorrectly to
IDLE.

* imaplib: simplify check for socket object

* imaplib: narrow the scope of IDLE socket timeouts

If an IDLE duration or burst() was in use, and an unsolicited response
contained a literal string, and crossed a packet boundary, and the
subsequent packet was delayed beyond the IDLE feature's time limit, the
timeout would leave the incoming protocol stream in a bad state (with
the tail of that response appearing where the start of a response is
expected).

This change moves the IDLE socket timeout to cover only the start
of a response, so it can no longer cause that problem.

* imaplib: preserve partial reads on exception

This ensures that short IDLE durations / burst() intervals
won't risk corrupting response lines that span multiple packets.

* imaplib: read/readline: save multipart buffer tail

For resilience if read() or readline() ever complete with more than one
bytes object remaining in the buffer. This is not expected to happen,
but it seems wise to be prepared for a future change making it possible.

* imaplib: use TimeoutError subclass only if needed

* doc: imaplib: elaborate on IDLE response delivery

* doc: imaplib: elaborate in note re: IMAP4.response

* imaplib: comment on benefit of reading in chunks

Our read() implementation designed to support IDLE replaces the one from
PR #119514, fixing the same problem it was addressing. The tests that it
added are preserved.

* imaplib: readline(): treat ConnectionError as EOF

---------

Co-authored-by: Gregory P. Smith <greg@krypto.org>
Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
Co-authored-by: Guido van Rossum <guido@python.org>
Co-authored-by: Guido van Rossum <gvanrossum@gmail.com>
Co-authored-by: Martin Panter <vadmium@users.noreply.github.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2025-02-06 19:15:11 -08:00
Raymond Hettinger e1e85204ed
Add multinomial to the itertools recipes docs (gh-129760) 2025-02-06 18:35:55 -06:00
Gregory P. Smith 78377c788e
gh-112020: Rework socketserver examples to be correct (#129741)
gh-112020: Rework socketserver examples to be correct.

Outdated code updated, the BaseRequestHandler example is now much more
illustrative instead of the bad idea of a single recv() call for TCP.

tested, they now work.
2025-02-06 09:42:47 -08:00
Adam Turner 4d56c40440
GH-121970: Extract ``implementation_detail`` into a new extension (#129663) 2025-02-06 16:53:27 +00:00
Gregory P. Smith ded54c3baa
Remove an inaccurate note from `socket.recv` (GH-129733)
Remove an inaccurate note from socket.recv.
2025-02-06 16:39:37 +00:00
Miro Hrončok 779d06945c
gh-118915: Fix bad link in documentation (GH-129691) 2025-02-06 13:34:06 +01:00
Cody Maloney 5fb019fc29
gh-129559: Add `bytearray.resize()` (GH-129560)
Add bytearray.resize() which wraps PyByteArray_Resize.

Make negative size passed to resize exception/error rather than crash in optimized builds.
2025-02-05 11:33:17 -08:00
Petr Viktorin 58a4357e29
gh-127833: Docs: Add a `grammar-snippet` directive & replace `productionlist` (GH-127835)
As a first step toward aligning the grammar documentation with Python's actual
grammar, this overrides the ReST `productionlist` directive to:
- use `:` instead of the `::=` symbol
- add syntax highlighting for strings (using a Pygments highlighting class)

All links and link targets should be preserved. (Unfortunately, this reaches
into some Sphinx internals; I don't see a better way to do exactly what
Sphinx does.)

This also adds a new directive, `grammar-snippet`, which formats the snippet
almost exactly like what's in the source, modulo syntax highlighting and
keeping the backtick character to mark links to other rules.
This will allow formatting the snippets as in the grammar file
(file:///home/encukou/dev/cpython/Doc/build/html/reference/grammar.html).

The new directive is applied to two simple rules in toplevel_components.rst

---------

Co-authored-by: Blaise Pabon <blaise@gmail.com>
Co-authored-by: William Ferreira <wqferr@gmail.com>
Co-authored-by: bswck <bartoszpiotrslawecki@gmail.com>
Co-authored-by: Adam Turner <9087854+aa-turner@users.noreply.github.com>
2025-02-05 16:12:23 +01:00
Sam Gross e5f10a7414
gh-127933: Add option to run regression tests in parallel (gh-128003)
This adds a new command line argument, `--parallel-threads` to the
regression test runner to allow it to run individual tests in multiple
threads in parallel in order to find multithreading bugs.

Some tests pass when run with `--parallel-threads`, but there's still
more work before the entire suite passes.
2025-02-04 17:44:59 -05:00
Serhiy Storchaka 078ab828b9
Use roles :data: and :const: for referencing module variables (GH-129507) 2025-02-04 16:16:41 +02:00
donBarbos bb5c6875d6
gh-111637: Clarify MIME type recognition behavior in mimetypes documentation (GH-129546) 2025-02-03 16:42:12 +00:00
Victor Stinner 04264a286e
gh-101944: Clarify PyModule_AddObjectRef() documentation (#129433) 2025-02-03 12:55:22 +01:00
Peter Bierma 39b754a359
gh-129407: Clarify that a `SystemError` isn't always CPython's fault (#129410) 2025-02-03 12:46:13 +01:00
Victor Stinner 632ca56821
gh-129342: Explain how to replace Py_GetProgramName() in C (#129361) 2025-02-03 12:36:41 +01:00
Illia Volochii a33dcb9e43
gh-81340: Use copy_file_range in shutil.copyfile copy functions (GH-93152)
This allows the underlying file system an opportunity to optimise or avoid the actual copy.
2025-02-03 10:23:27 +00:00
Victor Stinner 2ad069d906
gh-91417: Remove PySequence_Fast() from the limited C API (#129398)
The function never worked with the limited C API. It was added by
mistake.
2025-02-02 23:17:30 +01:00
Adam Turner ae4788809d
GH-121970: Extract ``misc_news`` into a new extension (#129577) 2025-02-02 16:17:02 +00:00
Adam Turner 0612a89ffc
gh-126609: Allow translating the ``availability`` directive (#129549) 2025-02-02 16:12:01 +00:00
Stan Ulbrych cf4c4ecc26
gh-126022: Replace TeX quotation marks with ``"`` in Doc/license.rst (#129535) 2025-02-01 18:49:45 +02:00
Peter Bierma 9ba281d871
gh-128509: Add `sys._is_immortal` for identifying immortal objects (#128510)
Co-authored-by: Kumar Aditya <kumaraditya@python.org>
2025-01-31 15:27:08 +00:00
Michael Osipov e3eba8ce26
gh-129393: Make 'sys.platform' return "freebsd" only on FreeBSD (#129394)
Make 'sys.platform' return "freebsd" only on FreeBSD without major version.
2025-01-31 10:02:45 +01:00
Victor Stinner 3bebe46d34
gh-128911: Add PyImport_ImportModuleAttr() function (#128912)
Add PyImport_ImportModuleAttr() and
PyImport_ImportModuleAttrString() functions.

* Add unit tests.
* Replace _PyImport_GetModuleAttr()
  with PyImport_ImportModuleAttr().
* Replace _PyImport_GetModuleAttrString()
  with PyImport_ImportModuleAttrString().
* Remove "pycore_import.h" includes, no longer needed.
2025-01-30 11:17:29 +00:00
Stan Ulbrych 652f66ac38
gh-129438: Update ``--enable-experimental-jit`` section with install requirements (#129450)
Add a note to the `JIT` docs that building CPython with `JIT` requires Python 3.11 or newer.

Co-authored-by: Brandt Bucher <brandtbucher@gmail.com>
2025-01-30 12:16:05 +02:00
Hod fdcedfd3cf
gh-126400: Add TCP socket timeout to SysLogHandler to prevent blocking (GH-126716)
Co-authored-by: Vinay Sajip <vinay_sajip@yahoo.co.uk>
2025-01-29 19:37:43 +00:00
Sam Gross d23f5701ad
gh-128844: Make `_Py_TryIncref` public as an unstable API. (#128926)
This exposes `_Py_TryIncref` as `PyUnstable_TryIncref()` and the helper
function `_PyObject_SetMaybeWeakref` as `PyUnstable_EnableTryIncRef`.

These are helpers for dealing with unowned references in a safe way,
particularly in the free threading build.

Co-authored-by: Petr Viktorin <encukou@gmail.com>
2025-01-28 19:32:27 +00:00
RUANG (James Roy) 1c3bb200da
gh-85046: Document errno constants (#126420) 2025-01-28 01:12:45 +01:00
Nick Pope 8ec76d9034
gh-128427: Add `uuid.NIL` and `uuid.MAX` (#128429) 2025-01-27 18:17:17 +02:00
Victor Stinner d8e16ef703
Cleanup What's New in Python 3.14 (C API changes) (#129341)
* Document PyDictObject.ma_version_tag removal.
* Add "Limited C API Changes" section.
* Move entries from New Features to Porting to Python 3.14.
* Include Pending removal documents at the right place.
2025-01-27 16:06:07 +01:00
Peter Bierma 3fb5f6eb9b
gh-128509: Add `PyUnstable_IsImmortal` for finding immortal objects (GH-129182)
Co-authored-by: Victor Stinner <vstinner@python.org>
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Co-authored-by: Petr Viktorin <encukou@gmail.com>
2025-01-27 14:36:33 +01:00
Victor Stinner 7ec17429d4
gh-102471: Change PyLongWriter_Discard(NULL) to do nothing (#129339)
It's convenient to be able to call PyLongWriter_Discard(NULL) in
error handling code.
2025-01-27 10:51:16 +00:00
Victor Stinner 11148e91e3
gh-102471: Credit Sergey B Kirpichev for PEP 757 (#129338) 2025-01-27 11:44:13 +01:00
Alex Willmer a8dc6d6d44
gh-115911: Ignore PermissionError during import from cwd (#116131)
Ignore PermissionError when checking cwd during import

On macOS `getcwd(3)` can return EACCES if a path component isn't readable,
resulting in PermissionError. `PathFinder.find_spec()` now catches these and
ignores them - the same treatment as a missing/deleted cwd.

Introduces `test.support.os_helper.save_mode(path, ...)`, a context manager
that restores the mode of a path on exit.

This is allows finer control of exception handling and robust environment
restoration across platforms in `FinderTests.test_permission_error_cwd()`.

Co-authored-by: Jason R. Coombs <jaraco@jaraco.com>
Co-authored-by: Brett Cannon <brett@python.org>
2025-01-26 19:00:28 +00:00
partev a156b19424
gh-126022: Remove zope.org from the permitted linkcheck redirects (#129308) 2025-01-26 16:46:00 +02:00
Cody Maloney 1ed4487968
gh-129205: Add os.readinto() API for reading data into a caller provided buffer (#129211)
Add a new OS API which will read data directly into a caller provided
writeable buffer protocol object.

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
2025-01-26 14:21:03 +01:00
Adam Turner 0ef8d470b7
GH-121970: Remove pyspecific ``PyDecoratorMixin`` patches (#129306) 2025-01-26 03:43:23 +00:00
Hugo van Kemenade e119526edf
gh-126022: make license.rst consistent with LICENSE: fix underline (#129292) 2025-01-25 15:36:58 +02:00
partev 9682a88683
gh-126022: make license.rst consistent with LICENSE (#128516) 2025-01-25 13:41:32 +02:00
Adam Turner d40692db06
GH-125722: Remove Sphinx patches (#129277) 2025-01-25 03:47:55 +00:00
Giles Copp 9abbb58e3f
gh-112713 : Add support for 'partitioned' attribute in http.cookies (GH-112714)
* Add support for 'partitioned' attribute in http.cookies

Co-authored-by: Giles Copp <gilesc@dropbox.com>
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Co-authored-by: Gregory P. Smith [Google LLC] <greg@krypto.org>
2025-01-24 22:31:52 +00:00
Sergey B Kirpichev 233fd00f0a
gh-128863: Deprecate _PyLong_FromDigits() function (#127939) 2025-01-24 13:17:10 +01:00
Jeong, YunWon bab8918f9a
gh-109975: Add list of 3.13 removed library replacements (#127816)
Add list of 3.13 removed library replacements
2025-01-23 22:20:40 +01:00
sobolevn c05a851ac5
gh-91048: Improve example in `asyncio-graph.rst` doc (#129224) 2025-01-23 23:38:51 +05:30
Sergey B Kirpichev 5c9a63f62c
gh-128863: Deprecate _PyLong_New() function (#129212) 2025-01-23 13:50:34 +01:00
Sam Gross a10f99375e
Revert "GH-128914: Remove conditional stack effects from `bytecodes.c` and the code generators (GH-128918)" (GH-129202)
The commit introduced a ~2.5-3% regression in the free threading build.

This reverts commit ab61d3f430.
2025-01-23 09:26:25 +00:00
Victor Stinner 1d485db953
gh-128863: Deprecate _PyLong_Sign() function (#129176)
Replace _PyLong_Sign() with PyLong_GetSign().
2025-01-23 03:11:53 +01:00
Yury Selivanov 188598851d
GH-91048: Add utils for capturing async call stack for asyncio programs and enable profiling (#124640)
Signed-off-by: Pablo Galindo <pablogsal@gmail.com>
Co-authored-by: Pablo Galindo <pablogsal@gmail.com>
Co-authored-by: Kumar Aditya <kumaraditya@python.org>
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
Co-authored-by: Savannah Ostrowski <savannahostrowski@gmail.com>
Co-authored-by: Jacob Coffee <jacob@z7x.org>
Co-authored-by: Irit Katriel <1055913+iritkatriel@users.noreply.github.com>
2025-01-22 17:25:29 +01:00
Victor Stinner 9012fa741d
gh-128863: Deprecate private C API functions (#128864)
Deprecate private C API functions:

* _PyBytes_Join()
* _PyDict_GetItemStringWithError()
* _PyDict_Pop()
* _PyThreadState_UncheckedGet()
* _PyUnicode_AsString()
* _Py_HashPointer()
* _Py_fopen_obj()

Replace _Py_HashPointer() with Py_HashPointer().

Remove references to deprecated functions.
2025-01-22 11:04:19 +00:00
Petr Viktorin a65f802692
gh-61103: Add What's New entry for complex types in ctypes (GH-129129)
Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>
2025-01-22 10:59:20 +01:00
Adam Turner 01bcf13a1c
GH-121970: Extract ``pydoc_topics`` into a new extension (#129116) 2025-01-21 23:28:32 +00:00
Michael Kashirin f18b226492
gh-126172: Fix a misleading statement in PYTHON_BASIC_REPL documentation (#127203)
Fix a misleading statement in PYTHON_BASIC_REPL documentation.
2025-01-21 20:05:19 +00:00
Sergey B Kirpichev 6105846390
gh-122845: fix parameter_list_starargs in function definition pseudo-grammar (#122847)
Thanks to Artur Chakhvadze for bugfix.
2025-01-21 20:04:07 +00:00
Wim Jeantine-Glenn a4760ef8e5
gh-128720: Fix doc inacurracy about __main__.__file__ existence in the REPL (#128721)
Fix doc inacurracy about __main__.__file__ existence in the REPL
2025-01-21 19:52:21 +00:00
Bénédikt Tran 6a0f915aae
gh-129064: Fix RST markup for the NEWS and What's New entries (#129131)
This amends the NEWS and What's New entries introduced in 0a6412f9cc.
2025-01-21 12:43:09 +01:00
Petr Viktorin d3b1bb228c
gh-128156: Guard use of `ffi_type_complex_double` on macOS system libffi (GH-128680)
* Determine ffi complex support at runtime
* Also, generate SIMPLE_TYPE_CHARS once at runtime
2025-01-21 10:59:18 +01:00
smelnikov da310d209a
Docs: fix typo in `Doc/howto/mro.rst` (GH-129095) 2025-01-21 10:22:13 +01:00
Adam Turner e65a1eb93a
Revert "doc: add social cards generation support in sphinxext-opengraph (#129085)" (#129106) 2025-01-20 23:53:33 +00:00
Adam Turner e54ac3b69e
GH-121970: Extract ``changes`` into a new extension (#129105) 2025-01-20 23:53:08 +00:00
Filipe Laíns 🇵🇸 e52ab564da
GH-92897: schedule the check_home deprecation to 3.15 (#129102) 2025-01-20 21:25:14 +00:00
Filipe Laíns 🇵🇸 382340d559
doc: add social cards generation support in sphinxext-opengraph (#129085) 2025-01-20 20:41:27 +00:00
Filipe Laíns 🇵🇸 da36bccdac
doc: fix venv creating for the local Python using uv (#129094) 2025-01-20 21:04:05 +02:00
Wulian 5d57959d7d
gh-91279: ZipFile.writestr now respect SOURCE_DATE_EPOCH (#124435) 2025-01-20 13:12:29 -05:00
Mark Shannon ab61d3f430
GH-128914: Remove conditional stack effects from `bytecodes.c` and the code generators (GH-128918) 2025-01-20 17:09:23 +00:00
Filipe Laíns 🇵🇸 0a6412f9cc
GH-129064: deprecate sysconfig.expand_makefile_vars (#129082) 2025-01-20 17:03:44 +00:00
Thomas Grainger 38a9956876
gh-128308: pass `**kwargs` to asyncio task_factory (#128768)
Co-authored-by: Kumar Aditya <kumaraditya@python.org>
2025-01-20 22:23:55 +05:30
Peter Bierma 6e02096e2f
gh-118915: C API: Document compiler flag macros (GH-129028) 2025-01-20 17:45:08 +01:00
Peter Bierma e792f4bc2e
Docs C API: Clarify what happens when null bytes are passed to `PyUnicode_AsUTF8` (#127458)
Co-authored-by: Stan U. <89152624+StanFromIreland@users.noreply.github.com>
Co-authored-by: Tomas R. <tomas.roun8@gmail.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
2025-01-20 16:54:29 +01:00
nikalinov e1fa2fcc7c
gh-129044: Update glossary entry for 'loader' to reflect current import system (#129073)
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2025-01-20 15:46:09 +00:00
Victor Stinner 573c181502
Add Configuration Options table to PyInitConfig API doc (#129062)
Document PyConfig members:

* dump_refs_file
* stdlib_dir
* use_frozen_modules
* _pystats
2025-01-20 15:46:45 +01:00
Victor Stinner a429159797
Reorganize the PyInitConfig documentation (#129047)
Document the new PyInitConfig API before the old PyConfig API.
2025-01-20 11:42:04 +01:00
Victor Stinner 07c3518ffb
gh-129033: Remove _Py_InitializeMain() function (#129034)
Co-authored-by: Alyssa Coghlan <ncoghlan@gmail.com>
2025-01-20 10:03:22 +00:00
Adam Turner 4967fa6a9c
GH-125722: Use long options for Sphinx (#129039) 2025-01-20 08:11:22 +02:00
Adam Turner d46b577ec0
GH-125722: Increase minimum supported Sphinx to 8.1.3 (#128922) 2025-01-20 00:26:24 +00:00
Tomas R. bca35f0e78
gh-129020: Remove ambiguous sentence from `tokenize.untokenize` docs (#129021) 2025-01-20 00:05:22 +00:00
Victor Stinner bbeb219354
Complete doc of pending C API removals in Python 3.15 (#129032) 2025-01-19 22:47:05 +01:00
Victor Stinner d57b2d83dd
gh-77782: Postpone Py_VerboseFlag removal to Python 3.15 (#129024)
Postpone the global configuration variables removal to Python 3.15.
Do the same for PySys_SetArgvEx(), PySys_SetArgv(),
Py_SetProgramName() and Py_SetPythonHome().
2025-01-19 20:51:17 +01:00
Rafael Fontenelle e8092e5cdc
gh-128998: Fix indentation of numbered list and literal block (#128999)
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2025-01-18 20:52:30 +00:00
Peter Bierma fba475ae6f
gh-121542: Document trailing newline behavior in `set_content()` (#121543)
Co-authored-by: Yizheng Meng <dev@rapidcow.org>
2025-01-18 20:34:40 +02:00
Bénédikt Tran f4afaa6f11
gh-125997: suggest efficient alternatives for `time.sleep(0)` (#128752) 2025-01-18 12:02:43 +01:00
Marie Roald d3adf02c90
gh-126349: Add 'fill', 'poly', and 'no_animation' context managers to turtle (#126350)
Co-authored-by: Marie Roald <roald.marie@gmail.com>
Co-authored-by: Yngve Mardal Moe <yngve.m.moe@gmail.com>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
Co-authored-by: Daniel Hollas <danekhollas@gmail.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
Co-authored-by: Erlend E. Aasland <erlend@python.org>
2025-01-18 11:27:22 +01:00
Daniel F Moisset 8174770d31
Fix definition of a `generator iterator` in `glossary.rst` (GH-128952)
Fix possible typo/grammar in glossary.rst

As discussed in https://discuss.python.org/t/typo-in-glossary-entry-for-generator-iterator/77163
2025-01-17 16:46:19 -08:00
Srinivas Reddy Thatiparthy (తాటిపర్తి శ్రీనివాస్ రెడ్డి) 313b96eb8b
gh-128017: Make a note that sys variables are read-only (#128887) 2025-01-16 11:17:03 +01:00
Tomas R. 256d6d2131
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.
2025-01-15 12:47:36 -08:00
Bénédikt Tran d906bde250
gh-67206: Document that `string.printable` is not printable in the POSIX sense (#128820) 2025-01-14 17:07:37 +01:00
Victor Stinner d786ac7f58
gh-59705: Document OS thread name change (#128800) 2025-01-14 16:31:13 +01:00
Victor Stinner 43ef9587ae
gh-106320: Document replacement for removed C API (#128787) 2025-01-14 16:29:21 +01:00
Rafael Fontenelle 1598e18a65
Fix a "doctest" block in `Doc/library/turtle.rst` (#128831) 2025-01-14 16:17:24 +01:00
Hugo van Kemenade 7fc0f86098 Merge branch 'main' of https://github.com/python/cpython 2025-01-14 17:12:21 +02:00
Bénédikt Tran bbd3300ae8
gh-118761: substitute `re` import in `base64.b16decode` for a more efficient alternative (#128736)
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
Co-authored-by: Chris Markiewicz <effigies@gmail.com>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2025-01-14 13:25:33 +00:00
Hugo van Kemenade f26daa9470 Python 3.14.0a4 2025-01-14 13:52:58 +02:00
Hugo van Kemenade 98301326e4
gh-123299: Copyedit "What's New in Python 3.14" (#128814) 2025-01-14 08:53:03 +00:00
Serhiy Storchaka 06cad77a5b
gh-71339: Add additional assertion methods for unittest (GH-128707)
Add the following methods:

* assertHasAttr() and assertNotHasAttr()
* assertIsSubclass() and assertNotIsSubclass()
* assertStartsWith() and assertNotStartsWith()
* assertEndsWith() and assertNotEndsWith()

Also improve error messages for assertIsInstance() and
assertNotIsInstance().
2025-01-14 10:02:38 +02:00
Victor Stinner 41f73501ec
gh-106320: Document private C APIs promoted to public C API (#128788) 2025-01-14 08:44:20 +01:00
Peter Bierma 8dfc743a1d
gh-128182: Add per-object memory access synchronization to `ctypes` (GH-128490) 2025-01-13 14:17:38 +01:00
Cheryl Sabella 5044c2245c
gh-67748: DOC:Add summary table for str methods in stdtypes.rst (GH-1709)
Co-authored-by: Ezio Melotti <ezio.melotti@gmail.com>
Co-authored-by: Oleg Iarygin <oleg@arhadthedev.net>
Co-authored-by: Carol Willing <carolcode@willingconsulting.com>
2025-01-13 14:14:59 +01:00
Bénédikt Tran 6ff8f82f92
gh-128150: Improve performances of `uuid.uuid*` constructor functions. (#128151)
We introduce a private constructor `UUID._from_int()` for RFC 4122/9562 UUIDs,
which takes the integral UUID value as input. The latter must have correctly set
its variant and version bits. We also make `UUID.__init__()` slightly more efficient.
2025-01-13 12:46:13 +01:00
Bénédikt Tran 29fe8072cf
gh-123345: improve `fnmatch` docs (#123346) 2025-01-13 11:21:22 +01:00
RUANG (James Roy) 553cdc6d68
gh-128696: Add arm64 to the get_platform return val description (#128701) 2025-01-11 01:03:12 +00:00
Adam Johnson 1b39b502d3
gh-128409: Document that pdb.post_mortem() accepts exceptions (#128410)
Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
2025-01-10 10:54:45 -05:00
dgpb 8af5781094
gh-128650: Fix incorrect statement in partial documentation (gh-128651) 2025-01-09 13:32:00 -06:00
Peter Bierma ea39c8b08d
gh-118915: Document `PyUnstable_InterpreterState_GetMainModule` (GH-128483) 2025-01-09 14:54:44 +01:00
Kumar Aditya 4322a318ea
gh-124433: fix docs for `asyncio.Queue.task_done` (#128669) 2025-01-09 17:50:12 +05:30
Kumar Aditya b2adf55674
gh-126137: improve docs for `loop.add_reader` and `loop.add_writer` (#128666) 2025-01-09 15:40:45 +05:30
Petr Viktorin 1439b81928
gh-128629: Add Py_PACK_VERSION and Py_PACK_FULL_VERSION (GH-128630) 2025-01-09 11:10:28 +01:00
Kumar Aditya 4685401845
gh-79149: document reentrant safety of `loop.call_soon_threadsafe` (#128662)
Co-authored-by: Thomas Grainger <tagrain@gmail.com>
2025-01-09 09:19:05 +00:00
Tomas R. a1284e9797
gh-97850: Remove the mention of removal from `ResourceReader` docs (#128602)
Remove the mention of removal from ResourceReader docs
2025-01-08 18:38:02 -05:00
Erlend E. Aasland cdfb8bc93a
gh-87506: Amend json.loads() post PR #127355 (#128609) 2025-01-08 09:36:44 +01:00
Srinivas Reddy Thatiparthy (తాటిపర్తి శ్రీనివాస్ రెడ్డి) 15372d0112
gh-87506: Document that json.load*() can raise UnicodeDecodeError (#127355)
Co-authored-by: Erlend Aasland <erlend@python.org>
2025-01-08 07:35:43 +00:00
Erlend E. Aasland a21e31ec54
Docs: mark up json.load() using parameter list (#128488) 2025-01-07 22:07:17 +01:00
Jun Komoda 145276a072
Add `.. availability:: Windows` directive to COM-related function prototype (GH-127436)
Add a directive to prototype that "returns a foreign function that will call a COM method"
2025-01-07 09:36:27 +01:00
Erlend E. Aasland b3cbd8f1b5
gh-108202: Document calendar.Calendar.firstweekday (#128566) 2025-01-07 08:59:24 +01:00