Commit Graph

120400 Commits

Author SHA1 Message Date
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
Erlend E. Aasland 336030161a
Docs: align sqlite3 docs with versionadded/versionchanged recommendations (#114400)
When a parameter is added to a function or method, use the 'versionchanged'
directive, not 'versionadded'.
2024-01-21 19:54:19 +00:00
Erlend E. Aasland de17cf444a
Docs: link to sys.stdout in ftplib docs (#114396) 2024-01-21 17:41:21 +00:00
Nikita Sobolev 38768e4cdd
gh-114384: Align sys.set_asyncgen_hooks signature in docs to reflect implementation (#114385) 2024-01-21 13:49:49 +01:00
Erlend E. Aasland 96c15b1c8d
Docs: mark up FTP() constructor with param list (#114359)
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2024-01-21 12:27:33 +01: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
Nikita Sobolev 47133d8d86
gh-101100: Fix sphinx warnings in `Doc/c-api/memory.rst` (#114373) 2024-01-21 11:34:43 +02:00
Erlend E. Aasland fbc28748ea
Docs: mark up the FTP debug levels as a list (#114360)
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2024-01-21 09:19:31 +00:00
cdzhan b04c5005cc
Fix the confusing "User-defined methods" reference in the datamodel (#114276)
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>
2024-01-21 03:45:38 +00: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
Erlend E. Aasland 8f4f773647
Docs: Add missing line continuation to FTP_TLS class docs (#114352)
Regression introduced by b1ad5a5d4.
2024-01-20 19:39:44 +00: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
Sam Gross 1d6d5e854c
gh-112529: Use GC heaps for GC allocations in free-threaded builds (gh-114157)
* gh-112529: Use GC heaps for GC allocations in free-threaded builds

The free-threaded build's garbage collector implementation will need to
find GC objects by traversing mimalloc heaps. This hooks up the
allocation calls with the correct heaps by using a thread-local
"current_obj_heap" variable.

* Refactor out setting heap based on type
2024-01-21 01:14:45 +09:00
Erlend E. Aasland b1ad5a5d44
Docs: structure the ftplib reference (#114317)
Introduce the following headings and subheadings:

- Reference
  * FTP objects
  * FTP_TLS objects
  * Module variables
2024-01-20 16:06:52 +01:00
Adam Turner e6495159f6
GH-99380: Update to Sphinx 7 (#99381) 2024-01-20 11:20:51 +00:00
David H. Gutteridge 567a85e9c1
gh-114332: Fix the flags reference for ``re.compile()`` (#114334)
The GH-93000 change set inadvertently caused a sentence in re.compile()
documentation to refer to details that no longer followed. Correct this
with a link to the Flags sub-subsection.

Co-authored-by: Adam Turner <9087854+aa-turner@users.noreply.github.com>
2024-01-20 11:17:41 +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
Brett Cannon 681e9e85a2
Add a `clean` subcommand to `Tools/wasm/wasi.py` (GH-114274) 2024-01-19 11:38:52 -08:00
Hugo van Kemenade 229ee5bea1
Retain shorter tables of contents for Sphinx 5.2.3+ (#114318)
Disable toc_object_entries, new in Sphinx 5.2.3
2024-01-19 18:52:42 +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
mpage 28eacf27ef
gh-113884: Refactor `queue.SimpleQueue` to use a ring buffer to store items (#114259)
Use a ring buffer instead of a Python list in order to simplify the
process of making queue.SimpleQueue thread-safe in free-threaded
builds. The ring buffer implementation has no places where critical
sections may be released.
2024-01-19 12:17:51 +00:00
Nikita Sobolev 05e47202a3
gh-114286: Fix `maybe-uninitialized` warning in `Modules/_io/fileio.c` (GH-114287) 2024-01-19 10:25:05 +00:00
Donghee Na a34e4db28a
gh-111968: Fix --without-freelists build (gh-114270) 2024-01-18 23:25:13 +00:00
Donghee Na d5442851a6
gh-112087: Remove duplicated critical_section (gh-114268) 2024-01-18 23:03:28 +00: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
DerSchinken 68a7b78cd5
gh-112092: clarify unstable ABI recompilation requirements (#112093)
Use different versions in the examples for when extensions do and do not need to be recompiled to make the examples easier to understand.
2024-01-18 21:04:40 +01:00
Donghee Na 7fa511ba57
gh-111968: Use per-thread freelists for generator in free-threading (gh-114189) 2024-01-18 18:15:00 +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
Mark Shannon 2ff072f21f
Delete unused macro (GH-114238) 2024-01-18 15:49:50 +00:00
Christopher Chavez b8f29b1293
gh-110345: show Tcl/Tk patchlevel in `tkinter._test()` (GH-110350) 2024-01-18 17:46:58 +02:00
AN Long 8e31cdc945
gh-103092: Convert some `_ctypes` metatypes to heap types (GH-113620)
Co-authored-by: Erlend E. Aasland <erlend@python.org>
2024-01-18 16:30:27 +01: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
Miyashita Yosuke ba683c22ec
gh-114231: Fix indentation in enum.rst (#114232) 2024-01-18 09:23:15 +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
Terry Jan Reedy 8cda72037b
gh-114211: Update EmailMessage doc about ordered keys (#114224)
Ordered keys are no longer unlike 'real dict's.
2024-01-18 02:25:22 +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
Christophe Nanteuil 7573c44c32
Fix typo in tkinter.ttk.rst (GH-106157) 2024-01-17 18:23:25 +00:00