Commit Graph

122885 Commits

Author SHA1 Message Date
Victor Stinner 9e4a81f00f
gh-120642: Move private PyCode APIs to the internal C API (#120643)
* Move _Py_CODEUNIT and related functions to pycore_code.h.
* Move _Py_BackoffCounter to pycore_backoff.h.
* Move Include/cpython/optimizer.h content to pycore_optimizer.h.
* Remove Include/cpython/optimizer.h.
* Remove PyUnstable_Replace_Executor().

Rename functions:

* PyUnstable_GetExecutor() => _Py_GetExecutor()
* PyUnstable_GetOptimizer() => _Py_GetOptimizer()
* PyUnstable_SetOptimizer() => _Py_SetTier2Optimizer()
* PyUnstable_Optimizer_NewCounter() => _PyOptimizer_NewCounter()
* PyUnstable_Optimizer_NewUOpOptimizer() => _PyOptimizer_NewUOpOptimizer()
2024-06-26 13:54:03 +02:00
devdanzin 9e45fd9858
gh-121016: Add test for `PYTHON_BASIC_REPL` envioronment variable (#121017) 2024-06-26 10:39:07 +00:00
Nate Ohlson ef28f6df42
gh-121040: Remove fallthrough warnings compiler option (gh-121041)
Remove fallthrough warnings
2024-06-26 10:21:21 +00:00
Petr Viktorin 9056597224
gh-73991: Skip permission test if running as *nix superuser (GH-120994) 2024-06-26 11:36:09 +02:00
Bénédikt Tran d2646e3f45
gh-121025: Improve partialmethod.__repr__ (GH-121033)
It no longer contains redundant commas and spaces.
2024-06-26 12:08:27 +03:00
Nate Ohlson d8f82432a3
gh-121026: Include -Werror with new compiler flag checks to ensure compatibility (gh-121030) 2024-06-26 17:45:55 +09:00
blhsing 0654336dd5
gh-121018: Ensure ArgumentParser.parse_args with exit_on_error=False raises instead of exiting when given unrecognized arguments (GH-121019) 2024-06-26 10:41:51 +03:00
Kumar Aditya 82235449b8
gh-107803: fix thread safety issue in double linked list implementation (#121007) 2024-06-26 05:11:32 +00:00
Nate Ohlson 7fb32e0209
gh-112301: Enable compiler flags with low performance impact and no warnings (gh-120975) 2024-06-26 12:11:05 +09:00
Eric Snow a905721b9c
gh-120838: Add _PyThreadState_WHENCE_FINI (gh-121010)
We also add _PyThreadState_NewBound() and drop _PyThreadState_SetWhence().

This change only affects internal API.
2024-06-25 14:35:12 -06:00
Victor Stinner 769aea3329
gh-120155: Fix Coverity issue in parse_string() (#120997) 2024-06-25 17:53:24 +01:00
Alex Waygood 2d3187bf20
gh-114053: Fix another edge case involving `get_type_hints`, PEP 695 and PEP 563 (#120272) 2024-06-25 16:53:18 +01:00
Mark Shannon 8f5a01707f
GH-120982: Add stack check assertions to generated interpreter code (GH-120992) 2024-06-25 16:42:29 +01:00
Jelle Zijlstra 42b2c9d78d
gh-120108: Fix deepcopying of AST trees with .parent attributes (#120114) 2024-06-25 08:12:11 -07:00
Hugo van Kemenade ead676516d
Doc/README: Document 'make htmllive' (#120692)
Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
2024-06-25 12:08:55 +03:00
Raymond Hettinger 9b32b89074
Add fast path in count_elements (gh-120983) 2024-06-25 03:10:00 -05:00
Bénédikt Tran bb057ea107
gh-120661: improve example for basic type hints (#120934) 2024-06-25 07:59:56 +00:00
Michael Allwright 2106c9bef0
gh-120671: Fix PY_CHECK_CC_WARNING() in configure.ac (#120822)
Add missing space in AS_VAR_APPEND() on CFLAGS.
2024-06-25 09:48:48 +02:00
Savannah Ostrowski fd0f814ade
Add --with-lto back to Linux JIT CI (GH-120921) 2024-06-24 13:16:22 -07:00
Barney Gale e4a97a7fb1
GH-119054: Add "Permissions and ownership" section to pathlib docs. (#120505)
Add dedicated subsection for `pathlib.owner()`, `group()`, `chmod()` and
`lchmod()`.

Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2024-06-24 19:05:24 +00:00
Sam Gross 375b723d58
gh-120858: PyDict_Next should not lock the dict (#120859)
PyDict_Next no longer locks the dictionary in the free-threaded build. Locking
around individual PyDict_Next calls is not sufficient because the function
returns borrowed references and because it allows concurrent modifications
during the iteraiton loop.

The internal locking also interferes with correct external synchronization
because it may suspend outer critical sections created by the caller.
2024-06-24 14:15:15 -04:00
Sam Gross dee63cb359
gh-120860: Fix a few bugs in `type_setattro` error paths. (#120861)
Moves the logic to update the type's dictionary to its own function in order
to make the lock scoping more clear.

Also, ensure that `name` is decref'd on the error path.
2024-06-24 14:08:23 -04:00
Xie Yanbo 0153fd0940
Fix typos in comments (#120821) 2024-06-24 19:47:00 +02:00
Irit Katriel 8ac08f36fe
gh-120834: fix over-allocation in PyGenObject, PyCoroObject, PyAsyncGenObject. (#120941) 2024-06-24 18:41:53 +01:00
Lysandros Nikolaou 348184845a
gh-120956: Avoid comparison of int to Py_ssize_t in parser (#120959) 2024-06-24 18:13:02 +02:00
Steve Dower e731554337
Fixes loop variables to be the same types as their limit (GH-120958) 2024-06-24 17:11:47 +01:00
Victor Stinner 2e157851e3
gh-119182: Add PyUnicodeWriter_WriteUCS4() function (#120849) 2024-06-24 17:40:39 +02:00
Brandt Bucher a47abdb45d
GH-117062: Make _JUMP_TO_TOP a general absolute jump (GH-120854) 2024-06-24 08:35:10 -07:00
Petr Viktorin ce1064e4c9
gh-119521: Use `PyAPI_DATA`, not `extern`, for `_PyExc_IncompleteInputError` (GH-120955) 2024-06-24 17:30:29 +02:00
Serhiy Storchaka 6eb23b1311
gh-70278: Fix PyUnicode_FromFormat() with precision for %s and %V (GH-120365)
PyUnicode_FromFormat() no longer produces the ending \ufffd
character for truncated C string when use precision with %s and %V.
It now truncates the string before the start of truncated multibyte sequences.
2024-06-24 18:07:07 +03:00
Christian Clauss 22b8a35d6e
docs: puremagic.what() as replacement for imghdr.what() (#120871) 2024-06-24 15:32:13 +02:00
Itamar Oren b0e1c51882
gh-120373: Mark test_audit.test_http as requiring the network resource (#120374) 2024-06-24 07:18:46 -06:00
Pablo Galindo Salgado ac61d58db0
gh-119521: Rename IncompleteInputError to _IncompleteInputError and remove from public API/ABI (GH-119680)
Signed-off-by: Pablo Galindo <pablogsal@gmail.com>
Co-authored-by: Petr Viktorin <encukou@gmail.com>
2024-06-24 14:08:12 +02:00
Irit Katriel 65a12c559c
gh-120834: fix type of *_iframe field in _PyGenObject_HEAD declaration (#120835) 2024-06-24 10:23:38 +01:00
Serhiy Storchaka c38e2f64d0
gh-119614: Fix truncation of strings with embedded null characters in Tkinter (GH-120909)
Now the null character is always represented as \xc0\x80 for
Tcl_NewStringObj().
2024-06-24 12:17:25 +03:00
Alek Kowalczyk fc297b4ba4
gh-112169: Documented getaddrinfo/getnameinfo default loop executor usage and implications. (#112191)
Co-authored-by: Guido van Rossum <gvanrossum@gmail.com>
Co-authored-by: Kumar Aditya <kumaraditya@python.org>
Co-authored-by: Carol Willing <carolcode@willingconsulting.com>
2024-06-24 08:35:02 +00:00
Serhiy Storchaka 1500a23f33
gh-120683: Fix an error in logging.LogRecord timestamp (GH-120709)
The integer part of the timestamp can be rounded up, while the millisecond
calculation truncates, causing the log timestamp to be wrong by up to 999 ms
(affected roughly 1 in 8 million timestamps).
2024-06-24 09:50:39 +03:00
Serhiy Storchaka 02df679574
Use _PyLong_IsNegative instead of _PyLong_Sign if appropriate. (GH-120493)
It is faster and more obvious.
2024-06-24 09:49:01 +03:00
Barney Gale 35e998f560
GH-73991: Add `pathlib.Path.copytree()` (#120718)
Add `pathlib.Path.copytree()` method, which recursively copies one
directory to another.

This differs from `shutil.copytree()` in the following respects:

1. Our method has a *follow_symlinks* argument, whereas shutil's has a
   *symlinks* argument with an inverted meaning.
2. Our method lacks something like a *copy_function* argument. It always
   uses `Path.copy()` to copy files.
3. Our method lacks something like a *ignore_dangling_symlinks* argument.
   Instead, users can filter out danging symlinks with *ignore*, or
   ignore exceptions with *on_error*
4. Our *ignore* argument is a callable that accepts a single path object,
   whereas shutil's accepts a path and a list of child filenames.
5. We add an *on_error* argument, which is a callable that accepts
   an `OSError` instance. (`Path.walk()` also accepts such a callable).

Co-authored-by: Nice Zombies <nineteendo19d0@gmail.com>
2024-06-23 22:01:12 +01:00
Hugo van Kemenade bc37ac7b44
Docs makefile/RTD: Use uv if installed (#120711) 2024-06-23 13:23:27 -06:00
Jason R. Coombs 1ba0bb21ed
gh-120910: Fix issue resolving relative paths outside site-packages. (#120911)
Incorporates changes from importlib_metadata 7.2.1.
2024-06-23 13:06:07 -04:00
Nyakku Shigure 0b918e81c1
Typing docs: normalize some indents in code examples (#120912) 2024-06-23 16:15:12 +00:00
Serhiy Storchaka f4ddaa3967
gh-101830: Fix Tcl_Obj to string conversion (GH-120884)
Accessing the Tkinter object's string representation no longer converts
the underlying Tcl object to a string on Windows.
2024-06-23 16:34:14 +03:00
Kumar Aditya 18b6ca9660
GH-120804: add docs for removal for asyncio child watchers (#120895)
Co-authored-by: Alex Waygood <alex.waygood@gmail.com>
2024-06-23 13:14:12 +00:00
Kumar Aditya 9d2e1ea386
GH-120804: Remove `PidfdChildWatcher`, `ThreadedChildWatcher` and `AbstractChildWatcher` from asyncio APIs (#120893) 2024-06-23 18:38:50 +05:30
Nice Zombies b6fa8fe86a
gh-120896: Fix typo in version changed note of `urllib.parse.urlparse()` (#120898) 2024-06-23 18:00:23 +05:30
Kumar Aditya 96ead91f0f
GH-120804: Remove `get_child_watcher` and `set_child_watcher` from asyncio (#120818) 2024-06-23 09:53:23 +05:30
Kumar Aditya 4717aaa1a7
GH-107803: double linked list implementation for asyncio tasks (GH-107804)
* linked list

* add tail optmiization to linked list

* wip

* wip

* wip

* more fixes

* finally it works

* add tests

* remove weakreflist

* add some comments

* reduce code duplication in _asynciomodule.c

* address some review comments

* add invariants about the state of the linked list

* add better explanation

* clinic regen

* reorder branches for better branch prediction

* Update Modules/_asynciomodule.c

* Apply suggestions from code review

Co-authored-by: Itamar Oren <itamarost@gmail.com>

* fix capturing of eager tasks

* add comment to task finalization

* fix tests and couple c implmentation to c task

improved linked-list logic and more comments

* fix test

---------

Co-authored-by: Itamar Oren <itamarost@gmail.com>
2024-06-22 10:58:35 -07:00
Victor Stinner e213475495
gh-119182: Add checks to PyUnicodeWriter APIs (#120870) 2024-06-22 17:25:55 +02:00
Serhiy Storchaka a046c848c1
gh-120873: Add tests for new widget options in Tk 8.7 (GH-120877) 2024-06-22 16:19:42 +03:00