]> git.ipfire.org Git - thirdparty/Python/cpython.git/log
thirdparty/Python/cpython.git
2 years agogh-108494: Argument clinic: Improve the `parse_file()` API (#108575)
Alex Waygood [Mon, 28 Aug 2023 18:25:16 +0000 (19:25 +0100)] 
gh-108494: Argument clinic: Improve the `parse_file()` API (#108575)

Co-authored-by: Victor Stinner <vstinner@python.org>
2 years agogh-108487: Move assert(self != NULL) down beyond DEOPT_IF() (#108510)
Guido van Rossum [Mon, 28 Aug 2023 17:17:00 +0000 (10:17 -0700)] 
gh-108487: Move assert(self != NULL) down beyond DEOPT_IF() (#108510)

2 years agogh-108278: Deprecate passing the three first params as keyword args for sqlite3 UDF...
Erlend E. Aasland [Mon, 28 Aug 2023 13:32:07 +0000 (15:32 +0200)] 
gh-108278: Deprecate passing the three first params as keyword args for sqlite3 UDF creation APIs (#108281)

Deprecate passing name, number of arguments, and the callable as keyword
arguments, for the following sqlite3.Connection APIs:

- create_function(name, nargs, callable, ...)
- create_aggregate(name, nargs, callable)

The affected parameters will become positional-only in Python 3.15.

2 years agogh-108494: Argument Clinic: fix support of Limited C API (GH-108536)
Serhiy Storchaka [Mon, 28 Aug 2023 13:04:27 +0000 (16:04 +0300)] 
gh-108494: Argument Clinic: fix support of Limited C API (GH-108536)

2 years agogh-104683: Argument Clinic: Refactor the module and class resolver (#108552)
Erlend E. Aasland [Mon, 28 Aug 2023 12:41:05 +0000 (14:41 +0200)] 
gh-104683: Argument Clinic: Refactor the module and class resolver (#108552)

2 years agogh-108550: Speed up sqlite3 tests (#108551)
Erlend E. Aasland [Mon, 28 Aug 2023 12:17:34 +0000 (14:17 +0200)] 
gh-108550: Speed up sqlite3 tests (#108551)

Refactor the CLI so we can easily invoke it and mock command-line
arguments. Adapt the CLI tests so we no longer have to launch a
separate process.

Disable the busy handler for all concurrency tests; we have full
control over the order of the SQLite C API calls, so we can safely
do this.

The sqlite3 test suite now completes ~8 times faster than before.

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2 years agogh-64662: Fix NEWS entry and remove What's New entry (#108565)
Erlend E. Aasland [Mon, 28 Aug 2023 12:02:26 +0000 (14:02 +0200)] 
gh-64662: Fix NEWS entry and remove What's New entry (#108565)

2 years agoFix typo in typing docs: Remove redundant backtick (#108559)
nikkie [Mon, 28 Aug 2023 11:19:29 +0000 (20:19 +0900)] 
Fix typo in typing docs: Remove redundant backtick (#108559)

2 years agoGH-108202: Combine documentation of ``calendar`` constants (#108492)
Adam Turner [Mon, 28 Aug 2023 05:19:31 +0000 (06:19 +0100)] 
GH-108202: Combine documentation of ``calendar`` constants (#108492)

2 years agogh-64662: Add virtual table support to sqlite3.Connection.iterdump (#108340)
Erlend E. Aasland [Sun, 27 Aug 2023 22:18:32 +0000 (00:18 +0200)] 
gh-64662: Add virtual table support to sqlite3.Connection.iterdump (#108340)

Co-authored-by: Aviv Palivoda <palaviv@gmail.com>
2 years agogh-108465: Use compiler basename when determining compiler flags (#108392)
John Micco [Sun, 27 Aug 2023 21:07:09 +0000 (14:07 -0700)] 
gh-108465: Use compiler basename when determining compiler flags (#108392)

Note:
GNU Autoconf discourages the use of 'basename', and recommends 'expr' instead.

Co-authored-by: Erlend E. Aasland <erlend@python.org>
2 years agogh-107801: Document io.TextIOWrapper.tell (#108265)
Erlend E. Aasland [Sun, 27 Aug 2023 20:35:27 +0000 (22:35 +0200)] 
gh-107801: Document io.TextIOWrapper.tell (#108265)

2 years agogh-108542: Fix incorrect module name in NEWS entry for gh-105475 (#108543)
Ori Avtalion [Sun, 27 Aug 2023 19:50:59 +0000 (22:50 +0300)] 
gh-108542: Fix incorrect module name in NEWS entry for gh-105475 (#108543)

2 years agogh-108322: Optimize statistics.NormalDist.samples() (gh-108324)
Raymond Hettinger [Sun, 27 Aug 2023 13:59:40 +0000 (08:59 -0500)] 
gh-108322: Optimize statistics.NormalDist.samples() (gh-108324)

2 years agoClarify distinction between datetime module and class in deprecation messages (GH...
Clément Robert [Sun, 27 Aug 2023 13:09:40 +0000 (15:09 +0200)] 
Clarify distinction between datetime module and class in deprecation messages (GH-108073)

2 years agoFix grammatical error in stringprep documentation (#108414)
Matthew James Kraai [Sun, 27 Aug 2023 11:26:23 +0000 (04:26 -0700)] 
Fix grammatical error in stringprep documentation (#108414)

Remove the word "them", which didn't make grammatical sense.

Co-authored-by: KRAAI, MATTHEW [VISUS] <mkraai@its.jnj.com>
2 years agogh-105052:update timeit function's description (#105060)
R [Sun, 27 Aug 2023 07:22:27 +0000 (15:22 +0800)] 
gh-105052:update timeit function's description (#105060)

---------
Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
2 years agogh-107453: Document errno.{ECANCELED,EOWNERDEAD,ENOTRECOVERABLE,ENOTSUP} (#107486)
qqwqqw689 [Sun, 27 Aug 2023 05:19:49 +0000 (13:19 +0800)] 
gh-107453: Document errno.{ECANCELED,EOWNERDEAD,ENOTRECOVERABLE,ENOTSUP} (#107486)

Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2 years agogh-107265: Fix initialize/remove_tools for ENTER_EXECUTOR case (gh-108482)
Dong-hee Na [Sun, 27 Aug 2023 03:31:29 +0000 (12:31 +0900)] 
gh-107265: Fix initialize/remove_tools for ENTER_EXECUTOR case (gh-108482)

2 years agogh-108295: Fix crashes with TypeVar weakrefs (#108517)
Jelle Zijlstra [Sun, 27 Aug 2023 00:13:33 +0000 (17:13 -0700)] 
gh-108295: Fix crashes with TypeVar weakrefs (#108517)

2 years agogh-107913: Fix possible losses of OSError error codes (GH-107930)
Serhiy Storchaka [Sat, 26 Aug 2023 21:35:06 +0000 (00:35 +0300)] 
gh-107913: Fix possible losses of OSError error codes (GH-107930)

Functions like PyErr_SetFromErrno() and SetFromWindowsErr() should be
called immediately after using the C API which sets errno or the Windows
error code.

2 years agogh-107406: Add better `struct.Struct` repr (#107407)
denballakh [Sat, 26 Aug 2023 09:54:16 +0000 (14:54 +0500)] 
gh-107406: Add better `struct.Struct` repr (#107407)

2 years agogh-106320: Remove private AC converter functions (#108505)
Victor Stinner [Sat, 26 Aug 2023 02:05:17 +0000 (04:05 +0200)] 
gh-106320: Remove private AC converter functions (#108505)

Move these private functions to the internal C API
(pycore_abstract.h):

* _Py_convert_optional_to_ssize_t()
* _PyNumber_Index()

Argument Clinic now emits #include "pycore_abstract.h" when these
functions are used.

The parser of the c-analyzer tool now uses a list of files which use
the limited C API, rather than a list of files using the internal C
API.

2 years agogh-106320: Remove private _PyLong_FileDescriptor_Converter() (#108503)
Victor Stinner [Sat, 26 Aug 2023 01:18:09 +0000 (03:18 +0200)] 
gh-106320: Remove private _PyLong_FileDescriptor_Converter() (#108503)

Move the private _PyLong converter functions to the internal C API

* _PyLong_FileDescriptor_Converter(): moved to pycore_fileutils.h
* _PyLong_Size_t_Converter(): moved to pycore_long.h

Argument Clinic now emits includes for pycore_fileutils.h and
pycore_long.h when these functions are used.

2 years agogh-106320: Remove private _PyLong converter functions (#108499)
Victor Stinner [Sat, 26 Aug 2023 00:24:27 +0000 (02:24 +0200)] 
gh-106320: Remove private _PyLong converter functions (#108499)

Move these private functions to the internal C API (pycore_long.h):

* _PyLong_UnsignedInt_Converter()
* _PyLong_UnsignedLongLong_Converter()
* _PyLong_UnsignedLong_Converter()
* _PyLong_UnsignedShort_Converter()

Argument Clinic now emits #include "pycore_long.h" when these
functions are used.

2 years agogh-108494: AC supports pos-only args in limited C API (#108498)
Victor Stinner [Fri, 25 Aug 2023 22:39:24 +0000 (00:39 +0200)] 
gh-108494: AC supports pos-only args in limited C API (#108498)

AC now checks for "#define Py_LIMITED_API" pattern to use the limited
C API.

2 years agogh-107603: Argument Clinic can emit includes (#108486)
Victor Stinner [Fri, 25 Aug 2023 22:01:10 +0000 (00:01 +0200)] 
gh-107603: Argument Clinic can emit includes (#108486)

* Add Clinic.add_include() method
* Add CConverter.include and CConverter.add_include()
* Printer.print_block() gets a second parameter: clinic.
* Remove duplicated declaration of "clinic" global variable.

2 years agogh-108494: Argument Clinic partial supports of Limited C API (#108495)
Victor Stinner [Fri, 25 Aug 2023 21:22:08 +0000 (23:22 +0200)] 
gh-108494: Argument Clinic partial supports of Limited C API (#108495)

Argument Clinic now has a partial support of the
Limited API:

* Add --limited option to clinic.c.
* Add '_testclinic_limited' extension which is built with
  the limited C API version 3.13.
* For now, hardcode in clinic.py that "_testclinic_limited.c" targets
  the limited C API.

2 years agoGH-106581: Fix instrumentation in tier 2 (GH-108493)
Brandt Bucher [Fri, 25 Aug 2023 19:12:59 +0000 (12:12 -0700)] 
GH-106581: Fix instrumentation in tier 2 (GH-108493)

2 years agogh-107901: add the HAS_EVAL_BREAK instruction flag (#108375)
Irit Katriel [Fri, 25 Aug 2023 18:33:59 +0000 (19:33 +0100)] 
gh-107901: add the HAS_EVAL_BREAK instruction flag (#108375)

2 years agogh-104504: Cases generator: enable mypy's `possibly-undefined` error code (#108454)
Alex Waygood [Fri, 25 Aug 2023 17:08:29 +0000 (18:08 +0100)] 
gh-104504: Cases generator: enable mypy's `possibly-undefined` error code (#108454)

2 years agogh-102211: Document `re.{Pattern,Match}`’s existence (#102212)
Philipp A [Fri, 25 Aug 2023 16:53:11 +0000 (18:53 +0200)] 
gh-102211: Document `re.{Pattern,Match}`’s existence (#102212)

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2 years agogh-108311: Fix test_store_attr_with_hint by disabling optimizer in decorator (#108312)
Guido van Rossum [Fri, 25 Aug 2023 16:40:27 +0000 (09:40 -0700)] 
gh-108311: Fix test_store_attr_with_hint by disabling optimizer in decorator (#108312)

See https://github.com/python/cpython/issues/108311#issuecomment-1693569380

---------

Co-authored-by: AlexWaygood <alex.waygood@gmail.com>
2 years agogh-107265: Revert "Ensure _PyCode_Quicken does not handle ENTER_EXECUTOR" (#108485)
Dong-hee Na [Fri, 25 Aug 2023 15:23:39 +0000 (00:23 +0900)] 
gh-107265: Revert "Ensure _PyCode_Quicken does not handle ENTER_EXECUTOR" (#108485)

This reverts commit d6ac5c7b105fe57266bd71248e3ada41fedb5ba9.

Reason: the assert we just added could be triggered (see issue).

2 years agogh-108364: Simplify quoting values and identifiers in sqlite3's iterdump() (#108472)
Mariusz Felisiak [Fri, 25 Aug 2023 12:31:52 +0000 (14:31 +0200)] 
gh-108364: Simplify quoting values and identifiers in sqlite3's iterdump() (#108472)

2 years agogh-107932: Fix merge conflict in test_dis (GH-108478)
Mark Shannon [Fri, 25 Aug 2023 12:02:10 +0000 (13:02 +0100)] 
gh-107932: Fix merge conflict in test_dis (GH-108478)

Fix merge conflict in test_dis

2 years agoDocs: Resolve Sphinx warnings in dis.rst (#108476)
Erlend E. Aasland [Fri, 25 Aug 2023 11:28:47 +0000 (13:28 +0200)] 
Docs: Resolve Sphinx warnings in dis.rst (#108476)

- Link to the code objects reference
- Suppress link to deliberately undocumented builtins.__build_class__
- Suppress links for example methods

2 years agoDatamodel: Add headings to the standard type hierarchy (#108146)
Adam Turner [Fri, 25 Aug 2023 11:02:36 +0000 (12:02 +0100)] 
Datamodel: Add headings to the standard type hierarchy (#108146)

Dedent content according to the new layout.

2 years agoDocs: Datamodel: Merge "Notes on using __slots__" with the parent section (#108400)
Adam Turner [Fri, 25 Aug 2023 10:27:36 +0000 (11:27 +0100)] 
Docs: Datamodel: Merge "Notes on using __slots__" with the parent section (#108400)

2 years agogh-108418: Speed up bigmem compression tests in dry mode (GH-108419)
Serhiy Storchaka [Fri, 25 Aug 2023 09:37:27 +0000 (12:37 +0300)] 
gh-108418: Speed up bigmem compression tests in dry mode (GH-108419)

Only generate and compress small amount of random data in dry run.

2 years agogh-108444: Remove _PyLong_AsInt() function (#108461)
Victor Stinner [Fri, 25 Aug 2023 09:13:59 +0000 (11:13 +0200)] 
gh-108444: Remove _PyLong_AsInt() function (#108461)

* Update Parser/asdl_c.py to regenerate Python/Python-ast.c.
* Remove _PyLong_AsInt() alias to PyLong_AsInt().

2 years agogh-107932: Fix dis module for bytecode that does not have an associated source line...
Corvin [Fri, 25 Aug 2023 08:31:26 +0000 (04:31 -0400)] 
gh-107932: Fix dis module for bytecode that does not have an associated source line (GH-107988)

2 years agogh-103384: Generalize the regex pattern `BaseConfigurator.INDEX_PATTERN` to allow...
Peeyush Aggarwal [Fri, 25 Aug 2023 08:15:26 +0000 (13:45 +0530)] 
gh-103384: Generalize the regex pattern `BaseConfigurator.INDEX_PATTERN` to allow spaces and non-alphanumeric characters in keys. (GH-103391)

Co-authored-by: Vinay Sajip <vinay_sajip@yahoo.co.uk>
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
Co-authored-by: Erlend E. Aasland <erlend@python.org>
2 years agoGH-108202: Document ``calendar`` exceptions (#108398)
Adam Turner [Fri, 25 Aug 2023 05:56:54 +0000 (06:56 +0100)] 
GH-108202: Document ``calendar`` exceptions (#108398)

2 years agogh-106581: Split CALL_BOUND_METHOD_EXACT_ARGS into uops (#108462)
Guido van Rossum [Fri, 25 Aug 2023 00:36:00 +0000 (17:36 -0700)] 
gh-106581: Split CALL_BOUND_METHOD_EXACT_ARGS into uops (#108462)

Instead of using `GO_TO_INSTRUCTION(CALL_PY_EXACT_ARGS)` we just add the macro elements of the latter to the macro for the former. This requires lengthening the uops array in struct opcode_macro_expansion. (It also required changes to stacking.py that were merged already.)

2 years agogh-106320: Remove private _PyTraceback functions (#108453)
Victor Stinner [Thu, 24 Aug 2023 23:35:47 +0000 (01:35 +0200)] 
gh-106320: Remove private _PyTraceback functions (#108453)

Move private functions to the internal C API (pycore_traceback.h):

* _Py_DisplaySourceLine()
* _PyTraceback_Add()

2 years agogh-107265: Ensure _PyCode_Quicken does not handle ENTER_EXECUTOR (gh-108460)
Dong-hee Na [Thu, 24 Aug 2023 23:03:26 +0000 (08:03 +0900)] 
gh-107265: Ensure _PyCode_Quicken does not handle ENTER_EXECUTOR (gh-108460)

2 years agogh-108444: Replace _PyLong_AsInt() with PyLong_AsInt() (#108459)
Victor Stinner [Thu, 24 Aug 2023 23:01:30 +0000 (01:01 +0200)] 
gh-108444: Replace _PyLong_AsInt() with PyLong_AsInt() (#108459)

Change generated by the command:

sed -i -e 's!_PyLong_AsInt!PyLong_AsInt!g' \
    $(find -name "*.c" -o -name "*.h")

2 years agogh-108444: Argument Clinic uses PyLong_AsInt() (#108458)
Victor Stinner [Thu, 24 Aug 2023 22:51:22 +0000 (00:51 +0200)] 
gh-108444: Argument Clinic uses PyLong_AsInt() (#108458)

Argument Clinic now uses the new public PyLong_AsInt(), rather than
the old name _PyLong_AsInt().

2 years agoRun `mypy` when `Tools/requirements-dev.txt` changes (#108457)
Nikita Sobolev [Thu, 24 Aug 2023 22:05:23 +0000 (01:05 +0300)] 
Run `mypy` when `Tools/requirements-dev.txt` changes (#108457)

2 years agogh-108444: Add PyLong_AsInt() public function (#108445)
Victor Stinner [Thu, 24 Aug 2023 21:55:30 +0000 (23:55 +0200)] 
gh-108444: Add PyLong_AsInt() public function (#108445)

* Rename _PyLong_AsInt() to PyLong_AsInt().
* Add documentation.
* Add test.
* For now, keep _PyLong_AsInt() as an alias to PyLong_AsInt().

2 years agoGH-103247: bypass the import cache on the _require_loader helper
Filipe Laíns [Thu, 24 Aug 2023 21:05:03 +0000 (22:05 +0100)] 
GH-103247: bypass the import cache on the _require_loader helper

2 years agogh-108447: Detect platform triplets for x86_64 GNU/Hurd (#108045)
Samuel Thibault [Thu, 24 Aug 2023 20:37:20 +0000 (22:37 +0200)] 
gh-108447: Detect platform triplets for x86_64 GNU/Hurd (#108045)

2 years agogh-106320: Remove private _PySys functions (#108452)
Victor Stinner [Thu, 24 Aug 2023 20:02:09 +0000 (22:02 +0200)] 
gh-106320: Remove private _PySys functions (#108452)

Move private functions to the internal C API (pycore_sysmodule.h):

* _PySys_GetAttr()
* _PySys_GetSizeOf()

No longer export most of these functions.

Fix also a typo in Include/cpython/optimizer.h: add a missing space.

2 years agogh-106320: Remove private _PyDict functions (#108449)
Victor Stinner [Thu, 24 Aug 2023 20:01:50 +0000 (22:01 +0200)] 
gh-106320: Remove private _PyDict functions (#108449)

Move private functions to the internal C API (pycore_dict.h):

* _PyDictView_Intersect()
* _PyDictView_New()
* _PyDict_ContainsId()
* _PyDict_DelItemId()
* _PyDict_DelItem_KnownHash()
* _PyDict_GetItemIdWithError()
* _PyDict_GetItem_KnownHash()
* _PyDict_HasSplitTable()
* _PyDict_NewPresized()
* _PyDict_Next()
* _PyDict_Pop()
* _PyDict_SetItemId()
* _PyDict_SetItem_KnownHash()
* _PyDict_SizeOf()

No longer export most of these functions.

Move also the _PyDictViewObject structure to the internal C API.

Move dict_getitem_knownhash() function from _testcapi to the
_testinternalcapi extension. Update test_capi.test_dict for this
change.

2 years agogh-106320: Remove private _PyList functions (#108451)
Victor Stinner [Thu, 24 Aug 2023 19:44:34 +0000 (21:44 +0200)] 
gh-106320: Remove private _PyList functions (#108451)

Move private functions to the internal C API (pycore_list.h):

* _PyList_Extend()
* _PyList_DebugMallocStats()

No longer export these functions.

2 years agogh-106581: Fix two bugs in the code generator's copy optimization (#108380)
Guido van Rossum [Thu, 24 Aug 2023 19:10:51 +0000 (12:10 -0700)] 
gh-106581: Fix two bugs in the code generator's copy optimization (#108380)

I was comparing the last preceding poke with the *last* peek,
rather than the *first* peek.

Unfortunately this bug obscured another bug:
When the last preceding poke is UNUSED, the first peek disappears,
leaving the variable unassigned. This is how I fixed it:

- Rename CopyEffect to CopyItem.
- Change CopyItem to contain StackItems instead of StackEffects.
- Update those StackItems when adjusting the manager higher or lower.
- Assert that those StackItems' offsets are equivalent.
- Other clever things.

---------

Co-authored-by: Irit Katriel <1055913+iritkatriel@users.noreply.github.com>
2 years agogh-106320: Remove private _PyEval function (#108433)
Victor Stinner [Thu, 24 Aug 2023 18:25:22 +0000 (20:25 +0200)] 
gh-106320: Remove private _PyEval function (#108433)

Move private _PyEval functions to the internal C API
(pycore_ceval.h):

* _PyEval_GetBuiltin()
* _PyEval_GetBuiltinId()
* _PyEval_GetSwitchInterval()
* _PyEval_MakePendingCalls()
* _PyEval_SetProfile()
* _PyEval_SetSwitchInterval()
* _PyEval_SetTrace()

No longer export most of these functions.

2 years agogh-80527: Change support.requires_legacy_unicode_capi() (#108438)
Victor Stinner [Thu, 24 Aug 2023 18:09:23 +0000 (20:09 +0200)] 
gh-80527: Change support.requires_legacy_unicode_capi() (#108438)

The decorator now requires to be called with parenthesis:

    @support.requires_legacy_unicode_capi()

instead of:

    @support.requires_legacy_unicode_capi

The implementation now only imports _testcapi when the decorator is
called, so "import test.support" no longer imports the _testcapi
extension.

2 years agogh-107211: Fix test_peg_generator (#108435)
Victor Stinner [Thu, 24 Aug 2023 17:47:44 +0000 (19:47 +0200)] 
gh-107211: Fix test_peg_generator (#108435)

Export these internal functions for test_peg_generator

* _PyArena_AddPyObject()
* _PyArena_Free()
* _PyArena_Malloc()
* _PyArena_New()

2 years agogh-107178: Remove _testcapi.test_dict_capi() (#108436)
Victor Stinner [Thu, 24 Aug 2023 17:43:29 +0000 (19:43 +0200)] 
gh-107178: Remove _testcapi.test_dict_capi() (#108436)

The new _testcapi.test_dict tests are more complete,
_testcapi.test_dict_capi() became redundant.

2 years agogh-106320: Remove private _PyContext_NewHamtForTests() (#108434)
Victor Stinner [Thu, 24 Aug 2023 17:37:41 +0000 (19:37 +0200)] 
gh-106320: Remove private _PyContext_NewHamtForTests() (#108434)

Move the function to the internal C API.

2 years agogh-108388: Convert test_concurrent_futures to package (#108401)
Victor Stinner [Thu, 24 Aug 2023 17:21:44 +0000 (19:21 +0200)] 
gh-108388: Convert test_concurrent_futures to package (#108401)

Convert test_concurrent_futures to a package of sub-tests.

2 years agogh-106320: Remove private float C API functions (#108430)
Victor Stinner [Thu, 24 Aug 2023 17:09:49 +0000 (19:09 +0200)] 
gh-106320: Remove private float C API functions (#108430)

106320: Remove private float C API functions

Remove private C API functions:

* _Py_parse_inf_or_nan()
* _Py_string_to_number_with_underscores()

Move these functions to the internal C API and no longer export them.

2 years agogh-106320: Remove private _PyManagedBuffer_Type (#108431)
Victor Stinner [Thu, 24 Aug 2023 17:07:54 +0000 (19:07 +0200)] 
gh-106320: Remove private _PyManagedBuffer_Type (#108431)

Remove private _PyManagedBuffer_Type variable. Move it to the
internal C API and no longer export it.

2 years agogh-106320: Remove private PyLong C API functions (#108429)
Victor Stinner [Thu, 24 Aug 2023 16:53:50 +0000 (18:53 +0200)] 
gh-106320: Remove private PyLong C API functions (#108429)

Remove private PyLong C API functions:

* _PyLong_AsByteArray()
* _PyLong_DivmodNear()
* _PyLong_Format()
* _PyLong_Frexp()
* _PyLong_FromByteArray()
* _PyLong_FromBytes()
* _PyLong_GCD()
* _PyLong_Lshift()
* _PyLong_Rshift()

Move these functions to the internal C API. No longer export
_PyLong_FromBytes() function.

2 years agoFix a code snippet typo in asyncio docs (#108427)
A [Thu, 24 Aug 2023 16:27:54 +0000 (00:27 +0800)] 
Fix a code snippet typo in asyncio docs (#108427)

2 years agogh-107211: No longer export internal functions (5) (#108423)
Victor Stinner [Thu, 24 Aug 2023 16:06:53 +0000 (18:06 +0200)] 
gh-107211: No longer export internal functions (5) (#108423)

No longer export _PyCompile_AstOptimize() internal C API function.

Change comment style to "// comment" and add comment explaining why
other functions have to be exported.

2 years agogh-107211: No longer export internal functions (7) (#108425)
Victor Stinner [Thu, 24 Aug 2023 15:40:56 +0000 (17:40 +0200)] 
gh-107211: No longer export internal functions (7) (#108425)

No longer export _PyUnicode_FromId() internal C API function.

Change comment style to "// comment" and add comment explaining why
other functions have to be exported.

Update Tools/build/generate_token.py to update Include/internal/pycore_token.h
comments.

2 years agogh-108308: Remove _PyDict_GetItemStringWithError() function (#108426)
Victor Stinner [Thu, 24 Aug 2023 15:34:22 +0000 (17:34 +0200)] 
gh-108308: Remove _PyDict_GetItemStringWithError() function (#108426)

Remove the internal _PyDict_GetItemStringWithError() function. It can
now be replaced with the new public PyDict_ContainsString() and
PyDict_GetItemStringRef() functions.

getargs.c now now uses a strong reference for current_arg.
find_keyword() returns a strong reference.

2 years agogh-107211: No longer export internal functions (6) (#108424)
Victor Stinner [Thu, 24 Aug 2023 15:28:35 +0000 (17:28 +0200)] 
gh-107211: No longer export internal functions (6) (#108424)

No longer export these 5 internal C API functions:

* _PyArena_AddPyObject()
* _PyArena_Free()
* _PyArena_Malloc()
* _PyArena_New()
* _Py_FatalRefcountErrorFunc()

Change comment style to "// comment" and add comment explaining why
other functions have to be exported.

2 years agogh-107211: No longer export PyTime internal functions (#108422)
Victor Stinner [Thu, 24 Aug 2023 15:17:40 +0000 (17:17 +0200)] 
gh-107211: No longer export PyTime internal functions (#108422)

No longer export these 2 internal C API functions:

* _PyTime_AsNanoseconds()
* _PyTime_GetSystemClockWithInfo()

Change comment style to "// comment" and add comment explaining why
other functions have to be exported.

2 years agogh-108240: _PyCapsule_SetTraverse() rejects NULL callbacks (#108417)
Victor Stinner [Thu, 24 Aug 2023 14:37:59 +0000 (16:37 +0200)] 
gh-108240: _PyCapsule_SetTraverse() rejects NULL callbacks (#108417)

2 years agogh-108314: Add PyDict_ContainsString() function (#108323)
Victor Stinner [Thu, 24 Aug 2023 13:59:12 +0000 (15:59 +0200)] 
gh-108314: Add PyDict_ContainsString() function (#108323)

2 years agogh-95855: Refactor platform triplet detection code, add detection for MIPS soft float...
Jeffery To [Thu, 24 Aug 2023 12:22:50 +0000 (20:22 +0800)] 
gh-95855: Refactor platform triplet detection code, add detection for MIPS soft float and musl libc (#107221)

- Move platform triplet detection code into Misc/platform_triplet.c
- Refactor MIPS detection, use defined(__mips64) to detect MIPS64
- Compute libc values in separate section
- Add detection for MIPS soft float
- Add detection for musl

musl supports SPE with its soft-float ABI:
https://git.musl-libc.org/cgit/musl/commit/?id=7be59733d71ada3a32a98622507399253f1d5e48

Original patch by Christian Heimes.

Co-authored-by: Christian Heimes <christian@python.org>
Co-authored-by: Erlend E. Aasland <erlend@python.org>
2 years agogh-107432 Update Porting Python 2 Code to Python 3 how-to (GH-107434)
Daniele Procida [Thu, 24 Aug 2023 09:28:23 +0000 (11:28 +0200)] 
gh-107432 Update Porting Python 2 Code to Python 3 how-to (GH-107434)

https://docs.python.org/3/howto/pyporting.html#porting-python-2-code-to-python-3 was written for another time. In this patch:

- material that frames Python 3 as "new" is removed
- descriptions and directions have been trimmed

2 years agogh-108111: Flush gzip write buffer before seeking, fixing bad writes (#108341)
Chris Markiewicz [Thu, 24 Aug 2023 08:23:01 +0000 (04:23 -0400)] 
gh-108111: Flush gzip write buffer before seeking, fixing bad writes (#108341)

Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2 years agogh-108388: Split test_multiprocessing_spawn (#108396)
Victor Stinner [Thu, 24 Aug 2023 03:35:39 +0000 (05:35 +0200)] 
gh-108388: Split test_multiprocessing_spawn (#108396)

Split test_multiprocessing_fork, test_multiprocessing_forkserver and
test_multiprocessing_spawn into test packages. Each package is made
of 4 sub-tests: processes, threads, manager and misc. It allows
running more tests in parallel and so reduce the total test duration.

2 years agogh-108388: regrtest splits test_asyncio package (#108393)
Victor Stinner [Thu, 24 Aug 2023 02:44:58 +0000 (04:44 +0200)] 
gh-108388: regrtest splits test_asyncio package (#108393)

Currently, test_asyncio package is only splitted into sub-tests when
using command "./python -m test". With this change, it's also
splitted when passing it on the command line:
"./python -m test test_asyncio".

Remove the concept of "STDTESTS". Python is now mature enough to not
have to bother with that anymore. Removing STDTESTS simplify the
code.

2 years agotest_peg_generator and test_freeze require cpu (#108386)
Victor Stinner [Wed, 23 Aug 2023 22:52:48 +0000 (00:52 +0200)] 
test_peg_generator and test_freeze require cpu (#108386)

The test_peg_generator and test_tools.test_freeze tests now require
the 'cpu' resource. Skip these tests unless the 'cpu' resource is
enabled (it is disabled by default).

These tests are no longer skipped if Python is built with ASAN or
MSAN sanitizer.

2 years agogh-108253: Fix reads of uninitialized memory in funcobject.c (#108383)
Guido van Rossum [Wed, 23 Aug 2023 22:36:19 +0000 (15:36 -0700)] 
gh-108253: Fix reads of uninitialized memory in funcobject.c (#108383)

2 years agogh-108240: Add _PyCapsule_SetTraverse() internal function (#108339)
Victor Stinner [Wed, 23 Aug 2023 22:19:11 +0000 (00:19 +0200)] 
gh-108240: Add _PyCapsule_SetTraverse() internal function (#108339)

The _socket extension uses _PyCapsule_SetTraverse() to visit and clear
the socket type in the garbage collector. So the _socket.socket type
can be cleared in some corner cases when it wasn't possible before.

2 years agogh-70766: Mention the object getstate caveat in 3.11 What's new. (#108379)
Gregory P. Smith [Wed, 23 Aug 2023 22:00:09 +0000 (15:00 -0700)] 
gh-70766: Mention the object getstate caveat in 3.11 What's new. (#108379)

2 years agogh-108308: Use PyDict_GetItemRef() in moduleobject.c (#108381)
Victor Stinner [Wed, 23 Aug 2023 21:57:40 +0000 (23:57 +0200)] 
gh-108308: Use PyDict_GetItemRef() in moduleobject.c (#108381)

Replace PyDict_GetItemWithError() with PyDict_GetItemRef() which
returns a strong reference.

Cleanup also the function: move variable definition to their first
assignation, rename variable names to use name longer than 1
character.

2 years agogh-108342: Make ssl TestPreHandshakeClose more reliable (#108370)
Victor Stinner [Wed, 23 Aug 2023 21:57:11 +0000 (23:57 +0200)] 
gh-108342: Make ssl TestPreHandshakeClose more reliable (#108370)

* In preauth tests of test_ssl, explicitly break reference cycles
  invoving SingleConnectionTestServerThread to make sure that the
  thread is deleted. Otherwise, the test marks the environment as
  altered because the threading module sees a "dangling thread"
  (SingleConnectionTestServerThread). This test leak was introduced
  by the test added for the fix of issue gh-108310.
* Use support.SHORT_TIMEOUT instead of hardcoded 1.0 or 2.0 seconds
  timeout.
* SingleConnectionTestServerThread.run() catchs TimeoutError
* Fix a race condition (missing synchronization) in
  test_preauth_data_to_tls_client(): the server now waits until the
  client connect() completed in call_after_accept().
* test_https_client_non_tls_response_ignored() calls server.join()
  explicitly.
* Replace "localhost" with server.listener.getsockname()[0].

2 years agogh-108308: config_dict_get() uses PyDict_GetItemRef() (#108371)
Victor Stinner [Wed, 23 Aug 2023 21:12:08 +0000 (23:12 +0200)] 
gh-108308: config_dict_get() uses PyDict_GetItemRef() (#108371)

Replace _PyDict_GetItemStringWithError() with PyDict_GetItemRef() in
config_dict_get() to get a strong reference to the item.

2 years agogh-108308: Replace _PyDict_GetItemStringWithError() (#108372)
Victor Stinner [Wed, 23 Aug 2023 20:59:00 +0000 (22:59 +0200)] 
gh-108308: Replace _PyDict_GetItemStringWithError() (#108372)

Replace _PyDict_GetItemStringWithError() calls with
PyDict_GetItemStringRef() which returns a strong reference to the
item.

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2 years agogh-77377: Ensure multiprocessing SemLock is valid for spawn-based Process before...
albanD [Wed, 23 Aug 2023 20:27:35 +0000 (16:27 -0400)] 
gh-77377: Ensure multiprocessing SemLock is valid for spawn-based Process before serializing it (#107275)

Ensure multiprocessing SemLock is valid for spawn Process before serializing it.

Creating a multiprocessing SemLock with a fork context, and then trying to pass it to a spawn-created Process, would segfault if not detected early.

---------

Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Co-authored-by: Antoine Pitrou <pitrou@free.fr>
2 years agogh-107811: tarfile: treat overflow in UID/GID as failure to set it (#108369)
Petr Viktorin [Wed, 23 Aug 2023 18:00:07 +0000 (20:00 +0200)] 
gh-107811: tarfile: treat overflow in UID/GID as failure to set it (#108369)

2 years agogh-105481: remove regen-opcode. Generated _PyOpcode_Caches in regen-cases. (#108367)
Irit Katriel [Wed, 23 Aug 2023 17:39:00 +0000 (18:39 +0100)] 
gh-105481: remove regen-opcode. Generated _PyOpcode_Caches in regen-cases. (#108367)

2 years agogh-107298: Fix a few more refs in the C API docs (GH-108361)
Serhiy Storchaka [Wed, 23 Aug 2023 17:12:42 +0000 (20:12 +0300)] 
gh-107298: Fix a few more refs in the C API docs (GH-108361)

gh-107298: Fix few more refs in the C API docs

2 years agogh-107265: Ensure de_instrument does not handle ENTER_EXECUTOR (#108366)
Dong-hee Na [Wed, 23 Aug 2023 15:45:20 +0000 (00:45 +0900)] 
gh-107265: Ensure de_instrument does not handle ENTER_EXECUTOR (#108366)

2 years agogh-108303: Move `ann_module*.py` files to `typinganndata/` folder (#108354)
Nikita Sobolev [Wed, 23 Aug 2023 15:42:08 +0000 (18:42 +0300)] 
gh-108303: Move `ann_module*.py` files to `typinganndata/` folder (#108354)

2 years agogh-108308: Replace PyDict_GetItem() with PyDict_GetItemRef() (#108309)
Victor Stinner [Wed, 23 Aug 2023 15:40:26 +0000 (17:40 +0200)] 
gh-108308: Replace PyDict_GetItem() with PyDict_GetItemRef() (#108309)

Replace PyDict_GetItem() calls with PyDict_GetItemRef()
or PyDict_GetItemWithError() to handle errors.

* Replace PyLong_AS_LONG() with _PyLong_AsInt()
  and check for errors.
* Check for PyDict_Contains() error.
* pycore_init_builtins() checks for _PyType_Lookup() failure.

2 years agogh-50002: xml.dom.minidom now preserves whitespaces in attributes (GH-107947)
Serhiy Storchaka [Wed, 23 Aug 2023 12:23:41 +0000 (15:23 +0300)] 
gh-50002: xml.dom.minidom now preserves whitespaces in attributes (GH-107947)

Also double quotes (") are now only quoted in attributes.

2 years agogh-105539: Fix ResourceWarning from unclosed SQLite connections in test_sqlite3 ...
Mariusz Felisiak [Wed, 23 Aug 2023 10:10:08 +0000 (12:10 +0200)] 
gh-105539: Fix ResourceWarning from unclosed SQLite connections in test_sqlite3 (#108360)

Follow up to 1a1bfc28912a39b500c578e9f10a8a222638d411.

Explicitly manage connections in:

- test_audit.test_sqlite3
- test_sqlite3.test_audit
- test_sqlite3.test_backup

Co-authored-by: Erlend E. Aasland <erlend@python.org>
2 years agogh-108294: Add time.sleep audit event (GH-108298)
Petr Viktorin [Wed, 23 Aug 2023 09:00:22 +0000 (11:00 +0200)] 
gh-108294: Add time.sleep audit event (GH-108298)

2 years agogh-108113: Make it possible to optimize an AST (#108282)
Irit Katriel [Wed, 23 Aug 2023 08:01:17 +0000 (09:01 +0100)] 
gh-108113: Make it possible to optimize an AST (#108282)

2 years agogh-108267: Dataclasses docs: Fix object.__setattr__ typo (#108355)
FrozenBob [Wed, 23 Aug 2023 07:11:15 +0000 (00:11 -0700)] 
gh-108267: Dataclasses docs: Fix object.__setattr__ typo (#108355)

Fixed a sentence in dataclasses.rst

Changed "__setattr__" to "object.__setattr__" in a section that was specifically supposed to refer to the __setattr__ method of the object class. Also suppressed the link to the data model docs for __setattr__, since we're talking about a specific __setattr__ implementation, not __setattr__ methods in general.

2 years agogh-108342: Break ref cycle in SSLSocket._create() exc (#108344)
Victor Stinner [Wed, 23 Aug 2023 05:26:01 +0000 (07:26 +0200)] 
gh-108342: Break ref cycle in SSLSocket._create() exc (#108344)

Explicitly break a reference cycle when SSLSocket._create() raises an
exception. Clear the variable storing the exception, since the
exception traceback contains the variables and so creates a reference
cycle.

This test leak was introduced by the test added for the fix of #108310.