Commit graph

128044 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
Petr Viktorin
639df39bf0
gh-131146: Fall back to month_name if standalone_month_names aren't distinct (GH-137674)
Some systems reportedly don't expand '%OB' and '%Ob'.
In this case (and similar theoretically possible ones, like expanding to empty
string or 'OB'), fall back to the month_name & month_abbr.
2025-08-13 07:03:05 +00:00
Adam Turner
797c2c33e1
GH-137630: Argument Clinic: Reduce use of 'as' for renaming in `_interpretersmodule.c` (#137680) 2025-08-12 23:28:38 +01:00
sobolevn
e93dca7223
gh-133403: Run mypy on Tools/build/mypy.ini changes (#137692) 2025-08-12 22:01:50 +00:00
Adam Turner
6baf552484
GH-137623: Begin enforcing docstring length in Argument Clinic (#137624) 2025-08-12 20:17:35 +00: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
Sergey Miryanov
654b8d9364
GH-137562: Fix github-issue number for deallocated objects in cache bug (GH-137614) 2025-08-12 10:32:53 -07:00
Malcolm Smith
f660ec3753
gh-137242: Add Android CI job (#137186)
Co-authored-by: Russell Keith-Magee <russell@keith-magee.com>
Co-authored-by: 🇺🇦 Sviatoslav Sydorenko (Святослав Сидоренко) <wk.cvs.github@sydorenko.org.ua>
2025-08-12 20:16:04 +03:00
Adam Turner
be56464c4b
GH-137630: Convert `_interpreters` to use Argument Clinic (#137631) 2025-08-12 16:23:13 +01:00
sobolevn
68a61b0f1d
gh-133403: Check generate_stdlib_module_names and check_extension_modules with mypy (#137546) 2025-08-12 18:11:18 +03:00
Hugo van Kemenade
715647a99a
gh-137288: Update 3.14 magic numbers (GH-137665) 2025-08-12 13:52:09 +02:00
Jelle Zijlstra
6859b95cff
gh-135228: When @dataclass(slots=True) replaces a dataclass, make the original class collectible (take 2) (GH-137047)
Remove the `__dict__` and `__weakref__` descriptors from the original class when creating a dataclass from it.

An interesting hack, but more localized in scope than gh-135230.

This may be a breaking change if people intentionally keep the original class around
when using `@dataclass(slots=True)`, and then use `__dict__` or `__weakref__` on the
original class.


Co-authored-by: Alyssa Coghlan <ncoghlan@gmail.com>
Co-authored-by: Petr Viktorin <encukou@gmail.com>
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2025-08-12 13:16:54 +02:00
Serhiy Storchaka
027cacb67c
gh-126008: Improve docstrings for Tkinter cget and configure methods (GH-133303)
* Explain the behavior of Widget.configure() depending on arguments.
* Unify descriptions.
* Replace "resource" with "option".
2025-08-12 07:55:01 +03: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
Sam Gross
362692852f
gh-137400: Fix a crash when disabling profiling across all threads (gh-137471)
The `PyEval_SetProfileAllThreads` function and other related functions
had a race condition on `tstate->c_profilefunc` that could lead to a
crash when disable profiling or tracing on all threads while another
thread is starting to profile or trace a a call.

There are still potential crashes when threads exit concurrently with
profiling or tracing be enabled/disabled across all threads.
2025-08-11 11:41:44 -04:00
AN Long
deb0020e3d
gh-115766: Fix IPv4Interface.is_unspecified (GH-137326) 2025-08-11 15:04:47 +02:00
Sergey B Kirpichev
bc4996c125
gh-128813: cleanup C-API docs for PyComplexObject (GH-137579)
* move non-deprecated API up
* make a dedicated section for deprecated low-leved API
2025-08-11 13:51:39 +02:00
László Kiss Kollár
4497ad409e
gh-135953: Profile a module or script with sampling profiler (#136777) 2025-08-11 12:36:43 +01:00
da-woods
70218b4008
Fix documentation of hash in PyHash_FuncDef (#137595)
Because of a small typo, it wasn't showing up in the generated docs.
2025-08-11 13:18:37 +02:00
Serhiy Storchaka
1bde13b0e9
Add test for opening an SQLite with bytes path (GH-136331) 2025-08-11 09:16:54 +03:00
Malcolm Smith
b36d23f58e
Update pre-commit hooks (#137591)
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2025-08-10 22:32:50 +00:00
Peter Bierma
55788a9096
gh-137583: Only lock the SSL context, not the SSL socket (GH-137588)
Fixes a deadlock in 3.13.6.
2025-08-10 14:47:11 +00: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
Mark Shannon
af15e1d13e
GH-132532: Add new DSL macros to better declare semantics of exits at ends of instructions/uops. (GH-137098) 2025-08-09 15:41:28 +01:00
Sergey Miryanov
c744b57fd6
gh-137562: Remove reference for GC_REACHABLE in comment (GH-137563)
GC_REACHABLE is obsolete
2025-08-09 21:32:45 +09: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
Nick Burns
d7dbde8958
gh-92936: allow double quote in cookie values (#113663)
* allow double quote in cookie values
* Update Lib/test/test_http_cookies.py

Co-authored-by: Senthil Kumaran <senthil@python.org>
2025-08-08 12:07:15 -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
Sergey B Kirpichev
9743d069bd
gh-128813: deprecate cval field of the PyComplexObject struct (#137271)
Co-authored-by: Petr Viktorin <encukou@gmail.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
2025-08-08 10:36:42 +00:00
sobolevn
fb1cb00030
Bump mypy to 1.17.1 (#137542) 2025-08-08 10:14:51 +03: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
Adam Turner
b4a1974aa2
GH-136155: Fail the EPUB check on fatal errors (#137351) 2025-08-08 02:32:20 +01:00
Sergey Miryanov
25518f51dc
GH-135552: Add tests to check weakref clearing (GH-136304)
These are tests to ensure behaviour introduced by GH-136189 is working as expected.

Co-authored-by: Mikhail Borisov <43937008+fxeqxmulfx@users.noreply.github.com>
Co-authored-by: Kumar Aditya <kumaraditya@python.org>
Co-authored-by: Neil Schemenauer <nas-github@arctrix.com>
2025-08-07 17:45:33 -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
Neil Schemenauer
350c58ba4e
GH-135552: Make the GC clear weakrefs later (GH-136189)
Fix a bug caused by the garbage collector clearing weakrefs too early.  The
weakrefs in the ``tp_subclasses`` dictionary are needed in order to correctly
invalidate type caches (for example, by calling ``PyType_Modified()``).
Clearing weakrefs before calling finalizers causes the caches to not be
correctly invalidated.  That can cause crashes since the caches can refer to
invalid objects.  Defer the clearing of weakrefs without callbacks until after
finalizers are executed.
2025-08-07 16:32:17 -07:00
Bénédikt Tran
deb385a143
gh-137412: fix default_builtin_hashes values in test_hashlib.py (#137413)
fix `default_builtin_hashes` in test_hashlib
2025-08-07 15:31:56 -07:00
Dino Viehland
375f484f97
gh-137291: Support perf profiler with an evaluation hook (#137292)
Support perf profiler with an evaluation hook
2025-08-07 14:54:12 -07:00
Abhinav Upadhyay
e3ad9003c5
GH-119085: Move comment in Python/gc.c to correct place.
In GH-116206, the comment about moving reachable objects to next generation
got moved from its original place to a place where there is no code below
it. Put the comment back to where the actual movement of reachable objects
happens.
2025-08-07 20:31:11 +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
Ee Durbin
d0f4e76de0
add floss.fund manifest provenance (#137529)
ref: https://fundingjson.org/#wellknown
2025-08-07 15:35:39 -04:00
maurycy
db8742e2b4
Remove redundant assignment in asyncio.streams.StreamReaderProtocol.connection_lost() (GH-137524)
The _stream_writer attribute was removed in a355f60 (gh-114914).
2025-08-07 18:38:14 +03:00
Peter Bierma
082f370cdd
gh-137514: Add a free-threading wrapper for mutexes (GH-137515)
Add `FT_MUTEX_LOCK`/`FT_MUTEX_UNLOCK`, which call `PyMutex_Lock` and `PyMutex_Unlock` on the free-threaded build, and no-op otherwise.
2025-08-07 11:24:50 -04:00
Nice Zombies
dec624e0af
gh-135336: Add fast path to json string encoding (#133239)
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
2025-08-07 15:21:56 +00:00
Bartosz Sławecki
7ab68cd506
gh-137440: Update comment in Python/hamt.c on importing for testing (GH-137441)
Switch from `_testcapi` to `_testinternalcapi`.
2025-08-07 09:50:49 -04:00
Serhiy Storchaka
baefaa6cba
gh-137044: Support large limit values in getrlimit() and setrlimit() (GH-137338)
* Return large limit values as positive integers instead of negative integers
  in resource.getrlimit().
* Accept large values and reject negative values (except RLIM_INFINITY)
  for limits in resource.setrlimit().
2025-08-07 11:06:37 +03:00
Guilherme Leobas
5be872350d
gh-137463: Update validate_abstract_methods in test_collections.py (#137464)
Update `validate_abstract_methods` in `test_collections.py`

The test for missing abstract methods in `validate_abstract_methods` incorrectly attempted to instantiate the generated class `C` with an argument (`C(name)`), which always raises a `TypeError: C() takes no arguments`. Although the test originally passes, it passes for the wrong reason.

This change makes the test correctly validate the enforcement of abstract methods in ABCs.
2025-08-07 09:10:56 +03:00
tobiasjcat
3c1471d971
gh-137499: Fixed dead link to NIST website (#137500) 2025-08-07 08:41:16 +03:00