Commit graph

56648 commits

Author SHA1 Message Date
Charlie Lin
467507a651
gh-145697: Add .sql and .sqlite3 recognition in mimetypes (GH-145698)
Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
Co-authored-by: Benedikt Johannes <benedikt.johannes.hofer@gmail.com>
2026-03-10 16:21:33 +01:00
Hugo van Kemenade
7fbdc8fb54 Merge branch 'main' of https://github.com/python/cpython 2026-03-10 16:41:02 +02:00
Steve Dower
ae0d2875bc
gh-145035: Allows removing the _pyrepl module to completely disable the modern REPL (GH-145159) 2026-03-10 14:58:32 +01:00
Matt Van Horn
2d35f9bc1c
gh-145492: Fix defaultdict __repr__ infinite recursion (GH-145659)
Co-Authored-By: Thomas Kowalski <thom.kowa@gmail.com>
2026-03-10 14:20:42 +01:00
Hugo van Kemenade
6024d3c6da Python 3.15.0a7 2026-03-10 14:31:15 +02:00
Kumar Aditya
728e4a075e
gh-142651: use NonCallableMock._lock for thread safety of call_count (#142922) 2026-03-10 12:11:12 +00:00
Hugo van Kemenade
368a26777a
gh-142927: Detect system theme in flame graph like in heatmap (#144885) 2026-03-10 13:38:48 +02:00
Sergey Miryanov
478a315b7a
GH-145247: Implement _PyTuple_FromPair() (#145325)
Implement _PyTuple_FromPair() and _PyTuple_FromPairSteal().

Co-authored-by: Pieter Eendebak <pieter.eendebak@gmail.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
Co-authored-by: Bartosz Sławecki <bartosz@ilikepython.com>
Co-authored-by: Kumar Aditya <kumaraditya@python.org>
2026-03-10 11:44:20 +01:00
Emma Smith
19676e5fc2
gh-145607: Ensure BIG_DATA has two compressed blocks in test_bz2 (#145730) 2026-03-10 11:21:57 +02:00
Hai Zhu
66eafc9ea7
gh-144681: Fix JIT trace builder assertion failure when conditional branch jump target coincides with fallthrough target (GH-144742) 2026-03-10 12:12:48 +08:00
Stan Ulbrych
63eaaf9599
gh-145701: Fix __classdict__ & __conditional_annotations__ in class-scope inlined comprehensions (GH-145702) 2026-03-09 12:56:41 -07:00
Stan Ulbrych
255e79fa95
gh-143055: Fix crash in AST unparser when unparsing dict comprehension unpacking (#145556) 2026-03-09 10:37:23 -07:00
Victor Stinner
0dfe649400
gh-141510: Optimize frozendict(frozendict) (#145592)
Return the same object unmodified if it's exactly the frozendict
type.

Optimize also PyFrozenDict_New(frozendict).
2026-03-09 15:47:02 +01:00
Daan De Meyer
1564e231aa
gh-145541: Fix InvalidStateError in BaseSubprocessTransport._call_connection_lost() (#145554) 2026-03-09 19:37:23 +05:30
Chris Eibl
b4460925a4
Fix intermittent test_ci_fuzz_stdlib failures (GH-145641) 2026-03-09 10:23:34 +01:00
Ramin Farajpour Cami
2cf6b2caad
gh-145623: Fix crashes on uninitialized struct.Struct objects (gh-145624) 2026-03-07 22:31:45 +09:00
Victor Stinner
9159287f58
gh-144175: Add PyArg_ParseArray() function (#144283)
Add PyArg_ParseArray() and PyArg_ParseArrayAndKeywords()
functions to parse arguments of functions using the METH_FASTCALL
calling convention.

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2026-03-06 21:57:44 +00:00
Victor Stinner
6c8c72f7fe
gh-145548: Use VMADDR_CID_LOCAL in VSOCK socket tests (#145589)
Prefer VMADDR_CID_LOCAL instead of VMADDR_CID_ANY for bind() in the
server. Skip the test if bind() fails with EADDRNOTAVAIL.

Log vsock CID in test.pythoninfo.
2026-03-06 16:51:36 +01:00
Benedikt Johannes
d931725bc8
gh-144370: Disallow usage of control characters in status in wsgiref.handlers for security (#144371)
Disallow usage of control characters in status in wsgiref.handlers
to prevent HTTP header injections.

Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
2026-03-06 13:22:21 +01:00
Victor Stinner
349639cfa4
gh-141510: Use frozendict in the stdlib (#144909)
Co-authored-by: Donghee Na <donghee.na@python.org>
2026-03-06 10:25:09 +01:00
Victor Stinner
4fce98a920
gh-141510: Change marshal version to 6 (#145551)
Fix SliceTestCase: test also that version 4 fails with ValueError.
2026-03-06 10:23:11 +01:00
Alex Malyshev
7232883adf
gh-145557: Check ctypes is available in test_external_inspection (#145558)
Currently TestGetStackTrace.test_self_trace_after_ctypes_import() will fail if
the _ctypes extension is not built.  Make it match test_ctypes by skipping
the test in that case.
2026-03-05 19:03:30 +00:00
Victor Stinner
0c29f83caa
gh-141510: No longer accept frozendict in PyDict_Copy() (#145542)
Rename _PyDict_Copy() to anydict_copy().

Replace PyObject_IsInstance(op, &PyFrozenDict_Type) with
PyFrozenDict_Check().
2026-03-05 15:26:54 +01:00
Shrey Naithani
dbe0007ab2
gh-145417: Do not preserve SELinux context when copying venv scripts (#145454)
Co-authored-by: Miro Hrončok <miro@hroncok.cz>
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
2026-03-05 15:19:49 +01:00
Victor Stinner
2cd0ddfe04
gh-141510: Fix frozendict.items() ^ frozendict.items() (#145535)
Add non-regression tests.
2026-03-05 14:14:04 +01:00
Victor Stinner
7bdfce0d3a
gh-145056: Accept frozendict in xml.etree (#145508)
Element and SubElement of xml.etree.ElementTree now also accept
frozendict for attrib.

Export _PyDict_CopyAsDict() function.
2026-03-05 12:55:28 +01:00
Victor Stinner
c0ecf211b2
gh-145055: Accept frozendict for globals in exec() and eval() (#145072) 2026-03-05 12:35:43 +01:00
Victor Stinner
c8aa8de9a5
gh-141510: Use frozendict in the _opcode_metadata (#144910)
Enhance py_metadata_generator.py to skip duplicates.

Co-authored-by: Donghee Na <donghee.na@python.org>
2026-03-05 12:33:13 +01:00
Victor Stinner
0fe20fc170
gh-141510: Don't accept frozendict in PyDict_Watch() (#145529)
Don't accept frozendict in PyDict_Watch() and PyDict_Unwatch().
A frozendict cannot be modified, so it's not useful to watch for
modifications.
2026-03-05 12:31:29 +01:00
Hood Chatham
23a4e3ba3c
gh-145335: Skip Emscripten for os.execve() test (#145528)
Emscripten's os.execve() always fails with ENOEXEC.

Co-authored-by: Victor Stinner <vstinner@python.org>
2026-03-05 12:29:34 +01:00
Victor Stinner
72b3e374a3
gh-141510: Add frozendict support to python-gdb.py (#145511) 2026-03-05 00:57:54 +01:00
Stan Ulbrych
ae208d5665
Fix bugs in compute-changes.py logic for CIFuzz (#145232) 2026-03-04 22:43:44 +02:00
Steve Dower
a51b1b512d
gh-145506: Fixes CVE-2026-2297 by ensuring SourcelessFileLoader uses io.open_code (GH-145507) 2026-03-04 19:55:52 +00:00
Victor Stinner
95f56b1206
gh-141510: Return frozendict unmodified in PyDict_Copy() (#145505)
Add also the internal _PyDict_CopyAsDict() function.
2026-03-04 19:11:00 +00:00
Itamar Oren
6cdbd7bc5d
gh-122941: Fix test_launcher sporadic failures via py.ini isolation (GH-145090)
Adds _PYLAUNCHER_INIDIR as a private variable since the launcher is deprecated and not getting new features.
2026-03-04 18:06:49 +00:00
Miro Hrončok
45e9343d7e
GH-144739: Skip test_pyexpat.MemoryProtectionTest based on expat compile-time version, not runtime (#144740) 2026-03-04 13:59:50 +01:00
Victor Stinner
31343cf2bc
gh-142417: Restore private _Py_InitializeMain() function (#145472)
This reverts commit 07c3518ffb.

Co-authored-by: Petr Viktorin <encukou@gmail.com>
2026-03-04 11:00:08 +01:00
Tan Long
745947cda0
gh-135883: Fix sqlite3 CLI history scrolling with colored prompts (#135884) 2026-03-03 19:48:03 +01:00
Bartosz Sławecki
e6c3c04fab
gh-145452: Initialize PyLazyImport_Type during interpreter startup (#145453)
Co-authored-by: Victor Stinner <vstinner@python.org>
2026-03-03 17:14:12 +01:00
bkap123
671a953dd6
gh-144475: Fix reference management in partial_repr (GH-145362) 2026-03-03 13:46:02 +00:00
Victor Stinner
52c8efa87d
gh-145335: Fix os functions when passing fd -1 as path (#145439)
os.listdir(-1) and os.scandir(-1) now fail with OSError(errno.EBADF)
rather than listing the current directory.

os.listxattr(-1) now fails with OSError(errno.EBADF) rather than
listing extended attributes of the current directory.
2026-03-03 13:57:08 +01:00
Victor Stinner
c9d123482a
gh-144995: Optimize memoryview == memoryview (#144996)
Optimize memoryview comparison: a memoryview is equal to itself, there is no
need to compare values, except if it uses float format.

Benchmark comparing 1 MiB:

    from timeit import timeit
    with open("/dev/random", 'br') as fp:
        data = fp.read(2**20)
    view = memoryview(data)
    LOOPS = 1_000
    b = timeit('x == x', number=LOOPS, globals={'x': data})
    m = timeit('x == x', number=LOOPS, globals={'x': view})
    print("bytes %f seconds" % b)
    print("mview %f seconds" % m)
    print("=> %f time slower" % (m / b))

Result before the change:

    bytes 0.000026 seconds
    mview 1.445791 seconds
    => 55660.873940 time slower

Result after the change:

    bytes 0.000026 seconds
    mview 0.000028 seconds
    => 1.104382 time slower

This missed optimization was discovered by Pierre-Yves David
while working on Mercurial.

Co-authored-by: Pieter Eendebak <pieter.eendebak@gmail.com>
2026-03-03 12:15:32 +01:00
Daniel Hollas
ea90b032a0
gh-117865: Speedup import of inspect module (#144756)
Co-authored-by: Alex Waygood <alex.waygood@gmail.com>
2026-03-02 23:39:07 +02:00
Filipe Laíns
f739e2ca62
Add sysconfig[VPATH] to test.pythoninfo (#145434) 2026-03-02 20:48:07 +00:00
Stan Ulbrych
f8d2f9fe67
gh-145118: Add frozendict support to type() (#145124) 2026-03-02 20:45:03 +01:00
Peter Bierma
592e8f0865
gh-130327: Always traverse managed dictionaries, even when inline values are available (#130469) 2026-03-02 14:32:06 -05:00
Filipe Laíns
3ab39d2308
GH-145273: warn when we can't find the standard library (#145274) 2026-03-02 18:51:45 +00:00
AN Long
5c3a47b94a
gh-145335: Fix crash when passing -1 as fd in os.pathconf (#145390)
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
2026-03-02 19:07:49 +01:00
Sam Gross
02288bf022
gh-130555: Fix use-after-free in dict.clear() with embedded values (gh-145268) 2026-03-02 12:25:13 -05:00
Steve Dower
1cf5abedeb
gh-145307: Defer loading psapi.dll until ctypes.util.dllist() is called. (GH-145308) 2026-03-02 17:10:15 +01:00