Commit Graph

117780 Commits

Author SHA1 Message Date
Chris Brett 4b4a5b70aa
gh-106634: Corrected minor asyncio doc issues (#106671) 2023-07-13 13:21:13 +05:30
CF Bolz-Tereick 7e6ce48872
gh-106628: email parsing speedup (gh-106629) 2023-07-13 15:12:56 +09:00
Jim Porter af51bd7cda
gh-89427: Set VIRTUAL_ENV_PROMPT even when VIRTUAL_ENV_DISABLE_PROMPT… (GH-106643) 2023-07-13 07:08:33 +01:00
Dennis Sweeney ab86426a34
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
2023-07-12 22:50:45 -04:00
Erlend E. Aasland 2d43beec22
gh-104050: Argument Clinic: Annotate nested function parser_body() in the CLanguage class (#106699) 2023-07-12 22:49:30 +00:00
Alex Waygood 8aa4beaad0
gh-104683: Argument clinic: modernise `cpp.Monitor` (#106698) 2023-07-12 22:48:36 +00:00
Alex Waygood a180e7a0df
gh-104050: Argument clinic: Annotate the `Destination` class (#106655)
Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
2023-07-12 22:33:47 +01:00
Prince Roshan 357e9e9da3
gh-106602: [Enum] Add __copy__ and __deepcopy__ (GH-106666) 2023-07-12 14:01:17 -07:00
Nikita Sobolev e4b88c1e4a
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.
2023-07-12 11:07:59 -07:00
Guido van Rossum dd1884dc5d
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
2023-07-12 10:23:59 -07:00
Guido van Rossum 7f55f58b6c
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.
2023-07-12 16:12:39 +00:00
Mark Shannon b03755a234
GH-104909: Break LOAD_GLOBAL specializations in micro-ops. (GH-106677) 2023-07-12 14:34:14 +01:00
Steve Dower e2d7366fb3
gh-99079: Update Windows build to use OpenSSL 3.0.9 (GH-106649) 2023-07-12 13:46:30 +01:00
Irit Katriel 2ca008e2b7
gh-105481: move Python/opcode_metadata.h to Include/internal/pycore_opcode_metadata.h (#106673) 2023-07-12 11:30:25 +01:00
Victor Stinner 42bc485a24
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>
2023-07-12 12:28:10 +02:00
Serhiy Storchaka be1b968dc1
gh-106521: Remove _PyObject_LookupAttr() function (GH-106642) 2023-07-12 08:57:10 +03:00
Hugo van Kemenade e8ab0096a5
Add Plausible for docs metrics (#106644) 2023-07-12 05:35:24 +03:00
Alex Waygood 7ce3ea4906
gh-104683: Argument clinic: Minor readability improvements for `Destination.__init__` (#106652) 2023-07-11 23:08:28 +00:00
Ijtaba Hussain de827322ca
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.
2023-07-11 22:22:18 +00:00
Guido van Rossum da86db56cb
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.
2023-07-11 15:13:57 -07:00
Alex Waygood d0972c77aa
gh-104050: Argument Clinic: Annotate the `Block` class (#106519) 2023-07-11 21:21:14 +00:00
Irit Katriel 3590c45a3d
gh-104584: readability improvements in optimizer.c (#106641) 2023-07-11 21:25:41 +01:00
Mariusz Felisiak f520804b03
gh-96165: Clarify passing ":memory:" in sqlite3.connect() (#106451) 2023-07-11 22:18:19 +02:00
Mariusz Felisiak fc7ff1af45
gh-96165: Clarify omitting the FROM clause in SQLite queries (#106513) 2023-07-11 22:09:04 +02:00
Serhiy Storchaka 4bf43710d1
gh-106307: C API: Add PyMapping_GetOptionalItem() function (GH-106308)
Also add PyMapping_GetOptionalItemString() function.
2023-07-11 23:04:12 +03:00
Pablo Galindo Salgado b444bfb0a3
gh-106597: Add debugging struct with offsets for out-of-process tools (#106598) 2023-07-11 20:35:41 +01:00
Serhiy Storchaka 579aa89e68
gh-106521: Add PyObject_GetOptionalAttr() function (GH-106522)
It is a new name of former _PyObject_LookupAttr().

Add also PyObject_GetOptionalAttrString().
2023-07-11 22:13:27 +03:00
Guido van Rossum cabd6e8a10
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.
2023-07-11 18:08:10 +00:00
Kirill Podoprigora 292ac4bfe9
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>
2023-07-11 14:04:09 -04:00
RustyNail d0b7e18262
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>
2023-07-11 13:22:07 -04:00
Jelle Zijlstra 945d3cbf2e
gh-106403: Restore weakref support for TypeVar and friends (#106418) 2023-07-11 08:43:24 -07:00
Terry Jan Reedy a2d54d4e8a
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.
2023-07-11 11:07:20 -04:00
Eisuke Kawashima 64c0890b69
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
2023-07-11 23:55:37 +09:00
Irit Katriel 388b5daa52
gh-106360: remove redundant #ifdef (#106622) 2023-07-11 13:41:50 +01:00
Ethan Furman 95b7426f45
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)
2023-07-11 13:35:54 +02:00
Petr Viktorin af5cf1e751
gh-103968: What's New: Add porting hints for PyType_From with metaclasses (GH-105698) 2023-07-11 13:20:29 +02:00
Charlie Zhao e5c32a811c
gh-106078: Move external C-API functions to decimal module global state (#106616) 2023-07-11 16:36:42 +05:30
Mark Shannon c0c041a31b
GH-106529: Define POP_JUMP_IF_NONE in terms of POP_JUMP_IF_TRUE (GH-106599) 2023-07-11 11:33:59 +01:00
Victor Stinner 1f2921b72c
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).
2023-07-11 11:38:22 +02:00
Chris Withers e6379f72cb
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
2023-07-11 08:52:12 +00:00
Guido van Rossum 4bd8320dd7
gh-106529: Silence compiler warning in jump target patching (#106613)
(gh-106551 caused a compiler warning about on Windows.)
2023-07-10 19:12:32 -07:00
Dong-hee Na 115df8491a
gh-104635: Add a test case for variables that have a dependency. (gh-106583) 2023-07-11 10:14:53 +09:00
Guido van Rossum 22988c323a
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.
2023-07-10 16:04:26 -07:00
Thomas Dwyer 18dfbd0357
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>
2023-07-10 23:00:55 +00:00
Louis Paulot 6782fc0502
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.
2023-07-10 21:45:27 +00:00
Ijtaba Hussain 9d582250d8
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>
2023-07-10 16:29:03 -04:00
Eric Snow a840806d33
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>
2023-07-10 18:41:02 +02:00
Mario Corchero 3e23fa71f4
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`.
2023-07-10 07:35:54 -06:00
Kumar Aditya 3f9bc86c5a
GH-100288: regen cases after #105990 (#106589) 2023-07-10 12:31:26 +00:00
Charlie Zhao 93846657a3
gh-106078: Move static variables initialized once to decimal module global state (#106475) 2023-07-10 17:27:25 +05:30