125339 Commits

Author SHA1 Message Date
Yan Yanchii
d3c54f3788
gh-126835: Fix reference leak in Python/flowgrapc.::optimize_if_const_subscr (#129634) 2025-02-04 10:38:06 +00:00
Yan Yanchii
0664c1af9b
gh-126835: Move constant subscript folding to CFG (#129568)
Move folding of constant subscription from AST optimizer to CFG.

Co-authored-by: Irit Katriel <1055913+iritkatriel@users.noreply.github.com>
2025-02-04 10:10:55 +02:00
donBarbos
bb5c6875d6
gh-111637: Clarify MIME type recognition behavior in mimetypes documentation (GH-129546) 2025-02-03 16:42:12 +00:00
Mark Shannon
75b628adeb
GH-128563: Generate opcode = ... in instructions that need opcode (GH-129608)
* Remove support for GO_TO_INSTRUCTION
2025-02-03 15:09:21 +00:00
Mark Shannon
808071b994
GH-128682: Make PyStackRef_CLOSE escaping. (GH-129404) 2025-02-03 12:41:32 +00:00
Victor Stinner
218f205f20
gh-129354: Use PyErr_FormatUnraisable() function (#129524)
Replace PyErr_WriteUnraisable() with PyErr_FormatUnraisable().

Update test_sqlite3 tests.

Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
2025-02-03 12:10:18 +00:00
Victor Stinner
04264a286e
gh-101944: Clarify PyModule_AddObjectRef() documentation (#129433) 2025-02-03 12:55:22 +01:00
Peter Bierma
39b754a359
gh-129407: Clarify that a SystemError isn't always CPython's fault (#129410) 2025-02-03 12:46:13 +01:00
Victor Stinner
632ca56821
gh-129342: Explain how to replace Py_GetProgramName() in C (#129361) 2025-02-03 12:36:41 +01:00
Illia Volochii
a33dcb9e43
gh-81340: Use copy_file_range in shutil.copyfile copy functions (GH-93152)
This allows the underlying file system an opportunity to optimise or avoid the actual copy.
2025-02-03 10:23:27 +00:00
Diego Russo
a29a9c0f38
GH-129231: Group executable JIT code in memory (GH-129232) 2025-02-02 15:19:55 -08:00
Diego Russo
567394517a
GH-128842: Collect JIT memory stats (GH-128941) 2025-02-02 15:17:53 -08:00
Yan Yanchii
e6c76b947b
GH-128872: Remove unused argument from _PyCode_Quicken (GH-128873)
Co-authored-by: Kirill Podoprigora <kirill.bast9@mail.ru>
2025-02-02 15:09:30 -08:00
Erlend E. Aasland
ecd2f84555
gh-105875: amend sqlite3 docstring wrt. SQLite requirement (#129599) 2025-02-02 23:03:54 +00:00
Victor Stinner
2ad069d906
gh-91417: Remove PySequence_Fast() from the limited C API (#129398)
The function never worked with the limited C API. It was added by
mistake.
2025-02-02 23:17:30 +01:00
Adam Turner
ae4788809d
GH-121970: Extract `misc_news` into a new extension (#129577) 2025-02-02 16:17:02 +00:00
Adam Turner
0612a89ffc
gh-126609: Allow translating the `availability` directive (#129549) 2025-02-02 16:12:01 +00:00
Vojtěch Boček
4e38eeafe2
gh-115514: Fix incomplete writes after close while using ssl in asyncio(#128037)
Co-authored-by: Kumar Aditya <kumaraditya@python.org>
2025-02-02 15:11:25 +00:00
Cody Maloney
853a6b7de2
Revert "gh-129005: Align FileIO.readall() allocation (#129458)" (#129572)
This reverts commit f927204f64b3f8dbecec784e05bc8e25d2a78b2e.
2025-02-02 15:59:15 +01:00
Adam Turner
237f186da4
gh-104400: Remove `fintl.gettext` from pygettext (#129580)
The ``fintl`` module is never installed or tested, meaning that the
fallback identity function is unconditionally used for ``_()``.
This means we can simplify, converting the docstring to a real
docstring, and converting some other strings to f-strings.

We also convert the module to UTF-8, sort imports,
and remove the history comment, which was last updated in 2002.
Consult the git history for a more accurate summary of changes.
2025-02-02 14:30:34 +00:00
Victor Stinner
df4a2f5bd7
gh-129539: Reorganize posixmodule.c header (#129558)
Add sections: Python includes, system includes, etc.

Add a comment explaining why an include is needed.
2025-02-02 09:16:48 +00:00
Gregory P. Smith
e1006ce1de
gh-119461: Restore the testSocket VSOCK skipUnless removed by PR #119465 (#129561)
Restore the skipUnless removed by #119465.

This test can only pass on virtual machines, not actual machines.

actual machines see:

```
    self.cli.connect((cid, VSOCKPORT))
    ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^
OSError: [Errno 19] No such device
```

Reproduced on (Linux) Ubuntu 24.04.1 running 6.8.0-52-generic.
2025-02-01 20:46:56 -08:00
Stan Ulbrych
cf4c4ecc26
gh-126022: Replace TeX quotation marks with `"` in Doc/license.rst (#129535) 2025-02-01 18:49:45 +02:00
Victor Stinner
71ae93374d
gh-93649: Move _testcapi tests to specific files (#129544)
Move many functions from _testcapimodule.c into more specific files
in Modules/_testcapi/.

In moved code:

* Replace get_testerror() with PyExc_AssertionError.
* Replace raiseTestError() with
  PyErr_Format(PyExc_AssertionError, ...).
2025-02-01 13:39:16 +01:00
Kirill Podoprigora
7d0521d5fc
gh-126835: Move optimization of constant sequence creation from codegen to CFG (#129426)
Codegen phase has an optimization that transforms
```
LOAD_CONST x
LOAD_CONST y
LOAD_CONXT z
BUILD_LIST/BUILD_SET (3)
```
->
```
BUILD_LIST/BUILD_SET (0)
LOAD_CONST (x, y, z)
LIST_EXTEND/SET_UPDATE 1
```
This optimization has now been moved to CFG phase to make #128802 work.


Co-authored-by: Irit Katriel <1055913+iritkatriel@users.noreply.github.com>
Co-authored-by: Yan Yanchii <yyanchiy@gmail.com>
2025-02-01 11:39:44 +00:00
Seth Michael Larson
d89a5f6a6e
gh-105704: Disallow square brackets ([ and ]) in domain names for parsed URLs (#129418)
* gh-105704: Disallow square brackets ( and ) in domain names for parsed URLs

* Use Sphinx references

Co-authored-by: Peter Bierma <zintensitydev@gmail.com>

* Add mismatched bracket test cases, fix news format

* Add more test coverage for ports

---------

Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
2025-01-31 09:41:34 -08:00
Mark Shannon
54f74b80ae
GH-128563: Move some labels, to simplify implementing tailcalling interpreter. (GH-129525) 2025-01-31 17:13:20 +00:00
Peter Bierma
9ba281d871
gh-128509: Add sys._is_immortal for identifying immortal objects (#128510)
Co-authored-by: Kumar Aditya <kumaraditya@python.org>
2025-01-31 15:27:08 +00:00
Victor Stinner
60a85415ae
gh-93649: Add Modules/_testcapi/function.c file (#129521)
* Move PyFunction C API tests to a new file.
* Add Lib/test/test_capi/test_function.py.
* Move tests from test_capi.test_misc to test_capi.test_function.
2025-01-31 16:02:50 +01:00
Valery Fedorenko
fad36bf382
gh-126108: Fix potential null pointer dereference in PySys_AddWarnOptionUnicode (#126118) 2025-01-31 20:06:30 +05:30
Pablo Galindo Salgado
7eaef74561
gh-129430: Make walking vm regions more efficient in MacOS (#129494) 2025-01-31 14:08:48 +00:00
Victor Stinner
79f85a0bc1
gh-129354: Use PyErr_FormatUnraisable() function (#129518)
Replace PyErr_WriteUnraisable() with PyErr_FormatUnraisable().
2025-01-31 15:06:14 +01:00
Victor Stinner
5424e3b034
gh-93649: Add Modules/_testcapi/type.c file (#129516)
Move PyType C API tests to a new file.

Move following tests from test_capi.test_misc to test_capi.test_type:

* BuiltinStaticTypesTests
* test_get_type_name()
* test_get_base_by_token()
2025-01-31 15:03:54 +01:00
Bénédikt Tran
881984b41a
gh-111178: fix UBSan failures in Modules/_sqlite (GH-129087)
* fix UBSan failures for `pysqlite_Blob`
* fix UBSan failures for `pysqlite_Connection`
* fix UBSan failures for `pysqlite_Cursor`
* fix UBSan failures for `pysqlite_PrepareProtocol`
* fix UBSan failures for `pysqlite_Row`
* fix UBSan failures for `pysqlite_Statement`

* suppress unused return values
2025-01-31 14:33:30 +01:00
Serhiy Storchaka
9d63ae5fe5
gh-129502: Fix handling errors in ctypes callbacks (GH-129504)
Unlikely errors in preparing arguments for ctypes callback are now
handled in the same way as errors raised in the callback of in converting
the result of the callback -- using sys.unraisablehook() instead of
sys.excepthook() and not setting sys.last_exc and other variables.
2025-01-31 15:30:19 +02:00
Victor Stinner
3447f4a56a
gh-129354: Use PyErr_FormatUnraisable() function (#129514)
Replace PyErr_WriteUnraisable() with PyErr_FormatUnraisable().
2025-01-31 14:20:35 +01:00
Victor Stinner
8b70ff5872
gh-93649: Move PyFrame C API tests to test_capi (#129512)
* Add Lib/test/test_capi/test_frame.py file.
* Move C API tests from test_frame to test_capi.test_frame.
* Add Modules/_testcapi/frame.c file.
* Move C API tests from _testcapimodule.c to frame.c
2025-01-31 13:51:58 +01:00
qm2k
22b2d37f42
gh-71494: string.Formatter: support keys/attributes in unnumbered fields (GH-21767) 2025-01-31 13:16:24 +01:00
Victor Stinner
0373926260
gh-129354: Use PyErr_FormatUnraisable() function (#129511)
Replace PyErr_WriteUnraisable() with PyErr_FormatUnraisable().
2025-01-31 13:16:08 +01:00
Mark Shannon
c3ae5c9e4a
GH-128563: Simplify recursion check in _PyEval_EvalFrameDefault (GH-129481)
Simplify recursion check in _PyEval_EvalFrameDefault
2025-01-31 12:12:24 +00:00
Petr Viktorin
31c82c28f9
GH-128469: Revert "warn when libpython was loaded from outside the build directory (#128645)" (#129506) 2025-01-31 11:17:37 +00:00
Brandt Bucher
674befbd7b
GH-129386: Add test.support.reset_code (GH-129486) 2025-01-31 11:50:54 +01:00
Michael Osipov
e3eba8ce26
gh-129393: Make 'sys.platform' return "freebsd" only on FreeBSD (#129394)
Make 'sys.platform' return "freebsd" only on FreeBSD without major version.
2025-01-31 10:02:45 +01:00
Shantanu
8df5193d37
gh-127975: Avoid reusing quote types in ast.unparse if not needed (#127980) 2025-01-31 08:49:06 +00:00
Victor Stinner
95504f429e
gh-129354: Fix grammar in PyErr_FormatUnraisable() (#129475)
Replace "on verb+ing" with "while verb+ing".
2025-01-31 09:45:35 +01:00
Cody Maloney
3ebe3d7688
Revert "gh-129005: _pyio.BufferedIO remove copy on readall (#129454)" (#129500)
This reverts commit e1c4ba928852eac0b0e0bded1c314e3e36975286.
2025-01-31 09:40:44 +01:00
Kumar Aditya
c07ac3c86a
gh-128452: fix warning in socketmodule.c (#129478) 2025-01-31 13:41:11 +05:30
Cody Maloney
10ee2d9d3b
gh-129205: Update multiprocessing.forkserver to use os.readinto() (#129425) 2025-01-30 22:24:52 +00:00
donBarbos
510fefdc62
gh-127349: Add check for correct resizing in REPL (#127387) 2025-01-30 19:34:09 +00:00
Victor Stinner
4ca9fc08f8
gh-111495: Add PyFile tests (#129449)
Add tests for the following functions in test_capi.test_file:

* PyFile_FromFd()
* PyFile_GetLine()
* PyFile_NewStdPrinter()
* PyFile_WriteObject()
* PyFile_WriteString()
* PyObject_AsFileDescriptor()

Add Modules/_testlimitedcapi/file.c file.

Remove test_embed.StdPrinterTests which became redundant.
2025-01-30 18:05:32 +01:00