Commit Graph

52905 Commits

Author SHA1 Message Date
Victor Stinner b7a95dfee3
gh-120593: Check -Wcast-qual flag in test_cext (#121081)
Check the usage of the 'const' qualifier in the Python C API in
test_cext.
2024-06-27 10:22:48 +00:00
Pradyun Gedam 4999e0bda0
gh-120888: Bump bundled pip to 24.1.1 (#120889)
Co-authored-by: Pradyun Gedam <pradyunsg@users.noreply.github.com>
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>
Co-authored-by: Alyssa Coghlan <ncoghlan@gmail.com>
Co-authored-by: T. Wouters <thomas@python.org>
2024-06-27 09:09:54 +00:00
Petr Viktorin 1167a9a30b
gh-119521: Remove _IncompleteInputError from the docs (GH-120993) 2024-06-27 09:09:22 +02:00
Janek Nouvertné 7d9c68513d
gh-120868: Fix breaking change in `logging.config` when using `QueueHandler` (GH-120872) 2024-06-27 08:09:01 +01:00
Ken Jin 22b0de2755
gh-117139: Convert the evaluation stack to stack refs (#118450)
This PR sets up tagged pointers for CPython.

The general idea is to create a separate struct _PyStackRef for everything on the evaluation stack to store the bits. This forces the C compiler to warn us if we try to cast things or pull things out of the struct directly.

Only for free threading: We tag the low bit if something is deferred - that means we skip incref and decref operations on it. This behavior may change in the future if Mark's plans to defer all objects in the interpreter loop pans out.

This implies a strict stack reference discipline is required. ALL incref and decref operations on stackrefs must use the stackref variants. It is unsafe to untag something then do normal incref/decref ops on it.

The new incref and decref variants are called dup and close. They mimic a "handle" API operating on these stackrefs.

Please read Include/internal/pycore_stackref.h for more information!

---------

Co-authored-by: Mark Shannon <9448417+markshannon@users.noreply.github.com>
2024-06-27 03:10:43 +08:00
Łukasz Langa d611c4c8e9
gh-118908: Use __main__ for the default PyREPL namespace (#121054) 2024-06-26 15:01:10 -04:00
Victor Stinner 44eafd6688
gh-121008: Fix idlelib.run tests (#121046)
When testing IDLE, don't create a Tk to avoid side effects such as
installing a PyOS_InputHook hook.
2024-06-26 15:41:16 +02:00
devdanzin 9e45fd9858
gh-121016: Add test for `PYTHON_BASIC_REPL` envioronment variable (#121017) 2024-06-26 10:39:07 +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
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
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
Victor Stinner 2e157851e3
gh-119182: Add PyUnicodeWriter_WriteUCS4() function (#120849) 2024-06-24 17:40:39 +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
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
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
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
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
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
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 9d2e1ea386
GH-120804: Remove `PidfdChildWatcher`, `ThreadedChildWatcher` and `AbstractChildWatcher` from asyncio APIs (#120893) 2024-06-23 18:38:50 +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
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
Serhiy Storchaka 974a978631
gh-120873: Add test for "state" option in ttk.Scale (GH-120874)
Also refactor the "state" option tests for other ttk widgets.
2024-06-22 11:18:04 +00:00
Serhiy Storchaka 6ad26de6e8
gh-104855: Update Tkinter tests for Tcl/Tk 8.7 and 9.0 (GH-120824)
The tests are now passed with the current version of Tcl/Tk under
development (8.7b1+ and 9.0b3+).

The following changes were also made to make the tests more flexible:

* Helper methods like checkParam() now interpret the expected error message
  as a regular expression instead of a literal.
* Add support of new arguments in checkEnumParam():
  - allow_empty=True skips testing with empty string;
  - fullname= specifies the name for error message if it differs from the
    option name;
  - sort=True sorts values for error message.
* Add support of the allow_empty argument in checkReliefParam():
  allow_empty=True adds an empty string to the list of accepted values.
* Attributes _clip_highlightthickness, _clip_pad and  _clip_borderwidth
  specify how negative values of options -highlightthickness, -padx, -pady
  and -borderwidth are handled.
* Use global variables for some common error messages.

Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
2024-06-22 09:53:24 +03:00
Victor Stinner 913a956d85
gh-119182: Rewrite PyUnicodeWriter tests in Python (#120845) 2024-06-21 20:15:06 +02:00
neonene a81d434c06
gh-120782: Update internal type cache when reloading datetime (#120829) 2024-06-21 22:39:33 +05:30
Petr Viktorin 6f1d448bc1
gh-113993: Allow interned strings to be mortal, and fix related issues (GH-120520)
* Add an InternalDocs file describing how interning should work and how to use it.

* Add internal functions to *explicitly* request what kind of interning is done:
  - `_PyUnicode_InternMortal`
  - `_PyUnicode_InternImmortal`
  - `_PyUnicode_InternStatic`

* Switch uses of `PyUnicode_InternInPlace` to those.

* Disallow using `_Py_SetImmortal` on strings directly.
  You should use `_PyUnicode_InternImmortal` instead:
  - Strings should be interned before immortalization, otherwise you're possibly
    interning a immortalizing copy.
  - `_Py_SetImmortal` doesn't handle the `SSTATE_INTERNED_MORTAL` to
    `SSTATE_INTERNED_IMMORTAL` update, and those flags can't be changed in
    backports, as they are now part of public API and version-specific ABI.

* Add private `_only_immortal` argument for `sys.getunicodeinternedsize`, used in refleak test machinery.

* Make sure the statically allocated string singletons are unique. This means these sets are now disjoint:
  - `_Py_ID`
  - `_Py_STR` (including the empty string)
  - one-character latin-1 singletons

  Now, when you intern a singleton, that exact singleton will be interned.

* Add a `_Py_LATIN1_CHR` macro, use it instead of `_Py_ID`/`_Py_STR` for one-character latin-1 singletons everywhere (including Clinic).

* Intern `_Py_STR` singletons at startup.

* For free-threaded builds, intern `_Py_LATIN1_CHR` singletons at startup.

* Beef up the tests. Cover internal details (marked with `@cpython_only`).

* Add lots of assertions

Co-Authored-By: Eric Snow <ericsnowcurrently@gmail.com>
2024-06-21 17:19:31 +02:00
Bénédikt Tran 7595e6743a
gh-120380: fix Python implementation of `pickle.Pickler` for `bytes` and `bytearray` objects in protocol version 5. (GH-120422) 2024-06-21 14:22:38 +02:00
Nikita Sobolev 8334a1b55c
gh-120384: Fix array-out-of-bounds crash in `list_ass_subscript` (#120442) 2024-06-21 13:48:38 +03:00
Kumar Aditya 733dac01b0
GH-120804: Remove SafeChildWatcher, FastChildWatcher and MultiLoopChildWatcher from asyncio (#120805)
Remove SafeChildWatcher, FastChildWatcher and MultiLoopChildWatcher from asyncio. These child watchers have been deprecated since Python 3.12. The tests are also removed and some more tests will be added after the rewrite of child watchers.
2024-06-21 10:23:10 +05:30
Jason R. Coombs 85d90b59e2
gh-120801: Refactor importlib.metadata fixtures. (#120803)
These changes released with importlib_metadata 7.2.0.
2024-06-20 19:00:39 +00:00
Tian Gao 31ce5c05a4
gh-120769: Add pdb meta command to print frame status. (#120770) 2024-06-20 10:38:07 -07:00
Jelle Zijlstra e8e151d471
gh-120780: Show attribute name for LOAD_SPECIAL in dis output (#120781) 2024-06-20 07:07:24 -07:00
Irit Katriel 55596ae044
gh-98442: fix locations of with statement's cleanup instructions (#120763)
gh-98442: fix location of with statement's cleanup instructions
2024-06-20 09:32:06 +01:00
Serhiy Storchaka 8bc76ae45f
gh-111259: Optimize complementary character sets in RE (GH-120742)
Patterns like "[\s\S]" or "\s|\S" which match any character are now compiled
to the same effective code as a dot with the DOTALL modifier ("(?s:.)").
2024-06-20 07:19:32 +00:00
Jelle Zijlstra 3846fcfb92
gh-119698: symtable: Fix merge race (#120779) 2024-06-20 05:42:30 +00:00
Bénédikt Tran b8a8e04fec
gh-119698: fix `symtable.Class.get_methods` and document its behaviour correctly (#120151)
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2024-06-19 20:49:30 -07:00
Tian Gao 4bbb0273f2
gh-120606: Allow EOF to exit pdb commands definition (#120607) 2024-06-19 15:50:26 -07:00
Nikita Sobolev 1e4815692f
gh-120732: Fix `name` passing to `Mock`, when using kwargs to `create_autospec` (#120737) 2024-06-19 21:35:11 +01:00
Mark Shannon d1c673b658
GH-120097: Make FrameLocalsProxy a mapping (#120101)
* Register FrameLocalsProxy as a subclass of collections.abc.Mapping

* Allow FrameLocalsProxy to matching mapping patterns
2024-06-19 17:54:13 +01:00
Mark Shannon 00257c746c
GH-119462: Enforce invariants of type versioning (GH-120731)
* Remove uses of Py_TPFLAGS_VALID_VERSION_TAG
2024-06-19 17:38:45 +01:00
Victor Stinner 0f3e36454d
gh-120635: Avoid leaking processes in test_pyrepl (#120676)
If the child process takes longer than SHORT_TIMEOUT seconds to
complete, kill the process but then wait until it completes with no
timeout to not leak child processes.
2024-06-19 15:14:29 +02:00
Jelle Zijlstra d8f27cb114
gh-120722: Set position on RETURN_VALUE in lambda (#120724) 2024-06-19 05:56:36 -07:00
Kirill Podoprigora b8fb369193
gh-102797: Add more code snippets in test_ast (#102798)
Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
Co-authored-by: Nineteendo <nineteendo19d0@gmail.com>
2024-06-19 09:51:43 +02:00
Wulian233 89f7208f67
gh-120633: Move scrollbar and remove tear-off menus in turtledemo (#120634)
Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
2024-06-19 02:20:54 -04:00