Commit Graph

123848 Commits

Author SHA1 Message Date
Serhiy Storchaka 9bcadf589a
gh-80259: Fix conflict between type and default=SUPPRESS in argparse (GH-124519)
type() no longer called for SUPPRESS.

This only affects positional arguments with nargs='?'.
2024-09-29 10:47:06 +03:00
Serhiy Storchaka 49e105f948
gh-104860: Fix allow_abbrev=False for single-dash long options (GH-124340) 2024-09-29 10:44:34 +03:00
Serhiy Storchaka d08c788822
gh-123497: New limit for Python integers on 64-bit platforms (GH-123724)
Instead of be limited just by the size of addressable memory (2**63
bytes), Python integers are now also limited by the number of bits, so
the number of bit now always fit in a 64-bit integer.

Both limits are much larger than what might be available in practice,
so it doesn't affect users.

_PyLong_NumBits() and _PyLong_Frexp() are now always successful.
2024-09-29 10:40:20 +03:00
Kumar Aditya e0a41a5dd1
GH-124639: add back loop param to staggered_race (#124700) 2024-09-29 08:42:46 +05:30
Bénédikt Tran c00964ecd5
gh-124665: Add `_PyCodec_UnregisterError` and `_codecs._unregister_error` (#124677) 2024-09-29 02:25:23 +02:00
Kira 04c837d9d8
gh-124442: make `__static_attributes__` deterministic by sorting (#124492)
Signed-off-by: kp2pml30 <kp2pml30@gmail.com>
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2024-09-28 15:15:43 -07:00
Serhiy Storchaka 69a4063ca5
gh-123339: Fix cases of inconsistency of __module__ and __firstlineno__ in classes (GH-123613)
* Setting the __module__ attribute for a class now removes the
  __firstlineno__ item from the type's dict.
* The _collections_abc and _pydecimal modules now completely replace the
  collections.abc and decimal modules after importing them. This
  allows to get the source of classes and functions defined in these
  modules.
* inspect.findsource() now checks whether the first line number for a
  class is out of bound.
2024-09-28 20:51:49 +03:00
neonene dc12237ab0
gh-124688: _decimal: Get module state from ctx for performance (#124691)
Get a module state from ctx objects for performance.
2024-09-28 16:12:53 +00:00
Jelle Zijlstra c976d789a9
docs: improve venv docs (#124540)
- Move "versionchanged" notes that apply to the whole class to the
  end of the class docs
- Remove or move notes next to the method list that apply to individual
  methods.
- Mark up parameters using the appropriate syntax
- Do not capitalize "boolean"
- Shorten some text
2024-09-28 05:50:09 -07:00
Jean-François B. fae5058ec1
Doc: Fix default ``latex_elements['papersize']`` (#124525)
https://www.sphinx-doc.org/en/master/latex.html#the-latex-elements-configuration-setting

It should be 'letterpaper' or 'a4paper' not 'letter' or 'a4'
(not to be confused with PAPER env variable).
2024-09-28 11:30:28 +01:00
Raymond Hettinger 165ed68c26
Sorting techniques edits (#124701) 2024-09-27 17:19:44 -07:00
Pablo Galindo Salgado 02b49c5150
gh-107954: Fix configuration type for the perf profiler (#124636) 2024-09-28 01:50:16 +02:00
Petr Viktorin 425587a110
gh-124385: Document and soft-deprecate PyLong_AS_LONG (GH-124386) 2024-09-27 23:40:50 +00:00
Jelle Zijlstra 1ba35ea385
gh-123299: Copy-edit the 3.14 What's New (#124670)
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2024-09-28 01:25:33 +03:00
Bénédikt Tran 702c4a2473
gh-111178: fix some USAN failures - mismatched function pointers (GH-123004) 2024-09-27 23:51:50 +02:00
Mark Shannon 0e21cc6cf8
GH-124547: Clear instance dictionary if memory error occurs during object dealloc (GH-124627) 2024-09-27 14:51:01 -07:00
Matt Delengowski 2357d5ba48
gh-90190: Add doc for using `singledispatch` with precise collection type hints (#116544) 2024-09-27 21:10:29 +00:00
Emily Morehouse 626668912f
gh-81263: Add assignment expressions to `help` (#124641)
* Add assignment expression (:=) to `help`

* Update index for Assignment Expressions to include pair of `assignment; expression`
2024-09-27 13:59:26 -07:00
Mariatta 6cba6e1df2
gh-124457: Remove coverity from CPython repo (GH-124460)
Remove coverity from CPython repo.
2024-09-27 13:42:32 -07:00
Petr Viktorin 3387f76b8f
gh-124520: What's New entry for ctypes metaclass __new__/__init__ change (GH-124546) 2024-09-27 22:13:53 +02:00
Victor Stinner d8cf587dc7
doc: PyUnicode_AsUTF8String() fails if string contains surrogates (#124605) 2024-09-27 20:13:29 +00:00
Raymond Hettinger 34158c2c7a
Drop code ownership for decimal (gh-124695) 2024-09-27 19:33:16 +00:00
Petr Viktorin 81a253b929
Fix typo in InternalDocs/string_interning.md (GH-124699) 2024-09-27 19:31:59 +00:00
Tony Roberts 0881e2d3b1
gh-124609: Fix _Py_ThreadId for Windows builds using MinGW (#124663) 2024-09-27 18:52:23 +00:00
Raymond Hettinger 2e155536ca
Itertool docs: Minor clarifications, wording tweaks, spacing, and active voice. (gh-124690)
Minor clarifications, wording tweaks, spacing, and active voice.
2024-09-27 18:43:46 +00:00
Russell Keith-Magee 10d504aecc
gh-124682: Disable test that is prone to intermittent failure on iOS. (#124683)
Disable test that is prone to intermittent failure on iOS.
2024-09-27 10:49:35 -07:00
Petr Viktorin e349f73a5a
gh-121277: Raise nice error on `next` as second argument to deprecated-removed (GH-124623) 2024-09-27 19:38:40 +02:00
Alex Waygood 6716dd1c33
Fixup indentation for docs on `ModuleSpec` attributes (#124681)
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2024-09-27 17:35:09 +00:00
Raymond Hettinger 4b89c5ebfc
Improve accuracy of kde() invcdf estimates (gh-124637) 2024-09-27 09:56:37 -07:00
Brandt Bucher 26a74203f0
GH-118093: Fix off-by-one errors in tier-up thresholds (GH-124447) 2024-09-27 09:38:04 -07:00
sobolevn 9c7657f099
gh-113878: Add `doc` parameter to `dataclasses.field` (gh-114051)
If using `slots=True`, the `doc` parameter ends up in the `__slots__` dict. The `doc` parameter is also in the corresponding `Field` object.
2024-09-27 12:20:49 -04:00
Malcolm Smith 0a3577bdfc
gh-123017: Add Android to the list of platforms where `strftime` doesn't support negative years (#124467)
Add Android to the list of platforms where `strftime` doesn't support negative years
2024-09-27 10:35:18 -04:00
Jelle Zijlstra 365dffbaad
gh-119180: No longer set `__annotations__` in `__main__` (#124634) 2024-09-27 05:49:43 -07:00
Max Bachmann b79a21ea42
GH-95079: document error behaviour for some unicode C APIs (#95080) 2024-09-27 12:35:55 +02:00
Ned Batchelder 5329d1b74a
Docs: for for/else clarify that return or raise also skip the else (#124591)
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2024-09-27 06:17:25 -04:00
sobolevn 3a0e7f5762
gh-124176: Add special support for dataclasses to `create_autospec` (#124429) 2024-09-27 09:48:31 +03:00
Erlend E. Aasland 08e1bbe4a3
gh-86673: Harden `test_ttk.test_element_create_image` (#123335)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2024-09-27 08:21:15 +02:00
Jelle Zijlstra 25189188bf
generate_global_objects.py: Fix name of macro in error message (#124464)
_PyID does not exist but _Py_ID does.
2024-09-26 21:37:21 -07:00
Neil Schemenauer 6f9525dd3f
gh-116510: Fix crash during sub-interpreter shutdown (gh-124645)
Fix a bug that can cause a crash when sub-interpreters use "basic"
single-phase extension modules.  Shared objects could refer to PyGC_Head
nodes that had been freed as part of interpreter shutdown.
2024-09-26 19:33:07 -07:00
Neil Schemenauer 98b2ed7e23
gh-116510: Fix crash due to shared immortal interned strings. (gh-124646) 2024-09-26 19:16:51 -07:00
Savannah Ostrowski 65f1237098
GH-123516: Improve JIT memory consumption by invalidating cold executors (GH-124443)
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2024-09-27 00:35:42 +00:00
Hugo van Kemenade 23e812b84a
Docs: Update and proofread `library/venv.rst` (#124121)
Co-authored-by: C.A.M. Gerlach <CAM.Gerlach@Gerlach.CAM>
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2024-09-27 02:57:38 +03:00
Gregory P. Smith b65f2cdfa7
gh-84559: Change the multiprocessing start method default to `forkserver` (GH-101556)
Change the default multiprocessing start method away from fork to forkserver or spawn on the remaining platforms where it was fork.  See the issue for context.  This makes the default far more thread safe (other than for people spawning threads at import time... - don't do that!).

Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2024-09-26 16:57:19 -07:00
Dino Viehland 83e5dc0f4d
gh-124628: Pyrepl inputs on Windows shouldn't always be blocking reads (#124629) 2024-09-27 00:10:36 +02:00
Brett Cannon 66cc6d4c50
Remove some unused files related to WASM/WASI (GH-124635) 2024-09-26 21:23:41 +00:00
Bénédikt Tran 5e7eba09bc
gh-89683: add tests for `deepcopy` on frozen dataclasses (gh-123098)
Co-authored-by: Eric V. Smith <ericvsmith@users.noreply.github.com>
2024-09-26 21:15:28 +00:00
Jelle Zijlstra 2c10832887
gh-119180: Rename SOURCE format to STRING (#124620) 2024-09-26 13:49:48 -07:00
Donghee Na a4d1fdfb15
gh-124612: Good bye dockerfile and use GHCR package (gh-124626) 2024-09-26 12:58:15 -07:00
Matthew Rahtz 7d3497f617
gh-115528: Update language reference for PEP 646 (#121181)
To recap: the objective is to make starred expressions valid in `subscription`,
which is used for generics: `Generic[...]`, `list[...]`, etc.

What _is_ gramatically valid in such contexts? Seemingly any of the following.
(At least, none of the following throw `SyntaxError` in a 3.12.3 REPL.)

    Generic[x]
    Generic[*x]
    Generic[*x, y]
    Generic[y, *x]
    Generic[x := 1]
    Generic[x := 1, y := 2]

So introducting

    flexible_expression: expression | assignment_expression | starred_item

end then switching `subscription` to use `flexible_expression` sorts that.

But then we need to field `yield` - for which any of the following are
apparently valid:

    yield x
    yield x,
    yield x, y
    yield *x,
    yield *x, *y

Introducing a separate `yield_list` is the simplest way I've been figure out to
do this - separating out the special case of `starred_item ,`.



Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2024-09-26 12:35:17 -07:00
Jelle Zijlstra 43979fad90
Programming FAQ: Mention object.__setattr__ as a technique for delegation (#124617)
This is used for example by threading.local in the stdlib.
2024-09-26 11:50:31 -07:00