Commit Graph

30828 Commits

Author SHA1 Message Date
Serhiy Storchaka b2923a61a1
gh-79325: Fix recursion error in TemporaryDirectory cleanup on Windows (GH-112762) 2023-12-07 17:21:36 +00:00
Søren Løvborg 81c16cd94e
gh-91133: tempfile.TemporaryDirectory: fix symlink bug in cleanup (GH-99930)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2023-12-07 18:04:06 +02:00
Łukasz Langa 9f67042f28
gh-110190: Temporarily skip new test introduced in gh-112604 on PPC64LE (#112818) 2023-12-07 14:29:15 +01:00
andrewluotechnologies 9c3458e058
gh-112125: Fix None.__ne__(None) returning NotImplemented instead of False (#112504) 2023-12-07 13:56:01 +01:00
Tian Gao 3d712a9f4c
gh-102980: Redirect output of pdb's `interact` command, add tests and improve docs (#111194) 2023-12-07 11:19:33 +00:00
Kushal Das 4ba15de191
gh-74616: Raise ValueError in case of null character in input prompt (GH-1738)
If the input prompt to the builtin input function on terminal has any null
character, then raise ValueError instead of silently truncating it.

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2023-12-07 10:22:52 +00:00
Ronald Oussoren 953ee622b3
gh-109981: Fix support.fd_count() on macOS 14 (#112797)
Use scanning "/dev/fd/" on macOS in support.fd_count(). That's both more efficient than scanning all possible file descriptors, and avoids crashing the interpreter when there are open "guarded" file descriptors.

"Guarded" file descriptors are a macOS feature where file descriptors used by system libraries are marked and cause hard crashes when used by "user" code.

Co-authored-by: Victor Stinner <vstinner@python.org>
2023-12-07 10:30:15 +01:00
Pablo Galindo Salgado 16448cab44
gh-112730: Use color to highlight error locations (gh-112732)
Signed-off-by: Pablo Galindo <pablogsal@gmail.com>
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2023-12-06 23:29:54 +01:00
Serhiy Storchaka cc7e45cc57
gh-75666: Tkinter: "unbind(sequence, funcid)" now only unbinds "funcid" (GH-111322)
Previously, "widget.unbind(sequence, funcid)" destroyed the current binding
for "sequence", leaving "sequence" unbound, and deleted the "funcid"
command.

Now it removes only "funcid" from the binding for "sequence", keeping
other commands, and deletes the "funcid" command.
It leaves "sequence" unbound only if "funcid" was the last bound command.

Co-authored-by: GiovanniL <13402461+GiovaLomba@users.noreply.github.com>
2023-12-06 16:42:15 +02:00
Victor Stinner 828451dfde
gh-111545: Add Py_HashPointer() function (#112096)
* Implement _Py_HashPointerRaw() as a static inline function.
* Add Py_HashPointer() tests to test_capi.test_hash.
* Keep _Py_HashPointer() function as an alias to Py_HashPointer().
2023-12-06 15:09:22 +01:00
Victor Stinner f8852634ed
gh-108223: Refer to PEP 703 as Free Threading (#112780) 2023-12-06 12:55:58 +01:00
Miro Hrončok d384813ff1
gh-112769: test_zlib: Fix comparison of ZLIB_RUNTIME_VERSION with non-int suffix (GH-112771)
zlib-ng defines the version as "1.3.0.zlib-ng".
2023-12-05 21:39:28 +02:00
Zackery Spytz 11d88a178b
bpo-35332: Handle os.close() errors in shutil.rmtree() (GH-23766)
* Ignore os.close() errors when ignore_errors is True.
* Pass os.close() errors to the error handler if specified.
* os.close no longer retried after error.

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2023-12-05 19:09:39 +02:00
Ethan Furman de6bca9564
gh-112328: [Enum] Make some private attributes public. (GH-112514)
* [Enum] Make some private attributes public.

- ``_EnumDict`` --> ``EnumDict``
- ``EnumDict._member_names`` --> ``EnumDict.member_names``
- ``Enum._add_alias_``
- ``Enum._add_value_alias_``

---------

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
2023-12-05 08:27:36 -08:00
Serhiy Storchaka 563ccded6e
gh-94692: Only catch OSError in shutil.rmtree() (#112756)
Previously a symlink attack resistant version of shutil.rmtree() could ignore
or pass to the error handler arbitrary exception when invalid arguments
were provided.
2023-12-05 16:40:49 +01:00
Diego Russo bc68f4a4ab
gh-110190: Fix ctypes structs with array on Arm (#112604)
Set MAX_STRUCT_SIZE to 32 in stgdict.c when on Arm platforms.
This because on Arm platforms structs with at most 4 elements of any
floating point type values can be passed through registers. If the type
is double the maximum size of the struct is 32 bytes.
On x86-64 Linux, it's maximum 16 bytes hence we need to differentiate.
2023-12-05 16:07:50 +01:00
Ken Jin 8cdfee1bb9
bpo-43153: Don't mask `PermissionError` with `NotADirectoryError` during tempdirectory cleanup (GH-29940)
Co-authored-by: andrei kulakov <andrei.avk@gmail.com>
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2023-12-05 15:30:59 +02:00
Jeffrey Kintscher 268415bbb3
gh-81441: shutil.rmtree() FileNotFoundError race condition (GH-14064)
Ignore missing files and directories while enumerating
directory entries in shutil.rmtree().

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2023-12-05 09:33:51 +00:00
pan324 81ee026091
gh-82300: Add track parameter to multiprocessing.shared_memory (#110778)
Add a track parameter to shared memory to allow resource tracking via the side-launched resource tracker process to be disabled on platforms that use it (POSIX).

This allows people who do not want automated cleanup at process exit because they are using the shared memory with processes not participating in Python's resource tracking to use the shared_memory API.

Co-authored-by: Łukasz Langa <lukasz@langa.pl>
Co-authored-by: Guido van Rossum <gvanrossum@gmail.com>
Co-authored-by: Antoine Pitrou <pitrou@free.fr>
Co-authored-by: Gregory P. Smith <greg@krypto.org>
2023-12-05 00:11:44 -08:00
Constantin Hong aa5bee30ab
gh-102130: Support tab completion in cmd for Libedit. (GH-107748)
---

Co-authored-by: Tian Gao <gaogaotiantian@hotmail.com>
2023-12-05 08:24:56 +01:00
Gregory P. Smith 9fe7655c6c
gh-112334: Restore subprocess's use of `vfork()` & fix `extra_groups=[]` behavior (#112617)
Restore `subprocess`'s intended use of `vfork()` by default for performance on Linux;
also fixes the behavior of `extra_groups=[]` which was unintentionally broken in 3.12.0:

Fixed a performance regression in 3.12's :mod:`subprocess` on Linux where it
would no longer use the fast-path ``vfork()`` system call when it could have
due to a logic bug, instead falling back to the safe but slower ``fork()``.

Also fixed a security bug introduced in 3.12.0.  If a value of ``extra_groups=[]``
was passed to :mod:`subprocess.Popen` or related APIs, the underlying
``setgroups(0, NULL)`` system call to clear the groups list would not be made
in the child process prior to ``exec()``.

The security issue was identified via code inspection in the process of
fixing the first bug.  Thanks to @vain for the detailed report and
analysis in the initial bug on Github.

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2023-12-04 15:08:19 -08:00
Victor Stinner c5fa8a54db
gh-112535: Add test on _Py_ThreadId() (#112709)
Add also test.support.Py_GIL_DISABLED constant.
2023-12-04 22:40:06 +00:00
Kamil Turek a1551b48ee
gh-103363: Add follow_symlinks argument to `pathlib.Path.owner()` and `group()` (#107962) 2023-12-04 19:42:01 +00:00
Alex Waygood 2ed20d3bd8
gh-74690: Avoid a costly type check where possible in `_ProtocolMeta.__subclasscheck__` (#112717) 2023-12-04 19:35:46 +00:00
Serhiy Storchaka e08b70fab1
gh-108927: Fix removing testing modules from sys.modules (GH-108952)
It breaks import machinery if the test module has submodules used in
other tests.
2023-12-04 15:43:27 +00:00
Serhiy Storchaka 6ca9d3e017
gh-109786: Fix leaks and crash when re-enter itertools.pairwise.__next__() (GH-109788) 2023-12-04 11:47:55 +00:00
Serhiy Storchaka c74e9fb189
gh-110275: Named tuple's __replace__() now raises TypeError for invalid arguments (GH-110299) 2023-12-04 13:30:32 +02:00
Serhiy Storchaka dee7beeb4f
bpo-34392: Add sys. _is_interned() (GH-8755) 2023-12-04 11:09:06 +02:00
chilaxan 0e732d0997
gh-112625: Protect bytearray from being freed by misbehaving iterator inside bytearray.join (GH-112626) 2023-12-04 08:15:43 +00:00
Barney Gale 09505c5c26
GH-106747: Improve `Path.glob()` expectations in pathlib tests (#112365)
Add trailing slashes to expected `Path.glob()` results wherever a pattern
has a trailing slash. This matches what `glob.glob()` produces.

Due to another bug (GH-65238) pathlib strips all trailing slashes, so this
change is academic for now.
2023-12-03 20:35:10 +00:00
Irit Katriel 97857ac058
gh-112645: remove deprecation warning for use of onerror in shutil.rmtree (#112659) 2023-12-03 14:02:37 +00:00
Irit Katriel 162d3d428a
gh-112620: Fix dis error on show_cache with labels (#112621) 2023-12-03 12:12:49 +00:00
Nikita Sobolev a9574c68f0
gh-112139: Add `inspect.Signature.format` and use it in `pydoc` (#112143)
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2023-12-02 15:39:43 -08:00
Nikita Sobolev a35a305098
gh-112618: Make `Annotated` cache typed (#112619)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2023-12-02 16:10:19 +00:00
William Wen 939fc6d6ea
gh-106922: Support multi-line error locations in traceback (attempt 2) (#112097) 2023-12-01 22:18:16 +00:00
Zackery Spytz 0daf555c6f
bpo-37013: Fix the error handling in socket.if_indextoname() (GH-13503)
* Fix a crash when pass UINT_MAX.
* Fix an integer overflow on 64-bit non-Windows platforms.
2023-12-01 15:16:49 +00:00
Alex Waygood 70a38ffb3d
gh-109413: libregrtest: enable mypy's `--strict-optional` check on most files (#112586)
Co-authored-by: Victor Stinner <vstinner@python.org>
2023-12-01 14:54:33 +00:00
Tian Gao c2982380f8
gh-112510: Add `readline.backend` for the backend readline uses (GH-112511)
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Co-authored-by: Donghee Na <donghee.na92@gmail.com>
2023-12-01 14:05:55 +00:00
Victor Stinner f8ff80f635
gh-109413: regrtest: add WorkerRunTests class (#112588) 2023-12-01 13:46:50 +00:00
Zackery Spytz 058444308a
gh-82565: Add tests for pickle and unpickle with bad files (GH-16606) 2023-12-01 13:36:37 +00:00
Irit Katriel bfb576ee23
gh-111058: Change coro.cr_frame/gen.gi_frame to be None for a closed coroutine/generator. (#112428) 2023-12-01 12:57:31 +00:00
Rémi Lapeyre a65a3d4806
bpo-39912: Raise appropriate exceptions in filterwarnings() and simplefilter() (GH-18878) 2023-12-01 11:17:47 +00:00
Alex Waygood 674c288b1c
gh-109413: Run mypy on `libregrtest` in CI (#112558)
Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
2023-11-30 23:00:14 +00:00
Brett Cannon 6d5e0dc0e3
Clarify a comment for `test.support.Py_C_RECURSION_LIMIT` to point out where a value came from but that it doesn't need to stay in sync (#112224) 2023-11-30 13:38:10 -08:00
Serhiy Storchaka 2223899adc
gh-104231: Add more tests for str(), repr(), ascii(), and bytes() (GH-112551) 2023-11-30 17:22:04 +02:00
Irit Katriel 07ebd46f9e
gh-112519: Make it possible to specify instruction flags for pseudo instructions in bytecodes.c (#112520) 2023-11-30 11:03:30 +00:00
Donghee Na 7eeea13403
gh-112205: Support @getter annotation from AC (gh-112396) 2023-11-30 19:40:53 +09:00
Jelle Zijlstra d4a6229afe
gh-104003: Implement PEP 702 (#104004)
Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2023-11-29 09:38:29 -08:00
Jelle Zijlstra 4038869423
gh-112509: Fix keys being present in both required_keys and optional_keys in TypedDict (#112512)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2023-11-29 09:36:48 -08:00
Serhiy Storchaka e0449b9a7f
Add more C API tests (GH-112522)
Add tests for PyObject_Str(), PyObject_Repr(), PyObject_ASCII() and
PyObject_Bytes().
2023-11-29 17:37:05 +02:00