]> git.ipfire.org Git - thirdparty/Python/cpython.git/log
thirdparty/Python/cpython.git
2 years agodocs: clarify Path.suffix (GH-106650)
Ned Batchelder [Thu, 13 Jul 2023 19:24:54 +0000 (12:24 -0700)] 
docs: clarify Path.suffix (GH-106650)

2 years agogh-106664: selectors: add get() method to _SelectorMapping (#106665)
J. Nick Koston [Thu, 13 Jul 2023 19:18:53 +0000 (09:18 -1000)] 
gh-106664: selectors: add get() method to _SelectorMapping (#106665)

It can be used to avoid raising and catching KeyError twice via __getitem__.

Co-authored-by: Inada Naoki <songofacandy@gmail.com>
2 years agogh-106701: Move the hand-written Tier 2 uops to bytecodes.c (#106702)
Guido van Rossum [Thu, 13 Jul 2023 19:14:51 +0000 (12:14 -0700)] 
gh-106701: Move the hand-written Tier 2 uops to bytecodes.c (#106702)

This moves EXIT_TRACE, SAVE_IP, JUMP_TO_TOP, and
_POP_JUMP_IF_{FALSE,TRUE} from ceval.c to bytecodes.c.

They are no less special than before, but this way
they are discoverable o the copy-and-patch tooling.

2 years agogh-106690: Add a .coveragerc file to the CPython repository (#8150)
Ammar Askar [Thu, 13 Jul 2023 15:45:21 +0000 (11:45 -0400)] 
gh-106690: Add a .coveragerc file to the CPython repository (#8150)

The added file is the coverage default at some point in time + checking branches both ways + IDLE additions, labelled as such and somewhat designed to be unlikely to affect other files.  Located in the CPython repository directory, it can be used where it is or copied elsewhere, depending on how one runs coverage.
---------

Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
2 years agoGH-104909: Split `LOAD_ATTR_INSTANCE_VALUE` into micro-ops (GH-106678)
Mark Shannon [Thu, 13 Jul 2023 15:36:19 +0000 (16:36 +0100)] 
GH-104909: Split `LOAD_ATTR_INSTANCE_VALUE` into micro-ops (GH-106678)

2 years agogh-106309: Deprecate typing.no_type_check_decorator (#106312)
Alex Waygood [Thu, 13 Jul 2023 13:30:35 +0000 (14:30 +0100)] 
gh-106309: Deprecate typing.no_type_check_decorator (#106312)

2 years agogh-106634: Corrected minor asyncio doc issues (#106671)
Chris Brett [Thu, 13 Jul 2023 07:51:13 +0000 (08:51 +0100)] 
gh-106634: Corrected minor asyncio doc issues (#106671)

2 years agogh-106628: email parsing speedup (gh-106629)
CF Bolz-Tereick [Thu, 13 Jul 2023 06:12:56 +0000 (08:12 +0200)] 
gh-106628: email parsing speedup (gh-106629)

2 years agogh-89427: Set VIRTUAL_ENV_PROMPT even when VIRTUAL_ENV_DISABLE_PROMPT… (GH-106643)
Jim Porter [Thu, 13 Jul 2023 06:08:33 +0000 (23:08 -0700)] 
gh-89427: Set VIRTUAL_ENV_PROMPT even when VIRTUAL_ENV_DISABLE_PROMPT… (GH-106643)

2 years agogh-105235: Prevent reading outside buffer during mmap.find() (#105252)
Dennis Sweeney [Thu, 13 Jul 2023 02:50:45 +0000 (22:50 -0400)] 
gh-105235: Prevent reading outside buffer during mmap.find() (#105252)

* Add a special case for s[-m:] == p in _PyBytes_Find

* Add tests for _PyBytes_Find

* Make sure that start <= end in mmap.find

2 years agogh-104050: Argument Clinic: Annotate nested function parser_body() in the CLanguage...
Erlend E. Aasland [Wed, 12 Jul 2023 22:49:30 +0000 (00:49 +0200)] 
gh-104050: Argument Clinic: Annotate nested function parser_body() in the CLanguage class (#106699)

2 years agogh-104683: Argument clinic: modernise `cpp.Monitor` (#106698)
Alex Waygood [Wed, 12 Jul 2023 22:48:36 +0000 (23:48 +0100)] 
gh-104683: Argument clinic: modernise `cpp.Monitor` (#106698)

2 years agogh-104050: Argument clinic: Annotate the `Destination` class (#106655)
Alex Waygood [Wed, 12 Jul 2023 21:33:47 +0000 (22:33 +0100)] 
gh-104050: Argument clinic: Annotate the `Destination` class (#106655)

Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
2 years agogh-106602: [Enum] Add __copy__ and __deepcopy__ (GH-106666)
Prince Roshan [Wed, 12 Jul 2023 21:01:17 +0000 (02:31 +0530)] 
gh-106602: [Enum] Add __copy__ and __deepcopy__ (GH-106666)

2 years agogh-106236: Replace `assert` with `raise RuntimeError` in `threading.py` (#106237)
Nikita Sobolev [Wed, 12 Jul 2023 18:07:59 +0000 (21:07 +0300)] 
gh-106236: Replace `assert` with `raise RuntimeError` in `threading.py` (#106237)

Replace `assert` with `raise ` in `threading.py` so that -OO does not alter _DummyThread behavior.

2 years agogh-106529: Split FOR_ITER_RANGE into uops (#106638)
Guido van Rossum [Wed, 12 Jul 2023 17:23:59 +0000 (10:23 -0700)] 
gh-106529: Split FOR_ITER_RANGE into uops (#106638)

For an example of what this does for Tier 1 and Tier 2, see
https://github.com/python/cpython/issues/106529#issuecomment-1631649920

2 years agogh-106656: Remove --emit-line-directives from regen-cases (#106657)
Guido van Rossum [Wed, 12 Jul 2023 16:12:39 +0000 (09:12 -0700)] 
gh-106656: Remove --emit-line-directives from regen-cases (#106657)

If you prefer to see `#line` directives in generated_cases.c.h, run
```
make regen-cases CASESFLAG=-l
```
But please don't commit the result.

2 years agoGH-104909: Break LOAD_GLOBAL specializations in micro-ops. (GH-106677)
Mark Shannon [Wed, 12 Jul 2023 13:34:14 +0000 (14:34 +0100)] 
GH-104909: Break LOAD_GLOBAL specializations in micro-ops. (GH-106677)

2 years agogh-99079: Update Windows build to use OpenSSL 3.0.9 (GH-106649)
Steve Dower [Wed, 12 Jul 2023 12:46:30 +0000 (13:46 +0100)] 
gh-99079: Update Windows build to use OpenSSL 3.0.9 (GH-106649)

2 years agogh-105481: move Python/opcode_metadata.h to Include/internal/pycore_opcode_metadata...
Irit Katriel [Wed, 12 Jul 2023 10:30:25 +0000 (11:30 +0100)] 
gh-105481: move Python/opcode_metadata.h to Include/internal/pycore_opcode_metadata.h (#106673)

2 years agogh-105373: Elaborate Pending Removal in What's New in Python 3.13 (#106675)
Victor Stinner [Wed, 12 Jul 2023 10:28:10 +0000 (12:28 +0200)] 
gh-105373: Elaborate Pending Removal in What's New in Python 3.13 (#106675)

Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
2 years agogh-106521: Remove _PyObject_LookupAttr() function (GH-106642)
Serhiy Storchaka [Wed, 12 Jul 2023 05:57:10 +0000 (08:57 +0300)] 
gh-106521: Remove _PyObject_LookupAttr() function (GH-106642)

2 years agoAdd Plausible for docs metrics (#106644)
Hugo van Kemenade [Wed, 12 Jul 2023 02:35:24 +0000 (05:35 +0300)] 
Add Plausible for docs metrics (#106644)

2 years agogh-104683: Argument clinic: Minor readability improvements for `Destination.__init__...
Alex Waygood [Tue, 11 Jul 2023 23:08:28 +0000 (00:08 +0100)] 
gh-104683: Argument clinic: Minor readability improvements for `Destination.__init__` (#106652)

2 years agogh-103186: In test_tools.freeze, fetch CONFIG_ARGS from original source directory...
Ijtaba Hussain [Tue, 11 Jul 2023 22:22:18 +0000 (23:22 +0100)] 
gh-103186: In test_tools.freeze, fetch CONFIG_ARGS from original source directory (#103213)

Fetch CONFIG_ARGS from the original source directory, instead of from
the copied source tree. When "make clean" is executed in the copied
source tree, the build directory is cleared and the configure argument
lookup fails. However, the original source directory still contains this
information.

2 years agogh-106529: Implement JUMP_FORWARD in uops (with test) (#106651)
Guido van Rossum [Tue, 11 Jul 2023 22:13:57 +0000 (15:13 -0700)] 
gh-106529: Implement JUMP_FORWARD in uops (with test) (#106651)

Note that this may generate two SAVE_IP uops in a row.
Removing unneeded SAVE_IP uops is the optimizer's job.

2 years agogh-104050: Argument Clinic: Annotate the `Block` class (#106519)
Alex Waygood [Tue, 11 Jul 2023 21:21:14 +0000 (22:21 +0100)] 
gh-104050: Argument Clinic: Annotate the `Block` class (#106519)

2 years agogh-104584: readability improvements in optimizer.c (#106641)
Irit Katriel [Tue, 11 Jul 2023 20:25:41 +0000 (23:25 +0300)] 
gh-104584: readability improvements in optimizer.c (#106641)

2 years agogh-96165: Clarify passing ":memory:" in sqlite3.connect() (#106451)
Mariusz Felisiak [Tue, 11 Jul 2023 20:18:19 +0000 (22:18 +0200)] 
gh-96165: Clarify passing ":memory:" in sqlite3.connect() (#106451)

2 years agogh-96165: Clarify omitting the FROM clause in SQLite queries (#106513)
Mariusz Felisiak [Tue, 11 Jul 2023 20:09:04 +0000 (22:09 +0200)] 
gh-96165: Clarify omitting the FROM clause in SQLite queries (#106513)

2 years agogh-106307: C API: Add PyMapping_GetOptionalItem() function (GH-106308)
Serhiy Storchaka [Tue, 11 Jul 2023 20:04:12 +0000 (23:04 +0300)] 
gh-106307: C API: Add PyMapping_GetOptionalItem() function (GH-106308)

Also add PyMapping_GetOptionalItemString() function.

2 years agogh-106597: Add debugging struct with offsets for out-of-process tools (#106598)
Pablo Galindo Salgado [Tue, 11 Jul 2023 19:35:41 +0000 (20:35 +0100)] 
gh-106597: Add debugging struct with offsets for out-of-process tools (#106598)

2 years agogh-106521: Add PyObject_GetOptionalAttr() function (GH-106522)
Serhiy Storchaka [Tue, 11 Jul 2023 19:13:27 +0000 (22:13 +0300)] 
gh-106521: Add PyObject_GetOptionalAttr() function (GH-106522)

It is a new name of former _PyObject_LookupAttr().

Add also PyObject_GetOptionalAttrString().

2 years agogh-106529: Support JUMP_BACKWARD in Tier 2 (uops) (#106543)
Guido van Rossum [Tue, 11 Jul 2023 18:08:10 +0000 (11:08 -0700)] 
gh-106529: Support JUMP_BACKWARD in Tier 2 (uops) (#106543)

During superblock generation, a JUMP_BACKWARD instruction is translated to either a JUMP_TO_TOP micro-op (when the target of the jump is exactly the beginning of the superblock, closing the loop), or a SAVE_IP + EXIT_TRACE pair, when the jump goes elsewhere.

The new JUMP_TO_TOP instruction includes a CHECK_EVAL_BREAKER() call, so a closed loop can still be interrupted.

2 years agogh-102541: Add test case for help() for non_existent_module (#106340)
Kirill Podoprigora [Tue, 11 Jul 2023 18:04:09 +0000 (21:04 +0300)] 
gh-102541: Add test case for help() for non_existent_module (#106340)

Test fix for when one enters, for instance, 'abd' at the 'help>' prompt.
---------

Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
2 years agogh-106625 : Add missing code to tutorial 4.6 example (#106623)
RustyNail [Tue, 11 Jul 2023 17:22:07 +0000 (02:22 +0900)] 
gh-106625 : Add missing code to tutorial 4.6 example (#106623)

* Added missing import statement.

* Update Doc/tutorial/controlflow.rst

* Update Doc/tutorial/controlflow.rst

* Update controlflow.rst

* Make point regular class with __init__.

---------

Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
2 years agogh-106403: Restore weakref support for TypeVar and friends (#106418)
Jelle Zijlstra [Tue, 11 Jul 2023 15:43:24 +0000 (08:43 -0700)] 
gh-106403: Restore weakref support for TypeVar and friends (#106418)

2 years agogh-106498: Revert incorrect colorsys.rgb_to_hls change (#106627)
Terry Jan Reedy [Tue, 11 Jul 2023 15:07:20 +0000 (11:07 -0400)] 
gh-106498: Revert incorrect colorsys.rgb_to_hls change (#106627)

gh-86618 assumed a-b-c = a-(b+c) = a-d where d = b+d.
For floats 2.0, 1.0, and 0.9999999999999999, this assumption
is false.  The net change of 1.1102230246251565e-16 to 0.0
results in division by 0.  Revert the replacement.  Add test.

2 years agowasm: do not use inline comment in .editorconfig (#106610)
Eisuke Kawashima [Tue, 11 Jul 2023 14:55:37 +0000 (23:55 +0900)] 
wasm: do not use inline comment in .editorconfig (#106610)

It is no longer valid since 0.15.0
https://github.com/editorconfig/specification/blob/v0.15/index.rst#no-inline-comments

2 years agogh-106360: remove redundant #ifdef (#106622)
Irit Katriel [Tue, 11 Jul 2023 12:41:50 +0000 (15:41 +0300)] 
gh-106360: remove redundant #ifdef (#106622)

2 years agogh-105497: [Enum] Fix flag mask inversion when unnamed flags exist (#106468)
Ethan Furman [Tue, 11 Jul 2023 11:35:54 +0000 (04:35 -0700)] 
gh-105497: [Enum] Fix flag mask inversion when unnamed flags exist (#106468)

For example:

    class Flag(enum.Flag):
        A = 0x01
        B = 0x02
        MASK = 0xff

    ~Flag.MASK is Flag(0)

2 years agogh-103968: What's New: Add porting hints for PyType_From with metaclasses (GH-105698)
Petr Viktorin [Tue, 11 Jul 2023 11:20:29 +0000 (13:20 +0200)] 
gh-103968: What's New: Add porting hints for PyType_From with metaclasses (GH-105698)

2 years agogh-106078: Move external C-API functions to decimal module global state (#106616)
Charlie Zhao [Tue, 11 Jul 2023 11:06:42 +0000 (19:06 +0800)] 
gh-106078: Move external C-API functions to decimal module global state (#106616)

2 years agoGH-106529: Define POP_JUMP_IF_NONE in terms of POP_JUMP_IF_TRUE (GH-106599)
Mark Shannon [Tue, 11 Jul 2023 10:33:59 +0000 (11:33 +0100)] 
GH-106529: Define POP_JUMP_IF_NONE in terms of POP_JUMP_IF_TRUE (GH-106599)

2 years agogh-106572: Convert PyObject_DelAttr() to a function (#106611)
Victor Stinner [Tue, 11 Jul 2023 09:38:22 +0000 (11:38 +0200)] 
gh-106572: Convert PyObject_DelAttr() to a function (#106611)

* Convert PyObject_DelAttr() and PyObject_DelAttrString() macros to
  functions.
* Add PyObject_DelAttr() and PyObject_DelAttrString() functions to
  the stable ABI.
* Replace PyObject_SetAttr(obj, name, NULL) with
  PyObject_DelAttr(obj, name).

2 years agoRemove unused branches from mock module (#106617)
Chris Withers [Tue, 11 Jul 2023 08:52:12 +0000 (09:52 +0100)] 
Remove unused branches from mock module (#106617)

* lambda has a name of __none__, but no async lambda so this branch is not needed

* _get_signature_object only returns None for bound builtins. There are no async builtins so this branch isn't needed

* Exclude  a couple of methods from coverage checking in the downstream rolling backport of mock

2 years agogh-106529: Silence compiler warning in jump target patching (#106613)
Guido van Rossum [Tue, 11 Jul 2023 02:12:32 +0000 (19:12 -0700)] 
gh-106529: Silence compiler warning in jump target patching (#106613)

(gh-106551 caused a compiler warning about on Windows.)

2 years agogh-104635: Add a test case for variables that have a dependency. (gh-106583)
Dong-hee Na [Tue, 11 Jul 2023 01:14:53 +0000 (10:14 +0900)] 
gh-104635: Add a test case for variables that have a dependency. (gh-106583)

2 years agogh-106529: Implement POP_JUMP_IF_XXX uops (#106551)
Guido van Rossum [Mon, 10 Jul 2023 23:04:26 +0000 (16:04 -0700)] 
gh-106529: Implement POP_JUMP_IF_XXX uops (#106551)

- Hand-written uops JUMP_IF_{TRUE,FALSE}.
  These peek at the top of the stack.
  The jump target (in superblock space) is absolute.

- Hand-written translation for POP_JUMP_IF_{TRUE,FALSE},
  assuming the jump is unlikely.
  Once we implement jump-likelihood profiling,
  we can implement the jump-unlikely case (in another PR).

- Tests (including some test cleanup).

- Improvements to len(ex) and ex[i] to expose the whole trace.

2 years agogh-102988: Detect email address parsing errors and return empty tuple to indicate...
Thomas Dwyer [Mon, 10 Jul 2023 23:00:55 +0000 (18:00 -0500)] 
gh-102988: Detect email address parsing errors and return empty tuple to indicate the parsing error (old API) (#105127)

Detect email address parsing errors and return empty tuple to indicate the parsing error (old API). This fixes or at least ameliorates CVE-2023-27043.

---------

Co-authored-by: Gregory P. Smith <greg@krypto.org>
2 years agogh-94777: Fix deadlock in ProcessPoolExecutor (#94784)
Louis Paulot [Mon, 10 Jul 2023 21:45:27 +0000 (23:45 +0200)] 
gh-94777: Fix deadlock in ProcessPoolExecutor (#94784)

Fixes a hang in multiprocessing process pool executor when a child process crashes and code could otherwise block on writing to the pipe.  See GH-94777 for more details.

2 years agogh-103186: Fix or catch 'extra' stderr output from unittests (#103196)
Ijtaba Hussain [Mon, 10 Jul 2023 20:29:03 +0000 (21:29 +0100)] 
gh-103186: Fix or catch 'extra' stderr output from unittests (#103196)

Reduce test noise by fixing or catching and testing stderr messages from individual tests.

test_cmd_line_script.test_script_as_dev_fd calls spawn_python and hence subprocess.Popen with incompatible arguments. On POSIX, pass_fds forces close_fds to be True (subprocess.py line 848). Correct the call.

test_uuid.test_cli_namespace_required_for_uuid3: when the namespace is omitted, uuid.main calls argparse.Argument_Parser.error, which prints to stderr before calling sys.exit, which raises SystemExit. Unittest assertRaises catches the exception but not the previous output. Catch the output and test it.

test_warnings.test_catchwarnings_with_simplefilter_error similarly prints before raising. Catch the output and test it.
---------

Co-authored-by: Oleg Iarygin <oleg@arhadthedev.net>
2 years agogh-105227: Add PyType_GetDict() (GH-105747)
Eric Snow [Mon, 10 Jul 2023 16:41:02 +0000 (10:41 -0600)] 
gh-105227: Add PyType_GetDict() (GH-105747)

This compensates for static builtin types having `tp_dict` set to `NULL`.

Co-authored-by: Petr Viktorin <encukou@gmail.com>
2 years agoGH-61215: threadingmock: Remove unused branch for `timeout` (#106591)
Mario Corchero [Mon, 10 Jul 2023 13:35:54 +0000 (15:35 +0200)] 
GH-61215: threadingmock: Remove unused branch for `timeout` (#106591)

threadingmock: Remove unused branch for `timeout`

This is no longer needed as the mock does not hold a "timeout"
parameter, the timeout is stored in `_mock_wait_timeout`.

2 years agoGH-100288: regen cases after #105990 (#106589)
Kumar Aditya [Mon, 10 Jul 2023 12:31:26 +0000 (18:01 +0530)] 
GH-100288: regen cases after #105990 (#106589)

2 years agogh-106078: Move static variables initialized once to decimal module global state...
Charlie Zhao [Mon, 10 Jul 2023 11:57:25 +0000 (19:57 +0800)] 
gh-106078: Move static variables initialized once to decimal module global state (#106475)

2 years agoFix typo in datamodel.rst (#106587)
Riahiamirreza [Mon, 10 Jul 2023 11:52:41 +0000 (15:22 +0330)] 
Fix typo in datamodel.rst (#106587)

2 years agoupdate release schedule for 3.13 (#106577)
sunmy2019 [Mon, 10 Jul 2023 11:51:14 +0000 (19:51 +0800)] 
update release schedule for 3.13 (#106577)

2 years agoGH-104787: use managed weakrefs in `_asyncio` (#106516)
Kumar Aditya [Mon, 10 Jul 2023 11:48:03 +0000 (17:18 +0530)] 
GH-104787: use managed weakrefs in `_asyncio` (#106516)

2 years agogh-99593: Add tests for Unicode C API (part 3) (GH-104728)
Serhiy Storchaka [Mon, 10 Jul 2023 11:04:34 +0000 (14:04 +0300)] 
gh-99593: Add tests for Unicode C API (part 3) (GH-104728)

Add tests for codecs.

2 years agoGH-100288: Specialize LOAD_ATTR for simple class attributes. (#105990)
Mark Shannon [Mon, 10 Jul 2023 10:40:35 +0000 (11:40 +0100)] 
GH-100288: Specialize LOAD_ATTR for simple class attributes. (#105990)

* Add two more specializations of LOAD_ATTR.

2 years agogh-106487: Allow the 'count' argument of `str.replace` to be a keyword (#106488)
Hugo van Kemenade [Mon, 10 Jul 2023 09:52:36 +0000 (12:52 +0300)] 
gh-106487: Allow the 'count' argument of `str.replace` to be a keyword (#106488)

2 years agoClarify how topics.py gets created. (#106121)
Ned Batchelder [Mon, 10 Jul 2023 03:41:31 +0000 (20:41 -0700)] 
Clarify how topics.py gets created. (#106121)

When changing docs, it was easy to find text in topics.py, and I
wondered whether I was supposed to edit it.  Thankfully, the top of the
file says it's auto-generated, so I knew I didn't have to edit it. But I
didn't know what started the auto-generation process.

It's part of the release process, so I'll leave a note here for future
editors.

2 years agogh-105733: Fix ctypes What's New entry (#106576)
Victor Stinner [Mon, 10 Jul 2023 02:05:38 +0000 (04:05 +0200)] 
gh-105733: Fix ctypes What's New entry (#106576)

2 years agogh-106461: typing: Consolidate docs on `Callable` (#106462)
Alex Waygood [Sun, 9 Jul 2023 20:46:15 +0000 (21:46 +0100)] 
gh-106461: typing: Consolidate docs on `Callable` (#106462)

2 years agogh-105927: PyWeakref_GetRef() returns 1 on success (#106561)
Victor Stinner [Sun, 9 Jul 2023 15:50:26 +0000 (17:50 +0200)] 
gh-105927: PyWeakref_GetRef() returns 1 on success (#106561)

PyWeakref_GetRef() now returns 1 on success, and return 0 if the
reference is dead.

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2 years agogh-105373: Doc lists pending removals (#106540)
Victor Stinner [Sun, 9 Jul 2023 15:26:26 +0000 (17:26 +0200)] 
gh-105373: Doc lists pending removals (#106540)

2 years agogh-106303: Use _PyObject_LookupAttr() instead of PyObject_GetAttr() (GH-106304)
Serhiy Storchaka [Sun, 9 Jul 2023 12:27:03 +0000 (15:27 +0300)] 
gh-106303: Use _PyObject_LookupAttr() instead of PyObject_GetAttr() (GH-106304)

It simplifies and speed up the code.

2 years agogh-104469: Convert_testcapi/vectorcall.c to use AC (gh-106557)
littlebutt's workshop [Sun, 9 Jul 2023 12:08:18 +0000 (12:08 +0000)] 
gh-104469: Convert_testcapi/vectorcall.c to use AC (gh-106557)

2 years agoMove implementation specific RE tests to separate class (GH-106563)
Serhiy Storchaka [Sun, 9 Jul 2023 09:48:36 +0000 (12:48 +0300)] 
Move implementation specific RE tests to separate class (GH-106563)

2 years agogh-105376: Remove logging.warn() and LoggerAdapter.warn() (#106553)
Victor Stinner [Sun, 9 Jul 2023 08:32:50 +0000 (10:32 +0200)] 
gh-105376: Remove logging.warn() and LoggerAdapter.warn() (#106553)

2 years agogh-106535: Soft deprecate the getopt module (#105735)
Victor Stinner [Sat, 8 Jul 2023 15:51:45 +0000 (17:51 +0200)] 
gh-106535: Soft deprecate the getopt module (#105735)

The getopt module exists since the initial revision of the Python
source code (1990). The optparse module was added to Python 2.3. When
Python 2.7 added the 3rd argparse module, the optparse module was
soft deprecated. Soft deprecate the getopt module.

2 years agogh-106508: Improve debugging of the _sre module (GH-106509)
Serhiy Storchaka [Sat, 8 Jul 2023 15:00:39 +0000 (18:00 +0300)] 
gh-106508: Improve debugging of the _sre module (GH-106509)

Now the VERBOSE macro can control tracing on per-pattern basis:

* 0 -- disabled
* 1 -- only if the DEBUG flag set
* 2 -- always

2 years agogh-106510: Fix DEBUG output for atomic group (GH-106511)
Serhiy Storchaka [Sat, 8 Jul 2023 11:31:25 +0000 (14:31 +0300)] 
gh-106510: Fix DEBUG output for atomic group (GH-106511)

2 years agogh-101880: add link to object.__hash__() in hash() builtin documentation (#101883)
Owain Davies [Sat, 8 Jul 2023 08:48:33 +0000 (15:48 +0700)] 
gh-101880: add link to object.__hash__() in hash() builtin documentation (#101883)

2 years agogh-105873: Make `_xxsubinterpreters` use exception type name in shared exception...
Radislav Chugunov [Sat, 8 Jul 2023 08:44:50 +0000 (11:44 +0300)] 
gh-105873: Make `_xxsubinterpreters` use exception type name in shared exception (#105874)

2 years agogh-106524: Fix a crash in _sre.template() (GH-106525)
Radislav Chugunov [Sat, 8 Jul 2023 07:47:01 +0000 (10:47 +0300)] 
gh-106524: Fix a crash in _sre.template() (GH-106525)

Some items remained uninitialized if _sre.template() was called with invalid
indices. Then attempt to clear them in the destructor led to dereferencing
of uninitialized pointer.

2 years agogh-106078: Move static objects related to `CONTEXTVAR` to the decimal module global...
Charlie Zhao [Sat, 8 Jul 2023 07:44:24 +0000 (15:44 +0800)] 
gh-106078: Move static objects related to `CONTEXTVAR` to the decimal module global state (#106395)

Co-authored-by: Erlend E. Aasland <erlend@python.org>
2 years agoRestore previous behavior of 'make regen-cases' (#106541)
Guido van Rossum [Sat, 8 Jul 2023 04:50:09 +0000 (21:50 -0700)] 
Restore previous behavior of 'make regen-cases' (#106541)

When running 'make regen-cases' just to check whether anything changed,
it's annoying that even if nothing changes, the output files are touched,
causing an expensiv rebuild of _bootstrap_python and anything it creates.

So use  consistently for all output files.

2 years agogh-105373: Remove C API global config vars in Python 3.14 (#106538)
Victor Stinner [Fri, 7 Jul 2023 23:49:20 +0000 (01:49 +0200)] 
gh-105373: Remove C API global config vars in Python 3.14 (#106538)

Schedule the removal of C API global configuration variables in
Python 3.14. Announce the removal to help C extension maintainers to
upgrade their code.

2 years agogh-105373: Doc lists pending C API removals (#106537)
Victor Stinner [Fri, 7 Jul 2023 22:50:51 +0000 (00:50 +0200)] 
gh-105373: Doc lists pending C API removals (#106537)

2 years agogh-106535: Document PEP 387 Soft Deprecation (#106536)
Victor Stinner [Fri, 7 Jul 2023 22:03:51 +0000 (00:03 +0200)] 
gh-106535: Document PEP 387 Soft Deprecation (#106536)

Mark the optparse module as soft deprecated.

2 years agogh-103200: Fix performance issues with `zipimport.invalidate_caches()` (GH-103208)
Desmond Cheong [Fri, 7 Jul 2023 22:02:13 +0000 (15:02 -0700)] 
gh-103200: Fix performance issues with `zipimport.invalidate_caches()` (GH-103208)

Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Co-authored-by: Brett Cannon <brett@python.org>
2 years agogh-106300: Improve `assertRaises(Exception)` usages in tests (GH-106302)
Nikita Sobolev [Fri, 7 Jul 2023 20:42:40 +0000 (23:42 +0300)] 
gh-106300: Improve `assertRaises(Exception)` usages in tests (GH-106302)

2 years agogh-104584: Replace ENTER_EXECUTOR with the original in trace projection (#106526)
Guido van Rossum [Fri, 7 Jul 2023 18:41:42 +0000 (11:41 -0700)] 
gh-104584: Replace ENTER_EXECUTOR with the original in trace projection (#106526)

2 years agoDelete dead ceval code. (gh-106486)
Benjamin Peterson [Fri, 7 Jul 2023 18:16:19 +0000 (13:16 -0500)] 
Delete dead ceval code. (gh-106486)

2 years agogh-104584: Allow unspecialized instructions in superblocks (#106497)
Guido van Rossum [Fri, 7 Jul 2023 18:03:27 +0000 (11:03 -0700)] 
gh-104584: Allow unspecialized instructions in superblocks (#106497)

This adds several of unspecialized opcodes to superblocks:

TO_BOOL, BINARY_SUBSCR, STORE_SUBSCR,
UNPACK_SEQUENCE, LOAD_GLOBAL, LOAD_ATTR,
COMPARE_OP, BINARY_OP.

While we may not want that eventually, for now this helps finding bugs.

There is a rudimentary test checking for UNPACK_SEQUENCE.

Once we're ready to undo this, that would be simple:
just replace the call to variable_used_unspecialized
with a call to variable_used (as shown in a comment).
Or add individual opcdes to FORBIDDEN_NAMES_IN_UOPS.

2 years agogh-104584: Move super-instruction special-casing to generator (#106500)
Guido van Rossum [Fri, 7 Jul 2023 17:42:10 +0000 (10:42 -0700)] 
gh-104584: Move super-instruction special-casing to generator (#106500)

Instead of special-casing specific instructions,
we add a few more special values to the 'size' field of expansions,
so in the future we can automatically handle
additional super-instructions in the generator.

2 years agogh-104683: clinic.py: refactor `Parameter` and `Function` as dataclasses (#106477)
Alex Waygood [Fri, 7 Jul 2023 13:10:07 +0000 (14:10 +0100)] 
gh-104683: clinic.py: refactor `Parameter` and `Function` as dataclasses (#106477)

2 years agogh-106503: asyncio._SelectorSocketTransport: fix cyclic reference on close(). (#106504)
Andrew Geng [Fri, 7 Jul 2023 11:41:54 +0000 (07:41 -0400)] 
gh-106503: asyncio._SelectorSocketTransport: fix cyclic reference on close(). (#106504)

2 years agoGH-106057: Handle recursion errors in inline class calls properly. (GH-106108)
Mark Shannon [Fri, 7 Jul 2023 10:09:26 +0000 (11:09 +0100)] 
GH-106057: Handle recursion errors in inline class calls properly. (GH-106108)

2 years ago gh-104584: Handle EXTENDED_ARG in superblock creation (#106489)
Guido van Rossum [Thu, 6 Jul 2023 23:46:06 +0000 (16:46 -0700)] 
 gh-104584: Handle EXTENDED_ARG in superblock creation (#106489)

With test.

2 years agogh-90876: Restore the ability to import multiprocessing when `sys.executable` is...
Gregory P. Smith [Thu, 6 Jul 2023 22:46:50 +0000 (15:46 -0700)] 
gh-90876: Restore the ability to import multiprocessing when `sys.executable` is `None` (#106464)

Prevent `multiprocessing.spawn` from failing to *import* in environments
where `sys.executable` is `None`.  This regressed in 3.11 with the addition
of support for path-like objects in multiprocessing.

Adds a test decorator to have tests only run when part of test_multiprocessing_spawn to `_test_multiprocessing.py` so we can start to avoid re-running the same not-global-state specific test in all 3 modes when there is no need.

2 years agogh-104584: Clean up and fix uops tests and fix crash (#106492)
Guido van Rossum [Thu, 6 Jul 2023 22:45:56 +0000 (15:45 -0700)] 
gh-104584: Clean up and fix uops tests and fix crash (#106492)

The uops test wasn't testing anything by default,
and was failing when run with -Xuops.

Made the two executor-related context managers global,
so TestUops can use them (notably `with temporary_optimizer(opt)`).

Made clear_executor() a little more thorough.

Fixed a crash upon finalizing a uop optimizer,
by adding a `tp_dealloc` handler.

2 years agocloses gh-106479: fix typo in __cplusplus macro (gh-106480)
Dustin Rodrigues [Thu, 6 Jul 2023 22:34:00 +0000 (18:34 -0400)] 
closes gh-106479: fix typo in __cplusplus macro (gh-106480)

2 years agogh-104683: clinic.py: refactor four simple classes as dataclasses (#106476)
Alex Waygood [Thu, 6 Jul 2023 21:17:12 +0000 (22:17 +0100)] 
gh-104683: clinic.py: refactor four simple classes as dataclasses (#106476)

2 years agogh-104584: Fix error handling from backedge optimization (#106484)
Guido van Rossum [Thu, 6 Jul 2023 18:39:53 +0000 (11:39 -0700)] 
gh-104584: Fix error handling from backedge optimization (#106484)

When `_PyOptimizer_BackEdge` returns `NULL`, we should restore `next_instr` (and `stack_pointer`). To accomplish this we should jump to `resume_with_error` instead of just `error`.

The problem this causes is subtle -- the only repro I have is in PR gh-106393, at commit d7df54b139bcc47f5ea094bfaa9824f79bc45adc. But the fix is real (as shown later in that PR).

While we're at it, also improve the debug output: the offsets at which traces are identified are now measured in bytes, and always show the start offset. This makes it easier to correlate executor calls with optimizer calls, and either with `dis` output.

<!-- gh-issue-number: gh-104584 -->
* Issue: gh-104584
<!-- /gh-issue-number -->

2 years agogh-106458: Mark `testthreadingmock.py` with `@requires_working_threading` (GH-106366)
Mario Corchero [Thu, 6 Jul 2023 17:54:45 +0000 (19:54 +0200)] 
gh-106458: Mark `testthreadingmock.py` with `@requires_working_threading` (GH-106366)

Mark `testthreadingmock.py` with `threading_helper.requires_working_threading`.

Also add longer delays to reduce the change of a race conditions on the tests that validate short timeouts.

2 years agoIntroduce a gate/check GHA job (#97533)
Sviatoslav Sydorenko [Thu, 6 Jul 2023 15:06:18 +0000 (17:06 +0200)] 
Introduce a gate/check GHA job (#97533)

Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
2 years agogh-104683: clinic.py: Don't needlessly reimplement `contextlib.redirect_stdout` ...
Alex Waygood [Thu, 6 Jul 2023 13:23:02 +0000 (14:23 +0100)] 
gh-104683: clinic.py: Don't needlessly reimplement `contextlib.redirect_stdout` (#106478)

clinic.py: Don't needlessly reimplement `contextlib.redirect_stdout`