Commit Graph

51795 Commits

Author SHA1 Message Date
AN Long 7fc51c3f6b
gh-114257: Ignore the FileNotFound error in ctypes.util._is_elf() (GH-114394) 2024-01-22 17:15:29 +00:00
Irit Katriel ed30a3c337
gh-114083: apply optimization of LOAD_CONST instructions to the whole CFG before optimize_basic_block. (#114408) 2024-01-22 17:12:06 +00:00
Serhiy Storchaka a53e56e7d8
gh-75128: Ignore EADDRNOTAVAIL error in asyncio.BaseEventLoop.create_server() (GH-114420)
Co-authored-by: Antoine Pitrou <pitrou@free.fr>
2024-01-22 18:40:35 +02:00
Nikita Sobolev 2ef520ebec
gh-108303: Remove `Lib/test/shadowed_super.py` (#114372)
Move code into Lib/test/test_super.py.
2024-01-22 16:09:10 +01:00
Serhiy Storchaka 49785b06de
gh-102512: Turn _DummyThread into _MainThread after os.fork() called from a foreign thread (GH-113261)
Always set a _MainThread as a main thread after os.fork() is called from
a thread started not by the threading module.

A new _MainThread was already set as a new main thread after fork if
threading.current_thread() was not called for a foreign thread before fork.
Now, if it was called before fork, the implicitly created _DummyThread will
be turned into _MainThread after fork.

It fixes, in particularly, an incompatibility of _DummyThread with
the threading shutdown logic which relies on the main thread
having tstate_lock.

Co-authored-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
2024-01-22 16:14:42 +02:00
Nikita Sobolev 8f5e7d739f
gh-108303: Move `smtpd` to `test.support` (#114368)
Update test_logging.py and test_smtplib.py.
2024-01-22 14:36:29 +01:00
Serhiy Storchaka c8351a617b
gh-113796: Add more validation checks in the csv.Dialect constructor (GH-113797)
ValueError is now raised if the same character is used in different roles.
2024-01-22 15:34:16 +02:00
Gregory P. Smith fd49e22670
gh-114328: tty cbreak mode should not alter ICRNL (#114335)
The terminal CR -> NL mapping setting should be inherited in cbreak mode as OSes do not specify altering it as part of their stty cbreak mode definition.
2024-01-21 15:25:52 -08:00
Serhiy Storchaka db1c18eb62
gh-111803: Make test_deep_nesting from test_plistlib more strict (GH-114026)
It is no longer silently passed if RecursionError was raised for low
recursion depth.
2024-01-21 22:29:51 +02:00
Serhiy Storchaka 42d72b23dd
gh-114241: Fix and improve the ftplib CLI (GH-114242)
* Fix writing the retrieved binary file to stdout.
* Add a newline after writing warnings to stderr.
* Fix a TypeError if the netrc file doesn't contain a host/default entry.
* Improve the usage message.
2024-01-21 22:16:45 +02:00
Ronald Oussoren 5adff3f86f
gh-80931: Skip some socket tests while hunting for refleaks on macOS (#114057)
Some socket tests related to sending file descriptors cause a file descriptor leak on macOS, all of them tests that send one or more descriptors than cannot be received on the read end.  This appears to be a platform bug.

This PR skips those tests when doing a refleak test run to avoid hiding other problems.
2024-01-21 11:25:15 +01:00
Hugo van Kemenade 52eade2223
Remove deleted `time_hashlib.py` from `Lib/test/.ruff.toml` (#114355) 2024-01-20 14:10:43 -07:00
Gregory P. Smith c48b8f8db8
Remove the non-test Lib/test/time_hashlib.py. (#114354)
I believe I added this while chasing some performance of hash functions
when I first created hashlib.  It hasn't been used since, is frankly
trivial, and not a test.
2024-01-20 12:09:50 -08:00
Nikita Sobolev 0554a9594e
gh-114281: Remove incorrect type hints from `asyncio.staggered` (#114282)
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2024-01-20 16:49:48 +00:00
Barney Gale 1e610fb05f
GH-113225: Speed up `pathlib.Path.walk(top_down=False)` (#113693)
Use `_make_child_entry()` rather than `_make_child_relpath()` to retrieve
path objects for directories to visit. This saves the allocation of one
path object per directory in user subclasses of `PathBase`, and avoids a
second loop.

This trick does not apply when walking top-down, because users can affect
the walk by modifying *dirnames* in-place.

A side effect of this change is that, in bottom-up mode, subdirectories of
each directory are visited in reverse order, and that this order doesn't
match that of the names in *dirnames*. I suspect this is fine as the
order is arbitrary anyway.
2024-01-20 03:06:00 +00:00
Barney Gale 6313cdde58
GH-79634: Accept path-like objects as pathlib glob patterns. (#114017)
Allow `os.PathLike` objects to be passed as patterns to `pathlib.Path.glob()` and `rglob()`. (It's already possible to use them in `PurePath.match()`)

While we're in the area:

- Allow empty glob patterns in `PathBase` (but not `Path`)
- Speed up globbing in `PathBase` by generating paths with trailing slashes only as a final step, rather than for every intermediate directory.
- Simplify and speed up handling of rare patterns involving both `**` and `..` segments.
2024-01-20 02:10:25 +00:00
Irit Katriel 7e49f27b41
gh-114265: move line number propagation before cfg optimization, remove guarantee_lineno_for_exits (#114267) 2024-01-19 14:49:26 +00:00
Nikita Sobolev efb81a60f5
gh-114275: Skip doctests that use `asyncio` in `test_pdb` for WASI builds (#114309) 2024-01-19 14:00:34 +01:00
Skip Montanaro 72abb8c5d4
gh-114123: Migrate docstring from _csv to csv (#114124)
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
Co-authored-by: Éric <merwok@netwok.org>
2024-01-18 22:18:42 +00:00
keithasaurus 2d3f6b56c5
gh-114087: Speed up dataclasses._asdict_inner (#114088) 2024-01-18 09:03:20 -07:00
Phillip Schanely 339fc3c224
gh-114198: Rename dataclass __replace__ argument to 'self' (gh-114251)
This change renames the dataclass __replace__ method's first argument
name from 'obj' to 'self'.
2024-01-18 11:01:17 -05:00
Nikita Sobolev 9c93350f58
gh-108303: Move all doctest related files and tests to `Lib/test/test_doctest/` (#112109)
Co-authored-by: Brett Cannon <brett@python.org>
2024-01-18 16:58:11 +01:00
Christopher Chavez b8f29b1293
gh-110345: show Tcl/Tk patchlevel in `tkinter._test()` (GH-110350) 2024-01-18 17:46:58 +02:00
kcatss a571a2fd3f
gh-114050: Fix crash when more than two arguments are passed to int() (GH-114067)
Co-authored-by: Kirill Podoprigora <kirill.bast9@mail.ru>
2024-01-18 13:27:44 +02:00
Serhiy Storchaka 311d1e2701
gh-104522: Fix test_subprocess failure when build Python in the root home directory (GH-114236)
* gh-104522: Fix test_subprocess failure when build Python in the root home directory

EPERM is raised when setreuid() fails.
EACCES is set in execve() when the test user has not access to sys.executable.
2024-01-18 10:52:59 +00:00
Terry Jan Reedy 6f4b242a03
gh-96905: In IDLE code, stop redefining built-ins 'dict' and 'object' (#114227)
Prefix 'dict' with 'o', 'g', or 'l' for 'object', 'global', or 'local'.
Suffix 'object' with '_'.
2024-01-18 04:39:12 +00:00
Petr Viktorin c1db960608
gh-113205: test_multiprocessing.test_terminate: Test the API on threadpools (#114186)
gh-113205: test_multiprocessing.test_terminate: Test the API works on threadpools

Threads can't be forced to terminate (without potentially corrupting too much
state), so the  expected behaviour of `ThreadPool.terminate` is to wait for
the currently executing tasks to finish.

The entire test was skipped in GH-110848 (0e9c364f4a).
Instead of skipping it entirely, we should ensure the API eventually succeeds:
use a shorter timeout.

For the record: on my machine, when the test is un-skipped, the task manages to
start in about 1.5% cases.
2024-01-17 17:15:29 -08:00
Serhiy Storchaka e2c097ebde
gh-104522: Fix OSError raised when run a subprocess (#114195)
Only set filename to cwd if it was caused by failed chdir(cwd).

_fork_exec() now returns "noexec:chdir" for failed chdir(cwd).

Co-authored-by: Robert O'Shea <PurityLake@users.noreply.github.com>
2024-01-17 16:52:42 -08:00
Ethan Furman 4c7e09d012
gh-114149: [Enum] revert #114160 and add more tuple-subclass tests (GH-114215)
This reverts commit 05e142b154.
2024-01-17 16:31:00 -08:00
Steve Dower 945540306c
gh-112984: Fix test_ctypes.test_loading.test_load_dll_with_flags when directory name includes a dot (GH-114217) 2024-01-18 00:26:31 +00:00
Steve Dower f56d132deb
gh-112984 Update Windows build and installer for free-threaded builds (GH-113129) 2024-01-17 21:52:23 +00:00
buermarc 78fcde039a
gh-38807: Fix race condition in Lib/trace.py (GH-110143)
Instead of checking if a directory does not exist and thereafter
creating it, directly call os.makedirs() with the exist_ok=True.
2024-01-17 22:02:14 +02:00
Sheidan 0b541f64c4
gh-105102: Fix nested unions in structures when the system byteorder is the opposite (GH-105106) 2024-01-17 18:20:39 +00:00
Ethan Furman 33b47a2c28
gh-114149: [Enum] fix tuple subclass handling when using custom __new__ (GH-114160) 2024-01-17 09:47:11 -08:00
Thomas Wouters 8cf37f244f Merge branch 'main' of https://github.com/python/cpython 2024-01-17 16:19:08 +01:00
Tian Gao 5c351fc85a
gh-112343: pdb: Use tokenize to replace convenience variables (#112380) 2024-01-17 14:50:31 +00:00
Radislav Chugunov 0154405350
gh-104282: Fix null pointer dereference in `lzma._decode_filter_properties` (GH-104283) 2024-01-17 13:15:44 +00:00
Thomas Wouters f009305a7d Python 3.13.0a3 2024-01-17 13:14:40 +01:00
Steve Dower b204c4beb4
gh-86179: Skip test case that fails on POSIX with unversioned binary (GH-114136) 2024-01-17 11:33:59 +00:00
Terry Jan Reedy 4a32275389
gh-72284: Revise lists in IDLE doc (#114174)
Tkinter is a fact, not necessarily a feature.

Reorganize editor key bindings in a logical order
and remove those that do not work, at least on Windows.

Improve shell bindings list.
2024-01-17 07:52:32 +00:00
Terry Jan Reedy e07a400c31
gh-81479: For Help => IDLE Doc, stop double-spacing some lists. (#114168)
This matches Firefox format.  Edge double-spaces non-simple
list but I think it looks worse.
2024-01-17 05:24:59 +00:00
Brett Cannon 03f7839703
GH-114013: fix setting `HOSTRUNNER` for `Tools/wasm/wasi.py` (GH-114097)
Also fix tests found failing under a pydebug build of WASI thanks to `make test` working due to this change.
2024-01-16 11:36:41 -08:00
Shantanu 3d5df54cdc
Clean up backslash avoiding code in ast, fix typo (#113605)
As of #108553, the `_avoid_backslashes` code path is dead

`scape_newlines` was introduced in #110271. Happy to drop the typo fix
if we don't want it
2024-01-16 11:24:25 -08:00
Serhiy Storchaka 74208ed0c4
gh-113659: Skip hidden .pth files (GH-113660)
Skip .pth files with names starting with a dot or hidden file attribute.
2024-01-16 20:23:05 +02:00
Terry Jan Reedy 7a24ecc953
Fix 'expresion' typo in IDLE doc (#114130)
The substantive change is on line 577/593. Rest is header/footer stuff ignored when displaying.
2024-01-16 17:12:59 +00:00
Victor Stinner c77f552ec0
gh-114107: test.pythoninfo logs Windows Developer Mode (#114121)
Also, don't skip the whole collect_windows() if ctypes is missing.

Log also ctypes.windll.shell32.IsUserAnAdmin().
2024-01-16 17:23:46 +01:00
Serhiy Storchaka d2d8332f71
gh-113626: Add allow_code parameter in marshal functions (GH-113648)
Passing allow_code=False prevents serialization and de-serialization of
code objects which is incompatible between Python versions.
2024-01-16 18:05:15 +02:00
Petr Viktorin c361a1f395
gh-114107: Fix importlib.resources symlink test if symlinks aren't supported (#114108)
gh-114107: Fix symlink test if symlinks aren't supported
2024-01-16 16:10:03 +01:00
Serhiy Storchaka d4dfad2aa9
gh-114077: Fix OverflowError in socket.sendfile() when pass count >2GiB (GH-114079) 2024-01-16 11:31:34 +00:00
Mike Zimin c85c0026a6
gh-113238: add Anchor to importlib.resources (#113801)
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
2024-01-16 10:55:59 +00:00