Commit graph

123507 commits

Author SHA1 Message Date
Raymond Hettinger
0bd0d4072a
Misc cleanups and wording improvements for the itertools docs (gh-119626) 2024-05-27 13:22:57 -05:00
Guido van Rossum
3ff06ebec4
Withdraw most of my ownership in favor of Mark (#119611) 2024-05-27 11:07:16 -07:00
Hugo van Kemenade
eea26c4a73
Docs: Move inline JavaScript to own file to reduce duplication (#119541) 2024-05-27 18:04:34 +00:00
Tian Gao
3dfa364cf2
gh-119580: Improve version added section for convenience variable (#119583) 2024-05-27 17:54:23 +00:00
Hugo van Kemenade
88e3fee3f8
Docs: Only install sphinx-autobuild for make htmllive (#119607) 2024-05-27 11:29:27 -06:00
Rafael Fontenelle
59630f92d8
Docs: Add class role for IPV{4,6}Address and fix a typo (#118059)
Add class role for IPV{4,6}Address and fix a typo

Co-authored-by: Kumar Aditya <kumaraditya@python.org>
2024-05-27 12:39:59 +00:00
Savannah Ostrowski
041a566f3f
GH-117283: Add doc warning for PyTuple_SetItem refcount > 1 (#117916) 2024-05-27 17:50:28 +05:30
Aditya Borikar
3b26cd8ca0
gh-119467: Fix Py_buffer.format type and correct documentation typo (#119475) 2024-05-27 17:46:13 +05:30
Kirill Podoprigora
c7a5e1e550
`Include/internal/pycore_import.h`: Fix typo (#119586)
Fix typo
2024-05-27 17:05:36 +05:30
Xie Yanbo
5ef5622543
Fix typos in HISTORY documentation (#119453) 2024-05-27 10:57:23 +03:00
Jason R. Coombs
5482a939ac
Re-order imports to align with zipp 3.18.2 (#119587) 2024-05-27 01:33:16 +00:00
Tian Gao
5d04cc50e5
gh-102864: Add switching frame test for pdb (#119564) 2024-05-26 17:05:23 +00:00
Alex Waygood
0220663e26
gh-119562: Remove unused private string constants from ast.py (#119576) 2024-05-26 13:31:02 +00:00
scoder
70b07aa415
gh-111997: Fix argument count for LINE event and clarify type of argument counts. (#119179) 2024-05-26 12:37:33 +00:00
Alex Waygood
008bc04dcb
gh-119562: Remove AST nodes deprecated since Python 3.8 (#119563) 2024-05-26 12:34:48 +00:00
Wulian233
b5b7dc98c9
Update README and layout.html from 3.13 to 3.14 (#119539)
Co-authored-by: Nice Zombies <nineteendo19d0@gmail.com>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2024-05-26 11:26:59 +00:00
Ned Batchelder
d25954dff5
docs: fix a few typos identified by codespell (#119516) 2024-05-25 18:13:31 -07:00
Barney Gale
e418fc3a6e
GH-82805: Fix handling of single-dot file extensions in pathlib (#118952)
pathlib now treats "`.`" as a valid file extension (suffix). This brings
it in line with `os.path.splitext()`.

In the (private) pathlib ABCs, we add a new `ParserBase.splitext()` method
that splits a path into a `(root, ext)` pair, like `os.path.splitext()`.
This method is called by `PurePathBase.stem`, `suffix`, etc. In a future
version of pathlib, we might make these base classes public, and so users
will be able to define their own `splitext()` method to control file
extension splitting.

In `pathlib.PurePath` we add optimised `stem`, `suffix` and `suffixes`
properties that don't use `splitext()`, which avoids computing the path
base name twice.
2024-05-25 21:01:36 +01:00
Eric Snow
0c5ebe13e9
gh-119560: Drop an Invalid Assert in PyState_FindModule() (gh-119561)
The assertion was added in gh-118532 but was based on the invalid assumption that PyState_FindModule() would only be called with an already-initialized module def.  I've added a test to make sure we don't make that assumption again.
2024-05-25 19:30:48 +00:00
Alex Waygood
4b7eb321bc
gh-99180: Make StackSummary.should_show_carets private (#119554) 2024-05-25 17:08:32 +00:00
Pablo Galindo Salgado
6b6c1a904f
Add codeowners for PYREPL (#119550) 2024-05-25 16:21:07 +00:00
Pablo Galindo Salgado
e3bac04c37
gh-119548: Add a 'clear' command to the REPL (#119549) 2024-05-25 16:15:54 +00:00
Hugo van Kemenade
a531fd7fdb
FAQ: Add reference to Python version numbering scheme (#119225) 2024-05-25 08:13:17 -06:00
Serhiy Storchaka
08e65430aa
gh-111999: Fix the signature of str.format_map() (#119540) 2024-05-25 06:21:11 -07:00
Tim Peters
de19694cfb
gh-119105: Differ.compare is too slow [for degenerate cases] (#119492)
``_fancy_replace()`` is no longer recursive. and a single call does a worst-case linear number of ratio() computations instead of quadratic. This renders toothless a universe of pathological cases. Some inputs may produce different output, but that's rare, and I didn't find a case where the final diff appeared to be of materially worse quality. To the contrary, by refusing to even consider synching on lines "far apart", there was more easy-to-digest locality in the output.
2024-05-24 22:08:21 -05:00
Jelle Zijlstra
84be5244de
gh-119180: Update the magic number (#119397)
PR #119321 added a comment about the magic number bump
but did not actually apply the new magic number.
2024-05-24 17:32:17 -07:00
Raymond Hettinger
49c3ade4f3
Misc improvement to the docs for itertools (gh-119529) 2024-05-24 16:58:24 -05:00
Barney Gale
81d6336230
GH-119054: Add "Querying file type and status" section to pathlib docs (#119055)
Add a dedicated subsection for `Path.stat()`-related methods, specifically
`stat()`, `lstat()`, `exists()`, `is_*()`, and `samefile()`.
2024-05-24 19:35:13 +00:00
Kirill Podoprigora
045e195c76
Regen `Doc/requirements-oldest-sphinx.txt` (#119520) 2024-05-24 13:30:32 -06:00
Nice Zombies
96b392df30
gh-118263: Add additional arguments to path_t (Argument Clinic type) in posixmodule (GH-118355) 2024-05-24 19:04:17 +01:00
Germán Méndez Bravo
f0ed1863bd
gh-112075: Fix dict thread safety issues (#119288)
Fix dict thread safety issues
2024-05-24 10:39:06 -07:00
Alyssa Coghlan
bf5b6467f8
GH-119496: accept UTF-8 BOM in .pth files (GH-119503)
`Out-File -Encoding utf8` and similar commands in Windows Powershell 5.1 emit
UTF-8 with a BOM marker, which the regular `utf-8` codec decodes incorrectly.

`utf-8-sig` accepts a BOM, but also works correctly without one.

This change also makes .pth files match the way Python source files are handled.

Co-authored-by: Inada Naoki <songofacandy@gmail.com>
2024-05-24 14:29:19 +00:00
Victor Stinner
92fab3356f
gh-69214: Fix fcntl.ioctl() request type (#119498)
Use an 'unsigned long' instead of an 'unsigned int' for the request
parameter of fcntl.ioctl() to support requests larger than UINT_MAX.
2024-05-24 14:31:40 +02:00
Brandt Bucher
b48a3dbff4
GH-113464: Run the JIT interpreter before any other JIT CI (GH-119466) 2024-05-24 03:13:41 +00:00
Carlos Meza
0867bce457
gh-119317: findall instead of traverse for docutils nodes (#119319) 2024-05-24 05:04:12 +03:00
Petr Viktorin
ffa24aab10
Clarify base64.a85encode docs: *wrapcols* doesn't count the newline (GH-119409) 2024-05-24 00:11:45 +02:00
Victor Stinner
e94dbe4ed8
gh-119461: Fix ThreadedVSOCKSocketStreamTest (#119465)
Add socket.VMADDR_CID_LOCAL constant.

Fix ThreadedVSOCKSocketStreamTest: if get_cid() returns the host
address or the "any" address, use the local communication address
(loopback): VMADDR_CID_LOCAL.

On Linux 6.9, apparently, the /dev/vsock device is now available but
get_cid() returns VMADDR_CID_ANY (-1).
2024-05-23 23:26:09 +02:00
Brett Simmers
be1dfccdf2
gh-118727: Don't drop the GIL in drop_gil() unless the current thread holds it (#118745)
`drop_gil()` assumes that its caller is attached, which means that the current
thread holds the GIL if and only if the GIL is enabled, and the enabled-state
of the GIL won't change. This isn't true, though, because `detach_thread()`
calls `_PyEval_ReleaseLock()` after detaching and
`_PyThreadState_DeleteCurrent()` calls it after removing the current thread
from consideration for stop-the-world requests (effectively detaching it).

Fix this by remembering whether or not a thread acquired the GIL when it last
attached, in `PyThreadState._status.holds_gil`, and check this in `drop_gil()`
instead of `gil->enabled`.

This fixes a crash in `test_multiprocessing_pool_circular_import()`, so I've
reenabled it.
2024-05-23 16:59:35 -04:00
Eric Snow
b30d30c747
gh-117398: Statically Allocate the Datetime C-API (GH-119472) 2024-05-23 21:15:52 +02:00
Łukasz Langa
6e012ced6c
gh-119469: Fix _pyrepl reference leaks (#119470) 2024-05-23 19:28:31 +02:00
Petr Viktorin
a192547dfe
gh-117142: Slightly hacky fix for memory leak of StgInfo (GH-119424)
Add a funciton that inlines PyObject_GetTypeData and skips
type-checking, so it doesn't need access to the CType_Type object.
This will break if the memory layout changes, but should
be an acceptable solution to enable ctypes in subinterpreters in
Python 3.13.

Mark _ctypes as safe for multiple interpreters

Co-authored-by: neonene <53406459+neonene@users.noreply.github.com>
2024-05-23 16:01:37 +00:00
Mark Shannon
406ffb5293
GH-117195: Avoid assertion error in object.__sizeof__ (GH-117220) 2024-05-23 11:06:10 +01:00
Irit Katriel
c85e352673
gh-119431: fix refleak in test_monitoring (#119444) 2024-05-23 10:21:53 +01:00
Xie Yanbo
e3f5a44553
Fix typos in what's new documentation (#119448) 2024-05-23 06:41:33 +00:00
Ayato Hayashi
43807fec8d
Tiny fix: Update link for HAC algorithm (gh-118546) 2024-05-23 02:11:11 +00:00
Tim Peters
07df93de73
gh-119105: difflib.py Differ.compare is too slow [for degenerate cases] (#119376)
Track all pairs achieving the best ratio in Differ(). This repairs the "very deep recursion and cubic time" bad cases in a way that preserves previous output.
2024-05-22 18:25:08 -05:00
Dino Viehland
e3bf5381fd
gh-119434: Fix culmitive errors in wrapping as lines proceed (#119435)
Fix culmitive errors in wrapping as lines proceed
2024-05-22 15:03:32 -07:00
Victor Stinner
9b422fc6af
gh-119396: Optimize PyUnicode_FromFormat() UTF-8 decoder (#119398)
Add unicode_decode_utf8_writer() to write directly characters into a
_PyUnicodeWriter writer: avoid the creation of a temporary string.
Optimize PyUnicode_FromFormat() by using the new
unicode_decode_utf8_writer().

Rename unicode_fromformat_write_cstr() to
unicode_fromformat_write_utf8().

Microbenchmark on the code:

    return PyUnicode_FromFormat(
        "%s %s %s %s %s.",
        "format", "multiple", "utf8", "short", "strings");

Result: 620 ns +- 8 ns -> 382 ns +- 2 ns: 1.62x faster.
2024-05-22 21:05:26 +00:00
Lysandros Nikolaou
14b063cbf1
gh-111201: Use calc_complete_screen after bracketed paste in PyREPL (#119432) 2024-05-22 17:02:33 -04:00
neonene
e12a6780bb
gh-117142: ctypes: Clean up c-analyzer .tsv files (GH-117544)
Co-authored-by: Petr Viktorin <encukou@gmail.com>
2024-05-22 20:30:41 +00:00