Commit Graph

28486 Commits

Author SHA1 Message Date
Pavol Babinčák‏ f5c05e015c
bpo-40648: Test modes that file can get with chmod() on Windows (GH-20130)
Order of tests matter second part makes testing file writable and
possible to remove again.
2023-12-13 22:23:13 +02:00
Diego Russo 6644ca45cd
gh-110190: Fix ctypes structs with array on PPCLE64 (GH-112959)
Fix the same issue of PR #112604 on PPC64LE platform
Refactor tests to make easier to add more platfroms if needed.
2023-12-13 17:08:15 +01:00
Steve Dower 79dad03747
gh-111650: Ensure pyconfig.h includes Py_GIL_DISABLED on Windows (GH-112778) 2023-12-13 15:38:45 +00:00
Irit Katriel 428c9812cb
gh-112962: in dis module, put cache information in the Instruction instead of creating fake Instructions to represent it (#113016) 2023-12-13 12:00:21 +00:00
Hugo van Kemenade 3531ea441b
gh-101100: Fix Sphinx warning in references with asterisks (#113029)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2023-12-13 09:24:55 +02:00
beavailable 3aea6c4823
gh-101336: Add keep_alive keyword arg for asyncio create_server() (#112485) 2023-12-13 03:23:29 +00:00
Jamie a3a1cb4845
gh-112622: Pass name to loop create_task method (#112623)
This affects task creation through either `asyncio.create_task()` or `TaskGroup.create_task()` -- the redundant call to `task.set_name()` is skipped. We still call `set_name()` when a task factory is involved, because the task factory call signature (unfortunately) doesn't take a `name` argument.
2023-12-12 17:26:40 -08:00
J. Nick Koston 7e2d93f30b
gh-112989: asyncio: Reduce overhead to connect sockets with SelectorEventLoop (#112991)
_ensure_fd_no_transport had a KeyError in the success path
2023-12-12 16:29:21 -08:00
Guido van Rossum 7316dfb0eb
gh-112320: Implement on-trace confidence tracking for branches (#112321)
We track the confidence as a scaled int.
2023-12-12 21:43:08 +00:00
Mark Shannon 956023826a
GH-108866: Guarantee forward progress in executors. (GH-113006) 2023-12-12 19:02:24 +00:00
Sam James c454e934d3
gh-112970: Detect and use closefrom() when available (#112969)
glibc-2.34 implements closefrom(3) using the same semantics as on BSD.
Check for closefrom() in configure and use the check result in
fileutils.c, rather than hardcoding a FreeBSD check.

Some implementations of closefrom() return an int. Explicitly discard 
the return value by casting it to void, to avoid future compiler
warnings.

Signed-off-by: Sam James <sam@gentoo.org>
2023-12-12 11:25:27 +01:00
Ronald Oussoren 0d2fe6bab0
gh-87286: Add a number of LOG_* constants to syslog (#24432)
* bpo-43120: Add a number of LOG_* constants to syslog

This adds a number of syslog facilities to the syslogmodule.c.
These values are available on macOS.

* Switch contant documentation to the data directive

This fixes a CI warning and matches the pattern
used in the documentation for ``os``.

* Update Doc/library/syslog.rst


Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2023-12-12 10:25:51 +01:00
Steve Dower 1c5fc02fd0
gh-71383: Update Tcl/Tk version in Windows to our patched build containing a targeted upstream fix (GH-112973) 2023-12-11 21:54:17 +00:00
achhina a01022af23
GH-83162: Rename re.error for better clarity. (#101677)
Renamed re.error for clarity, and kept re.error for backward compatibility.
Updated idlelib files at TJR's request.
---------

Co-authored-by: Matthias Bussonnier <mbussonnier@ucmerced.edu>
Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
2023-12-11 15:45:08 -05:00
colorfulappl 0066ab5bc5
gh-90350: Optimize builtin functions min() and max() (GH-30286)
Builtin functions min() and max() now use METH_FASTCALL
2023-12-11 21:27:06 +02:00
Sidney Markowitz 27a5fd8cb8
gh-94606: Fix error when message with Unicode surrogate not surrogateescaped string (GH-94641)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2023-12-11 18:21:18 +02:00
Ronald Oussoren 3251ba8f1a
gh-112898: warn about unsaved files when quitting IDLE on macOS (#112939)
* gh-112898: warn about unsaved files when quitting IDLE on macOS

Implement the TK function ``::tk::mac::Quit`` on macOS to
ensure that IDLE asks about saving unsaved files when
quitting IDLE. 

Co-authored-by: Christopher Chavez chrischavez@gmx.us
2023-12-11 15:22:36 +01:00
Pablo Galindo Salgado a135a6d2c6
gh-112943: Correctly compute end offsets for multiline tokens in the tokenize module (#112949) 2023-12-11 11:44:22 +00:00
Ronald Oussoren dd2ebdf89f
gh-109980: Fix test_tarfile_vs_tar on macOS (#112905)
On recentish macOS versions the system tar
command includes system metadata (ACLs, extended attributes
and resource forks) in the tar archive, which
shutil.make_archive will not do. This can cause
spurious test failures.
2023-12-10 12:38:49 +01:00
Neil Schemenauer 890ce430d9
gh-112867: fix for WITH_PYMALLOC_RADIX_TREE=0 (GH-112885)
The _obmalloc_usage structure is only defined if the obmalloc radix tree
is enabled.
2023-12-09 13:50:48 -08:00
Gregory P. Smith 10e9bb13b8
gh-112334: Regression test that vfork is used when expected. (#112734)
Regression test that vfork is used when expected by subprocess.

This is written integration test style, it uses strace if it is present and appears to work to find out what system call actually gets used in different scenarios.

Test coverage is added for the default behavior and that of each of the specific arguments that must disable the use of vfork.  obviously not an entire test matrix, but it covers the most important aspects.

If there are ever issues with this test being flaky or failing on new platforms, rather than try and adapt it for all possible platforms, feel free to narrow the range it gets tested on when appropriate. That is not likely to reduce coverage.
2023-12-09 00:18:35 +00:00
Raymond Hettinger f3bff4ee9d
gh-112540: Support zero inputs in geometric_mean() (gh-112880) 2023-12-08 12:05:56 -06:00
Barney Gale 76929fdeeb
GH-110109: Add `pathlib._PurePathBase` (#110670)
Add private `pathlib._PurePathBase` class: a private superclass of both `PurePath` and `_PathBase`. Unlike `PurePath`, it does not define any of these special methods: `__fspath__`, `__bytes__`, `__reduce__`, `__hash__`, `__eq__`, `__lt__`, `__le__`, `__gt__`, `__ge__`. Its initializer and path joining methods accept only strings, not os.PathLike objects more broadly.

This is important for supporting *virtual paths*: user subclasses of `_PathBase` that provide access to archive files, FTP servers, etc. In these classes, the above methods should be implemented by users only as appropriate, with due consideration for the hash/equality of any backing objects, such as file objects or sockets.
2023-12-08 17:39:04 +00:00
Ronald Oussoren 15a80b15af
gh-110820: Make sure processor specific defines are correct for Universal 2 build on macOS (#112828)
* gh-110820: Make sure processor specific defines are correct for Universal 2 build on macOS

A number of processor specific defines are different for x86-64 and
arm64, and need to be adjusted in pymacconfig.h.

* remove debug stuf
2023-12-08 10:09:34 +01:00
Ronald Oussoren bf0beae6a0
gh-110017: Disable test_signal.test_stress_modifying_handlers on macOS (#112834)
Test test_stress_modifying_handlers in test_signal can crash
the interpreter due to a bug in macOS. Filed as FB13453490
with Apple.
2023-12-07 19:41:27 +01:00
AN Long a955fd68d6
gh-112278: Disable WMI queries on Windows after they time out (GH-112658) 2023-12-07 17:26:29 +00:00
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
Seth Michael Larson 21221c398f
gh-112302: Add Software Bill-of-Materials (SBOM) tracking for dependencies (#112303) 2023-12-07 18:01:58 +02: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
Ronald Oussoren 4b125dd31a
gh-51944: Add missing macOS constants to termios (#112823)
* gh-51944: Add some macOS constants to termios

This changeset adds all public constants in <termio.h>
and <sys/termios.h> on macOS that weren't present
already.

Based on the macOS 14.2 SDK

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2023-12-07 11:27:30 +01: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
Serhiy Storchaka 8660fb7fd7
gh-112660: Do not clear arbitrary errors on import (GH-112661)
Previously arbitrary errors could be cleared during formatting error
messages for ImportError or AttributeError for modules. Now all
unexpected errors are reported.
2023-12-07 12:19:43 +02: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
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
Russell Keith-Magee dc824c5dc1
gh-112736: Refactor del-safe symbol handling in subprocess (#112738)
Refactor delete-safe symbol handling in subprocess.

Only module globals are force-cleared during interpreter finalization, using a class reference instead of individually listing the constants everywhere is simpler.
2023-12-04 20:23:17 -08:00
Barney Gale 304a1b3f3a
GH-112727: Speed up `pathlib.Path.absolute()` (#112728)
Use `_from_parsed_parts()` to create a pre-joined/pre-parsed path, rather
than passing multiple arguments to `with_segments()`

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2023-12-04 23:21:39 +00: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