Commit graph

120418 commits

Author SHA1 Message Date
Steve Dower 665b8f365e
gh-113655: Revert extra stack reserve in PGO builds unless UseExtraStackReserve=true (GH-114263) 2024-01-22 21:19:16 +00:00
Sam Gross 412920a41e
gh-112532: Improve mimalloc page visiting (#114133)
This adds support for visiting abandoned pages in mimalloc and improves
the performance of the page visiting code. Abandoned pages contain
memory blocks from threads that have exited. At some point, they may be
later reclaimed by other threads. We still need to visit those pages in
the free-threaded GC because they contain live objects.

This also reduces the overhead of visiting mimalloc pages:

 * Special cases for full, empty, and pages containing only a single
   block.
 * Fix free_map to use one bit instead of one byte per block.
 * Use fast integer division by a constant algorithm when computing
   block offset from block size and index.
2024-01-22 13:10:21 -08:00
Michael Droettboom e45bae7a45
GH-114448: Don't sort summarize_stats.py histograms by amount of change (GH-114449) 2024-01-22 11:45:15 -08:00
Brett Cannon 5cd9c6b1fc
Fix wasi.py build after adding the clean subcommand. ({GH-114447) 2024-01-22 10:28:57 -08:00
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
Hugo van Kemenade 8ccd1ba461
gh-101100: Fix Sphinx warnings in reference/expressions.rst (#114194) 2024-01-22 18:21:14 +02:00
Serhiy Storchaka 1b719b39b9
gh-114321: Expose more constants in the fcntl module (GH-114322) 2024-01-22 18:09:22 +02:00
Kirill Podoprigora 6d30cbee01
Docs: Fix typo in code snippet (GH-114421) 2024-01-22 17:56:30 +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
neonene 9f7176d360
gh-103092: Ensure _ctypes.c static types are accessed via global state (#113857) 2024-01-22 14:40:36 +01: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
Guido van Rossum 2f2ddabd1a
gh-113102: Fix typo in INSTRUMENTED_RESUME (GH-114349) 2024-01-22 11:56:28 +00:00
Nikita Sobolev d1b031cc58
gh-114414: Assert PyType_GetModuleByDef result in _threadmodule (#114415) 2024-01-22 10:19:25 +01:00
Serhiy Storchaka 650f9e4c94
gh-114115: Update documentation of array.array (GH-114117)
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2024-01-22 08:42:50 +00: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
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