Commit Graph

123899 Commits

Author SHA1 Message Date
Victor Stinner 113b2d7583
gh-111178: Fix function signatures in longobject.c (#124895)
* Add _PyLong_CAST() macro.
* Move forward declarations to the top of longobject.c.
* Change long_add(), long_sub(), long_mul(), long_neg(),
  long_lshift(), long_abs() to take PyLongObject* and return
  PyLongObject*. Avoid CHECK_BINOP() test.
* Add long_add_method(), long_sub_method(), long_mul_method(),
  long_neg_method(), long_lshift_method(), and long_abs_method()
  which take PyObject* and return PyObject*. Implement CHECK_BINOP()
  test.
* Add long_lshift_int64() function.
* _PyLong_DivmodNear() calls long_lshift_int64(obj, 1) instead of
  long_lshift_obj(obj, one).
2024-10-02 17:41:19 +02:00
Victor Stinner 29951c8471
gh-111178: Fix function signatures in methodobject.c (#124902) 2024-10-02 17:24:10 +02:00
Victor Stinner 1ea6672a6f
gh-111178: Fix function signatures in weakrefobject.c (#124903) 2024-10-02 15:01:23 +00:00
Michał Górny 8d7d257f6b
gh-124213: Fix incorrect context manager use in in_systemd_nspawn_sync_suppressed() (#124892)
Fix the incorrect use of `os.open()` result as a context manager,
while it is actually a numeric file descriptor.

I have missed the problem, because in the original version the
`os.open()` call would always fail, and I failed to test the final
version in all possible scenarios properly.
2024-10-02 14:31:42 +00:00
Peter Bierma c2ba931318
gh-120378: Fix crash caused by integer overflow in `curses` (#124555)
This is actually an upstream problem in curses, and has been reported
to them already:
https://lists.gnu.org/archive/html/bug-ncurses/2024-09/msg00101.html

This is a nice workaround in the meantime to prevent the segfault.

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2024-10-02 14:31:23 +00:00
Victor Stinner 7bd9dbf8e1
gh-111178: Fix function signatures in moduleobject.c (#124900) 2024-10-02 14:31:04 +00:00
Victor Stinner 9132148edf
gh-111178: Fix function signatures in setobject.c (#124888) 2024-10-02 16:03:23 +02:00
Victor Stinner 1d4e3e0585
gh-111178: Fix locale_free() signature (#124896) 2024-10-02 13:58:47 +00:00
Serhiy Storchaka 2c050d4bc2
gh-85935: Improve tests for invalid arguments in test_argparse (GH-124891)
Check also specific error messages.
2024-10-02 16:28:05 +03:00
Victor Stinner 595a5631d9
gh-111178: Fix function signatures in tupleobject.c (#124804) 2024-10-02 13:37:04 +02:00
Victor Stinner 1d3700f943
gh-111178: Fix function signatures in bytesobject.c (#124806) 2024-10-02 13:35:51 +02:00
Mark Byrne 8fbf10d6cf
gh-122864: Fix a ``test_funcattrs.test___builtins__`` when executing directly (#124845)
Previously when executing ``test_functattrs.test___builtins__`` directly, it failed because the fact, that ``__builtins__`` is refers to the built-in module ``builtins`` while it's expects a ``__builtins__.__dict__``. But when this test is being run from another module, then ``__builtins__`` is refers to ``builtins.__dict__``. Now this part of the behaviour is covered.
---------

Co-authored-by: Victor Stinner <vstinner@python.org>
2024-10-02 12:58:39 +03:00
Savannah Ostrowski 6737333ac5
GH-124820: Move `-mno-outline-atomics` flag to aarch64 Linux JIT builds only (#124821) 2024-10-02 11:40:59 +02:00
Serhiy Storchaka 9b31a2d83f
gh-58282: Fix support of tuple metavar for positional arguments in argparse (GH-124782)
Previously, formatting help output or error message for positional argument
with a tuple metavar raised exception.

Co-authored-by: Cyker Way <cykerway@gmail.com>
2024-10-02 11:28:02 +03:00
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