Commit Graph

123979 Commits

Author SHA1 Message Date
Rigel Di Scala 39c859f6ff
gh-122951: Simplify the grammar of the assignment rule (#124998) 2024-10-06 11:55:56 +02:00
Victor Stinner 16cd6cc86b
gh-111178: Fix function signatures in genobject.c (#124970)
* Add "CAST" macros.
* Rename parameters/variables "o" to "ag", "ags", "agw" or "agt"
  in some functions.
2024-10-05 09:56:44 +02:00
Donghee Na a5fc50994a
gh-112804: Clamping timeout value for _PySemaphore_PlatformWait (gh-124914)
* gh-112804: Clamping timeout value for _PySemaphore_PlatformWait

* Address code review

* nit
2024-10-05 11:27:32 +09:00
Tian Gao adfe7657a3
gh-124552 : Improve the accuracy of possible breakpoint check in bdb (#124553) 2024-10-04 21:32:57 -04:00
Adam Turner 2d8b6a4e9d
gh-119786: Replace a Sphinx role with a link to `Python/errors.c` (#124990) 2024-10-05 01:00:19 +01:00
morotti 6efd95c465
gh-117151: increase default buffer size of shutil.copyfileobj() to 256k. (GH-119783)
* gh-117151: increase default buffer size of shutil.copyfileobj() to 256k.

it was set to 16k in the 1990s.
it was raised to 64k in 2019. the discussion at the time mentioned another 5% improvement by raising to 128k and settled for a very conservative setting.

it's 2024 now, I think it should be revisited to match modern hardware. I am measuring 0-15% performance improvement when raising to 256k on various types of disk. there is no downside as far as I can tell.

this function is only intended for sequential copy of full files (or file like objects). it's the typical use case that benefits from larger operations.

for reference, I came across this function while trying to profile pip that is using it to copy files when installing python packages.

* add news

---------

Co-authored-by: rmorotti <romain.morotti@man.com>
2024-10-04 16:51:22 -07:00
Irit Katriel 8bcf118dcb
gh-119786: move a few more details on exception handling from devguide to InternalDocs (#124989) 2024-10-05 00:48:12 +01:00
Irit Katriel f474391b26
gh-124871: fix 'visited' tracking in compiler's reachability analysis (#124952) 2024-10-04 17:37:38 +01:00
isaacjones99 994051e086
gh-124962: Convert leftover rst to markup in `InternalDocs/compiler.md` (#124971)
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2024-10-04 19:53:02 +05:30
Nice Zombies bd393aedb8
Fix console prompt syntax in What's New in Python 3.8 (#124968) 2024-10-04 12:33:54 +01:00
Felix Fontein 480354dc23
gh-118658: Modify cert generation script to extract cert3.pem (GH-124598) 2024-10-04 13:15:08 +02:00
Victor Stinner ddccd546a0
gh-111178: Fix function signatures in _threadmodule.c (#124964) 2024-10-04 12:50:01 +02:00
Christian Clauss ac9648243d
gh-109975: Suggest ``pynntp`` instead of ``nntplib`` (#124830)
The ``nntplib`` library has been deleted from PyPI by its author.
2024-10-04 11:21:03 +01:00
Victor Stinner 2c2ad4f76f
gh-111178: Fix function signatures in classobject.c (#124943) 2024-10-04 12:00:00 +02:00
Victor Stinner aace0dca8b
gh-111178: Fix function signatures in bytearrayobject.c (#124940) 2024-10-04 11:59:51 +02:00
Victor Stinner 6c7d5c6415
gh-111178: Fix function signatures in Python-ast.c (#124942) 2024-10-04 11:59:08 +02:00
Bénédikt Tran f66d785861
gh-123961: Convert `curses.window` static type into a heap type (#124934) 2024-10-04 11:58:34 +02:00
Pablo Galindo Salgado 5e9e50612e
gh-124613: Deactivate perf support in tests if the jit is set (#124794)
gh-124613: Deactivate the JIT during perf tests

Signed-off-by: Pablo Galindo <pablogsal@gmail.com>
2024-10-04 02:00:32 +02:00
Adam Turner c8db0e817e
GH-109975: Copyedit 3.13 What's New: Remove references to the incremental GC (#124947) 2024-10-03 21:06:29 +01:00
Raymond Hettinger 7ecaf21946
Simplify partial() rough equivalent code (gh-124941) 2024-10-03 19:54:53 +00:00
efimov-mikhail 1f9025a4e7
gh-124889: Remove redundant artificial rules in PEG parser (#124893)
Cache in C PEG-generator reworked:
we save artificial rules in cache by Node string representation as a key instead of Node object itself.
As a result total count of artificial rules in parsers.c is lowered from 283 to 170.
More natural number ordering is used for the names of artificial rules.

Auxiliary method CCallMakerVisitor._generate_artificial_rule_call is added.
Its purpose is abstracting work with artificial rules cache.

Explicit using of "is_repeat1" kwarg is added to visit_Repeat0 and visit_Repeat1 methods.
Its slightly improve code readabitily.
2024-10-03 13:58:56 +01:00
Bénédikt Tran e6dd71da3a
gh-123961: Clean up curses C API/capsule (#124907) 2024-10-03 10:48:50 +00:00
Donghee Na 9eeb21bf76
gh-115145: Update documentation about ``PyThreadState_DeleteCurrent`` (gh-124920) 2024-10-03 19:34:47 +09:00
Tomas R 656b7a3c83
gh-121982: ``csv``: Add a test case for invalid ``quoting`` constant. (#121983)
Test invalid quoting constant

Co-authored-by: Kirill Podoprigora <kirill.bast9@mail.ru>
2024-10-03 11:14:57 +03:00
Thomas Grainger c066bf5535
gh-124858: fix happy eyeballs refcyles (#124859) 2024-10-02 16:32:31 -07:00
Brandt Bucher 6810928927
GH-118093: Don't lose confidence when tracing through 100% biased branches (GH-124813) 2024-10-02 19:24:37 +00:00
Diego Russo b85923a0fe
GH-119726: Deduplicate AArch64 trampolines within a trace (GH-123872) 2024-10-02 12:07:20 -07:00
Victor Stinner 7a178b7605
gh-111178: Fix function signatures in funcobject.c (#124908) 2024-10-02 19:29:56 +02:00
Ken Jin b84a763dca
gh-120619: Optimize through `_Py_FRAME_GENERAL` (GH-124518)
* Optimize through _Py_FRAME_GENERAL

* refactor
2024-10-03 01:10:51 +08:00
Jeremy Maitin-Shepard 8cc5aa47ee
gh-87135: Hang non-main threads that attempt to acquire the GIL during finalization (GH-105805)
Instead of surprise crashes and memory corruption, we now hang threads that attempt to re-enter the Python interpreter after Python runtime finalization has started. These are typically daemon threads (our long standing mis-feature) but could also be threads spawned by extension modules that then try to call into Python. This marks the `PyThread_exit_thread` public C API as deprecated as there is no plausible safe way to accomplish that on any supported platform in the face of things like C++ code with finalizers anywhere on a thread's stack. Doing this was the least bad option.

Co-authored-by: Gregory P. Smith <greg@krypto.org>
2024-10-02 09:17:49 -07:00
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