Commit graph

51990 commits

Author SHA1 Message Date
Eugene Toder c0b0c2f201
gh-101860: Expose __name__ on property (GH-101876)
Useful for introspection and consistent with functions and other
descriptors.
2024-02-20 17:14:34 +02:00
Alexander Shadchin 1ff6c1416b
Add missed stream argument (#111775)
* Add missed `stream` argument

* Add news
2024-02-20 14:09:46 +00:00
Ken Jin dcba21f905
gh-115687: Split up guards from COMPARE_OP (GH-115688) 2024-02-20 11:30:49 +00:00
Mark Shannon 626c414995
GH-115457: Support splitting and replication of micro ops. (GH-115558) 2024-02-20 10:50:59 +00:00
Mark Shannon 7b21403ccd
GH-112354: Initial implementation of warm up on exits and trace-stitching (GH-114142) 2024-02-20 09:39:55 +00:00
Jason Zhang c2cb31bbe1
gh-115539: Allow enum.Flag to have None members (GH-115636) 2024-02-19 14:36:11 -08:00
Serhiy Storchaka e47ecbd042
gh-60346: Improve handling single-dash options in ArgumentParser.parse_known_args() (GH-114180) 2024-02-19 19:20:00 +02:00
Serhiy Storchaka 872cc9957a
gh-115341: Fix loading unit tests with doctests in -OO mode (GH-115342) 2024-02-19 19:03:21 +02:00
Serhiy Storchaka 07ef9d86a5
Fix test_py_compile with -O mode (GH-115345) 2024-02-19 19:02:51 +02:00
Serhiy Storchaka 7b25a82e83
Fix test_compile with -O mode (GH-115346) 2024-02-19 19:02:29 +02:00
Pablo Galindo Salgado ecf16ee50e
gh-115154: Fix untokenize handling of unicode named literals (#115171) 2024-02-19 14:54:10 +00:00
Masayuki Moriyama 1476ac2c58
gh-102388: Add windows_31j to aliases for cp932 codec (#102389)
The charset name "Windows-31J" is registered in the IANA Charset Registry[1]
and is implemented in Python as the cp932 codec.

[1] https://www.iana.org/assignments/charset-reg/windows-31J

Signed-off-by: Masayuki Moriyama <masayuki.moriyama@miraclelinux.com>
2024-02-19 17:01:35 +09:00
Jamie Phan 53d5e67804
gh-111358: Fix timeout behaviour in BaseEventLoop.shutdown_default_executor (#115622) 2024-02-19 00:01:00 +00:00
Victor Stinner 1e5719a663
gh-115122: Add --bisect option to regrtest (#115123)
* test.bisect_cmd now exit with code 0 on success, and code 1 on
  failure. Before, it was the opposite.
* test.bisect_cmd now runs the test worker process with
  -X faulthandler.
* regrtest RunTests: Add create_python_cmd() and bisect_cmd()
  methods.
2024-02-18 20:06:39 +00:00
Sebastian Rittau 371c970886
gh-114709: Fix exceptions raised by posixpath.commonpath (#114710)
Fix the exceptions raised by posixpath.commonpath

Raise ValueError, not IndexError when passed an empty iterable. Raise
TypeError, not ValueError when passed None.
2024-02-18 00:24:58 -08:00
Nikita Sobolev f9154f8f23
gh-108303: Move Lib/test/sortperf.py to Tools/scripts (#114687) 2024-02-18 10:27:14 +03:00
Serhiy Storchaka 090dd21ab9
gh-115618: Remove improper Py_XDECREFs in property methods (GH-115619) 2024-02-17 23:18:30 +02:00
Brian Schubert 90dd653a61
gh-115596: Fix ProgramPriorityTests in test_os permanently changing the process priority (GH-115610) 2024-02-17 16:42:57 +00:00
Dmitry Marakasov 437924465d
Fix ProgramPriorityTests on FreeBSD with high nice value (GH-100145)
It expects priority to be capped with 19, which is the cap for Linux,
but for FreeBSD the cap is 20 and the test fails under the similar
conditions. Tweak the condition to cover FreeBSD as well.
2024-02-17 14:54:47 +00:00
Kirill Podoprigora 265548a4ea
gh-115567: Catch test_ctypes.test_callbacks.test_i38748_stackCorruption stdout output (GH-115568) 2024-02-17 15:17:55 +02:00
Kirill Podoprigora b9a9e3dd62
gh-107155: Fix help() for lambda function with return annotation (GH-107401) 2024-02-17 12:47:51 +00:00
wookie184 664965a1c1
gh-96497: Mangle name before symtable lookup in 'symtable_extend_namedexpr_scope' (GH-96561) 2024-02-17 12:06:31 +00:00
Matthew Hughes e88ebc1c40
gh-97590: Update docs and tests for ftplib.FTP.voidcmd() (GH-96825)
Since 2f3941d743 this function returns the
response string, rather than nothing.
2024-02-17 11:57:51 +00:00
6t8k 26800cf25a
gh-95782: Fix io.BufferedReader.tell() etc. being able to return offsets < 0 (GH-99709)
lseek() always returns 0 for character pseudo-devices like
`/dev/urandom` (for other non-regular files, e.g. `/dev/stdin`, it
always returns -1, to which CPython reacts by raising appropriate
exceptions). They are thus technically seekable despite not having seek
semantics.

When calling read() on e.g. an instance of `io.BufferedReader` that
wraps such a file, `BufferedReader` reads ahead, filling its buffer,
creating a discrepancy between the number of bytes read and the internal
`tell()` always returning 0, which previously resulted in e.g.
`BufferedReader.tell()` or `BufferedReader.seek()` being able to return
positions < 0 even though these are supposed to be always >= 0.

Invariably keep the return value non-negative by returning
max(former_return_value, 0) instead, and add some corresponding tests.
2024-02-17 11:16:06 +00:00
Thomas Weißschuh 09fab93c3d
gh-100884: email/_header_value_parser: don't encode list separators (GH-100885)
ListSeparator should not be encoded. This could happen when a long line
pushes its separator to the next line, which would have been encoded.
2024-02-17 10:13:46 +00:00
Derek Higgins 465db27cb9
gh-100985: Consistently wrap IPv6 IP address during CONNECT (GH-100986)
Update _get_hostport to always remove square brackets
from IPv6 addresses. Then add them if needed
in "CONNECT .." and "Host: ".
2024-02-17 10:10:12 +00:00
Peter Jiping Xie 9fd420f53d
gh-101384: Add socket timeout to ThreadedVSOCKSocketStreamTest and skip it on WSL (GH-101419) 2024-02-17 09:12:12 +00:00
Jamie Phan 73e8637002
gh-113812: Allow DatagramTransport.sendto to send empty data (#115199)
Also include the UDP packet header sizes (8 bytes per packet)
in the buffer size reported to the flow control subsystem.
2024-02-16 18:38:07 -08:00
Ammar Askar 8b776e0f41
gh-85294: Handle missing arguments to @singledispatchmethod gracefully (GH-21471)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2024-02-16 23:17:30 +02:00
Irit Katriel 74e6f4b32f
gh-112720: make it easier to subclass and modify dis.ArgResolver's jump arg resolution (#115564) 2024-02-16 19:25:19 +00:00
Peter Lazorchak 13addd2bbd
gh-115480: Type / constant propagation for float binary uops (GH-115550)
Co-authored-by: Ken Jin <kenjin@python.org>
2024-02-17 02:02:48 +08:00
Sam Gross b24c9161a6
gh-112529: Make the GC scheduling thread-safe (#114880)
The GC keeps track of the number of allocations (less deallocations)
since the last GC. This buffers the count in thread-local state and uses
atomic operations to modify the per-interpreter count. The thread-local
buffering avoids contention on shared state.

A consequence is that the GC scheduling is not as precise, so
"test_sneaky_frame_object" is skipped because it requires that the GC be
run exactly after allocating a frame object.
2024-02-16 11:22:27 -05:00
Furkan Onder 2a7a0020c9
gh-69990: Make Profile.print_stats support sorting by multiple values (GH-104590)
Co-authored-by: Chiu-Hsiang Hsu
2024-02-16 12:03:46 +00:00
Erlend E. Aasland 58cb634632
gh-113317: Argument Clinic: move linear_format into libclinic (#115518) 2024-02-15 23:52:20 +01:00
Thomas Wouters 26f23daa1e Merge branch 'main' of https://github.com/python/cpython 2024-02-15 21:53:06 +01:00
monkeyman192 298bcdc185
gh-112433: Add optional _align_ attribute to ctypes.Structure (GH-113790) 2024-02-15 16:40:20 +02:00
Irit Katriel f42e112fd8
gh-115420: Fix translation of exception hander targets by _testinternalcapi.optimize_cfg. (#115425) 2024-02-15 14:32:52 +00:00
Irit Katriel 3a9e67a9fd
gh-115376: fix segfault in _testinternalcapi.compiler_codegen on bad input (#115379) 2024-02-15 14:32:21 +00:00
Irit Katriel 732faf17a6
gh-115347: avoid emitting redundant NOP for the docstring with -OO (#115494) 2024-02-15 14:20:19 +00:00
Thomas Wouters 9d34f60783 Python 3.13.0a4 2024-02-15 14:38:42 +01:00
T. Wouters b0e5c35ded
gh-115490: Work around test.support.interpreters.channels not handling unloading (#115515)
Work around test.support.interpreters.channels not handling unloading, which
regrtest does when running tests sequentially, by explicitly skipping the
unloading of test.support.interpreters and its submodules.

This can be rolled back once test.support.interpreters.channels supports
unloading, if we are keeping sequential runs in the same process around.
2024-02-15 14:24:13 +01:00
Erlend E. Aasland 7f074a771b
gh-113317: Argument Clinic: don't use global state in warn() and fail() (#115510) 2024-02-15 13:22:21 +01:00
Martijn Pieters edb59d5718
bpo-38364: unwrap partialmethods just like we unwrap partials (#16600)
* bpo-38364: unwrap partialmethods just like we unwrap partials

The inspect.isgeneratorfunction, inspect.iscoroutinefunction and inspect.isasyncgenfunction already unwrap functools.partial objects, this patch adds support for partialmethod objects as well.

Also: Rename _partialmethod to __partialmethod__.
Since we're checking this attribute on arbitrary function-like objects,
we should use the namespace reserved for core Python.

---------

Co-authored-by: Petr Viktorin <encukou@gmail.com>
2024-02-15 12:08:45 +01:00
Victor Stinner 3e7b7df5cb
gh-114570: Add PythonFinalizationError exception (#115352)
Add PythonFinalizationError exception. This exception derived from
RuntimeError is raised when an operation is blocked during the Python
finalization.

The following functions now raise PythonFinalizationError, instead of
RuntimeError:

* _thread.start_new_thread()
* subprocess.Popen
* os.fork()
* os.fork1()
* os.forkpty()

Morever, _winapi.Overlapped finalizer now logs an unraisable
PythonFinalizationError, instead of an unraisable RuntimeError.
2024-02-14 23:35:06 +01:00
Donghee Na a2d4281415
gh-112087: Make __sizeof__ and listiter_{len, next} to be threadsafe (gh-114843) 2024-02-15 02:00:50 +09:00
kcatss 671360161f
gh-115243: Fix crash in deque.index() when the deque is concurrently modified (GH-115247) 2024-02-14 16:08:26 +00:00
Brian Schubert bb791c7728
gh-115392: Fix doctest reporting incorrect line numbers for decorated functions (#115440) 2024-02-14 15:01:27 +00:00
Erlend E. Aasland 6d9141ed76
gh-100414: Make dbm.sqlite3 the preferred dbm backend (#115447) 2024-02-14 13:47:19 +00:00
Nikita Sobolev ec8909a239
gh-115450: Fix direct invocation of test_desctut (#115451) 2024-02-14 16:31:28 +03:00
Erlend E. Aasland 029ec91d43
gh-100414: Skip test_dbm_sqlite3 if sqlite3 is unavailable (#115449)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2024-02-14 13:16:09 +00:00