Commit Graph

124235 Commits

Author SHA1 Message Date
Taneli Hukkinen 9ce90206b7
gh-124835: `tomllib.loads`: Raise TypeError not AttributeError. Improve message (#124587) 2024-10-01 19:58:08 -07:00
Raymond Hettinger 120729d862
Minor code beautifications in statistics.py (gh-124866) 2024-10-01 15:55:36 -05:00
Serhiy Storchaka 04bfea2d26
gh-66436: Improved prog default value for argparse.ArgumentParser (GH-124799)
It can now have one of three forms:

* basename(argv0) -- for simple scripts
* python arv0 -- for directories, ZIP files, etc
* python -m module -- for imported modules

Co-authored-by: Alyssa Coghlan <ncoghlan@gmail.com>
2024-10-01 22:51:40 +03:00
Gregory P. Smith d150e4abcf
Highlight `datetime.timedelta.seconds` vs `.total_seconds()` in docs. (GH-124811)
Thanks to the reviewers for suggesting the use of a "caution" section instead of "warning" or "note".
2024-10-01 18:10:13 +00:00
Tian Gao 5e0abb4788
gh-116750: Add clear_tool_id function to unregister events and callbacks (#124568) 2024-10-01 13:32:55 -04:00
Sam Gross b482538523
gh-124218: Refactor per-thread reference counting (#124844)
Currently, we only use per-thread reference counting for heap type objects and
the naming reflects that. We will extend it to a few additional types in an
upcoming change to avoid scaling bottlenecks when creating nested functions.

Rename some of the files and functions in preparation for this change.
2024-10-01 17:05:42 +00:00
Sam Gross 5aa91c56bf
gh-124296: Remove private dictionary version tag (PEP 699) (#124472) 2024-10-01 12:39:56 -04:00
Serhiy Storchaka 60ff67d010
gh-124842: Fix test.support.import_helper.make_legacy_pyc() (GH-124843)
For source file "path/to/file.py" it created file with incorrect path
"/absolute/path/to/path/to/file.pyc" instead of "path/to/file.pyc".
2024-10-01 16:05:17 +00:00
Wulian da1e5526ae
gh-124487: Updated installer messages and internal docs regarding minimum Windows version (GH-124822) 2024-10-01 15:44:18 +01:00
Bartosz Sławecki 67e01a430f
gh-124594: Create and reuse the same context for the entire asyncio REPL session (#124595)
Co-authored-by: Andrew Svetlov <andrew.svetlov@gmail.com>
2024-10-01 14:17:22 +00:00
Victorien 3e3a4d2315
gh-118974: Add `decorator` argument to `make_dataclass` (gh-122723)
This is to allow the `dataclasses.make_dataclass` infrastructure to be used with another decorator that's compliant with `typing.dataclass_transform`. The new `decorator` argument to `dataclasses.make_dataclass` is `dataclasses.dataclass`, which used to be hard coded.
2024-10-01 09:51:51 -04:00
Adam Turner 91e64be731
Doc: Fix archive filenames for standard builds (#124826) 2024-10-01 10:43:55 +01:00
Adam Turner 4129a74a37
GH-109975: Copyedit 3.13 What's New: Link to installing free-threaded binaries on macOS (#124831) 2024-10-01 08:27:59 +00:00
Adam Turner 8823690264
GH-109975: Copyedit 3.13 What's New: Note delayed expected release date for Python 3.13.0 (GH-124827)
Note delayed expected release date of 3.13.0
2024-10-01 07:18:59 +00:00
Peter Bierma 133e929a79
gh-124309: Revert eager task factory fix to prevent breaking downstream (#124810)
* Revert "GH-124639: add back loop param to staggered_race (#124700)"

This reverts commit e0a41a5dd1.

* Revert "gh-124309: Modernize the `staggered_race` implementation to support eager task factories (#124390)"

This reverts commit de929f353c.
2024-09-30 18:37:27 -07:00
T. Wouters 7bdfabe2d1
gh-124785: Revert "gh-116510: Fix crash due to shared immortal interned strings (gh-124646)" (gh-124807)
Revert "gh-116510: Fix crash due to shared immortal interned strings. (gh-124646)"

This reverts commit 98b2ed7e23.
2024-09-30 16:41:46 -07:00
larryhastings 626d706a66
Minor edit for code clarification in annotationlib. (#124805) 2024-09-30 15:25:56 -07:00
Jeffrey R. Van Voorst 7e7223e18f
gh-116810: fix memory leak in ssl module (GH-123249)
Resolve a memory leak introduced in CPython 3.10's :mod:`ssl` when the :attr:`ssl.SSLSocket.session` property was accessed. Speeds up read and write access to said property by no longer unnecessarily cloning session objects via serialization.

Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
Co-authored-by: Gregory P. Smith <greg@krypto.org>
Co-authored-by: Antoine Pitrou <antoine@python.org>
2024-09-30 12:43:50 -07:00
Kirill Podoprigora 1c0bd8bd00
gh-115142: Skip some test cases in ``Lib/test/test_compile`` if ``_testinternalcapi`` is not available (#124474)
* Skip some test cases if "_testinternalcapi" is not available and if the test suite is
   running on another implementation than CPython.
2024-09-30 22:13:23 +03:00
Victor Stinner e44eebfc1e
gh-124613, regrtest: Detect JIT in build info (#124793) 2024-09-30 20:50:41 +02:00
Pablo Galindo Salgado 35541c410d
gh-124613: Don't run perf tests in JIT builds (#124792)
* gh-124613: Don't run perf tests in JIT builds

Signed-off-by: Pablo Galindo <pablogsal@gmail.com>

* Apply suggestions from code review

Co-authored-by: Victor Stinner <vstinner@python.org>

---------

Signed-off-by: Pablo Galindo <pablogsal@gmail.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
2024-09-30 17:57:00 +00:00
Steve Dower fac5e7aa17
gh-124487: Require at least Windows 10 SDK and update install check (GH-124672) 2024-09-30 18:50:46 +01:00
Dino Viehland 077e7ef6a0
gh-124642: Dictionaries aren't marking objects as weakref'd (#124643)
Dictionaries aren't marking objects as weakref'd
2024-09-30 10:04:32 -07:00
Adam Turner cce1125574
Doc: Run HTML and non-HTML daily builds separately (#124493) 2024-09-30 17:48:12 +01:00
sobolevn 6f4d64b048
gh-124722: Fix leak in `test_detach_materialized_dict_no_memory` (GH-124769) 2024-09-29 20:47:45 -05:00
Tian Gao b5774603a0
gh-124400: Use the normal command path for breakpoint commands (#124401)
Co-authored-by: Irit Katriel <1055913+iritkatriel@users.noreply.github.com>
2024-09-29 19:46:16 -04:00
Ned Deily 4b83c03ce9
gh-124720: Update "Using Python on a Mac" document (#124721)
Update "Using Python on a Mac" section of the "Python Setup and Usage"
document and include information on installing free-threading support.
2024-09-30 07:39:46 +08:00
Bénédikt Tran 6d0d26eb8c
gh-111495: Add tests for `PyCodec_*` C API (#123343) 2024-09-29 15:22:39 +00:00
Bénédikt Tran 4d8e7c40a0
gh-123961: Add a global state to _curses (#124729) 2024-09-29 15:17:20 +00:00
Bénédikt Tran 12417a984c
gh-123290: Fix decref in _curses update_lines_cols() (#124767) 2024-09-29 15:02:43 +00:00
Jelle Zijlstra 95581b3551
functools: Give up on lazy-importing types (#124736)
PR #121089 added an eager import for types.MethodType, but
still left the existing hacks for lazily importing from types.

We could also create MethodType internally in functools.py (e.g.,
by using `type(Placeholder.__repr__)`, but it feels not worth it at
this point, so instead I unlazified all the usages of types in the
module.
2024-09-29 06:31:06 -07:00
CBerJun 76fbee642e
Docs: improve generic `typing.NamedTuple` example (#124739) 2024-09-29 12:07:05 +01:00
Serhiy Storchaka 3f27153e07
gh-58573: Fix conflicts between abbreviated long options in the parent parser and subparsers in argparse (GH-124631)
Check for ambiguous options if the option is consumed, not when it is
parsed.
2024-09-29 12:01:03 +03:00
Serhiy Storchaka 95e92ef6c7
gh-116850: Fix argparse for namespaces with not directly writable dict (GH-124667)
It now always uses setattr() instead of setting the dict item to modify
the namespace. This allows to use a class as a namespace.
2024-09-29 11:01:10 +03:00
Serhiy Storchaka f1a2417b9e
gh-61181: Fix support of choices with string value in argparse (GH-124578)
Substrings of the specified string no longer considered valid values.
2024-09-29 10:57:21 +03:00
Serhiy Storchaka dac4ec5286
gh-53834: Fix support of arguments with choices in argparse (GH-124495)
Positional arguments with nargs equal to '?' or '*' no longer check
default against choices.
Optional arguments with nargs equal to '?' no longer check const
against choices.
2024-09-29 10:52:52 +03:00
Serhiy Storchaka 61180446ee
gh-124345: Support abbreviated single-dash long options with = in argparse (GH-124428) 2024-09-29 10:52:07 +03:00
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