Commit Graph

117590 Commits

Author SHA1 Message Date
Mark Shannon 7199584ac8
GH-100987: Allow objects other than code objects as the "executable" of an internal frame. (GH-105727)
* Add table describing possible executable classes for out-of-process debuggers.

* Remove shim code object creation code as it is no longer needed.

* Make lltrace a bit more robust w.r.t. non-standard frames.
2023-06-14 13:46:37 +01:00
Alex Waygood ad56340b66
gh-105566: Deprecate unusual ways of creating `typing.NamedTuple` classes (#105609)
Deprecate creating a typing.NamedTuple class using keyword arguments to denote the fields (`NT = NamedTuple("NT", x=int, y=str)`). This will be disallowed in Python 3.15. Use the class-based syntax or the functional syntax instead.

Two methods of creating `NamedTuple` classes with 0 fields using the functional syntax are also deprecated, and will be disallowed in Python 3.15: `NT = NamedTuple("NT")` and `NT = NamedTuple("NT", None)`. To create a `NamedTuple` class with 0 fields, either use `class NT(NamedTuple): pass` or `NT = NamedTuple("NT", [])`.
2023-06-14 13:38:49 +01:00
Jelle Zijlstra fc8037d84c
gh-104873: Add typing.get_protocol_members and typing.is_protocol (#104878)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2023-06-14 05:35:06 -07:00
Kirill Podoprigora ba516e70c6
gh-102541: Hide traceback in help prompt (gh-102614) 2023-06-14 21:17:12 +09:00
Victor Stinner 0316063031
gdb libpython.py: Remove compatibility code (#105739)
Remove compatibility code for Python 2 and early Python 3 versions.

* Remove os_fsencode() reimplementation: use os.fsencode() directly.
  os.fsencode() was added to Python 3.2.
* Remove references to Python 2 and "Python 3": just say "Python".
* Remove outdated u'' string format: use '' instead.
2023-06-14 12:30:22 +02:00
Nikita Sobolev e5d45b7444
gh-105745: Fix open method of webbrowser.Konqueror (#105746) 2023-06-14 12:29:16 +02:00
Nikita Sobolev 67f69dba0a
gh-105687: Remove deprecated objects from `re` module (#105688) 2023-06-14 12:26:20 +02:00
Victor Stinner fb655e0c45
_ctypes callbacks.c uses _Py_COMP_DIAG_IGNORE_DEPR_DECLS (#105732)
Replace #pragma with _Py_COMP_DIAG_PUSH,
_Py_COMP_DIAG_IGNORE_DEPR_DECLS and _Py_COMP_DIAG_POP to ease Python
maintenance. Also add a comment explaining why callbacks.c ignores a
deprecation warning.
2023-06-14 12:12:25 +02:00
Jelle Zijlstra 5cdd5ba49d
tarfile: Fix positional-only syntax in docs (GH-105770)
The syntax used in the current docs (a / before any args) is invalid.

I think the right approach is for the arguments to arbitrary
filter functions to be treated as positional-only, meaning that users
can supply filter functions with any names for the argument. tarfile.py
only calls the filter function with positional arguments.
2023-06-14 09:26:48 +02:00
Eddie Elizondo 6199fe3b32
gh-105587: Remove assertion from `_PyStaticObject_CheckRefcnt` (#105638) 2023-06-14 10:03:32 +05:30
Barney Gale dab5a3ebe8
GH-89812: Clean up pathlib tests. (#104829)
Clean up pathlib tests.

Merge `PurePathTest` into `_BasePurePathTest`, and `PathTest` into
`_BasePathTest`.
2023-06-14 06:06:58 +02:00
Victor Stinner b95de96268
gh-105751: test_ctypes avoids "from ctypes import *" (#105768)
Using "import *" prevents linters like pyflakes to detect undefined names
(usually missing imports).

Replace c_voidp with c_void_p.
2023-06-14 03:34:11 +00:00
Victor Stinner 381a1dc261
gh-105751: test_ctypes.test_numbers uses top level imports (#105762)
Moroever, c_ulonglong and c_bool are always available.
2023-06-14 04:47:01 +02:00
Victor Stinner ac7b551bde
gh-105751: test_ctypes gets Windows attrs from ctypes (#105758)
test_ctypes now gets attributes specific to Windows from the ctypes
module, rather than relying on "from ctypes import *".

Attributes:

* ctypes.FormatError
* ctypes.WINFUNCTYPE
* ctypes.WinError
* ctypes.WinDLL
* ctypes.windll
* ctypes.oledll
* ctypes.get_last_error()
* ctypes.set_last_error()
2023-06-14 04:46:47 +02:00
Eric Snow b87d288275
gh-105699: Use a Thread-Local Variable for PKGCONTEXT (gh-105740)
This fixes a race during import. The existing _PyRuntimeState.imports.pkgcontext is shared between interpreters, and occasionally this would cause a crash when multiple interpreters were importing extensions modules at the same time.  To solve this we add a thread-local variable for the value.  We also leave the existing state (and infrequent race) in place for platforms that do not support thread-local variables.
2023-06-13 18:58:23 -06:00
Eric Snow fcf0647cf2
gh-104812: Skip Pending Calls Tests if No Threading (gh-105761)
This fixes the WASM buildbots.
2023-06-14 00:39:18 +00:00
Victor Stinner b542972dc1
gh-105387: Limited C API implements Py_INCREF() as func (#105388)
In the limited C API version 3.12, Py_INCREF() and Py_DECREF()
functions are now implemented as opaque function calls to hide
implementation details.
2023-06-14 02:33:00 +02:00
zentarim f3266c05b6
GH-104554: Add RTSPS support to `urllib/parse.py` (#104605)
* GH-104554: Add RTSPS support to `urllib/parse.py`

RTSPS is the permanent scheme defined in
https://www.iana.org/assignments/uri-schemes/uri-schemes.xhtml
alongside RTSP and RTSPU schemes.

* 📜🤖 Added by blurb_it.

---------

Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
2023-06-13 16:45:47 -07:00
Steve Dower 4cefe3cf10
gh-105436: Ignore unrelated errors when checking empty env (GH-105742) 2023-06-14 00:00:16 +01:00
Victor Stinner 457a459c78
gh-98040: Fix importbench: use types.ModuleType() (#105743)
Replace removed imp.new_module(name) with types.ModuleType(name).
2023-06-14 00:32:12 +02:00
Eric Snow 757b402ea1
gh-104812: Run Pending Calls in any Thread (gh-104813)
For a while now, pending calls only run in the main thread (in the main interpreter).  This PR changes things to allow any thread run a pending call, unless the pending call was explicitly added for the main thread to run.
2023-06-13 15:02:19 -06:00
Łukasz Langa 4e80082723
gh-102613: Bump recursion limit to fix running test_pathlib under Coverage (#105744) 2023-06-13 21:44:27 +01:00
Irit Katriel be2779c0cb
gh-105481: add flags to each instr in the opcode metadata table, to replace opcode.hasarg/hasname/hasconst (#105482) 2023-06-13 21:42:03 +01:00
Victor Stinner 2211454fe2
gh-105733: Deprecate ctypes SetPointerType() and ARRAY() (#105734) 2023-06-13 18:16:26 +00:00
Eric Snow b97e14a806
gh-105603: Change the PyInterpreterConfig.own gil Field (gh-105620)
We are changing it to be more flexible that a strict bool can be for possible future expanded used cases.
2023-06-13 11:08:32 -06:00
Lysandros Nikolaou abfbab6415
gh-105718: Fix buffer allocation in tokenizer with readline (#105728) 2023-06-13 16:18:11 +01:00
Victor Stinner d0f1afd942
gh-105373: Remove PyArg_Parse() deprecation (#105394)
There is no plan to deprecate PyArg_Parse().

The deprecation was added as a comment in the C API documentation in
2007 by commit 85eb8c103c.
2023-06-13 13:49:36 +02:00
Lysandros Nikolaou ed8217b493
gh-105713: Document that tokenize raises when mixing tabs/spaces (#105723)
* gh-105713: Document that tokenize raises when mixing tabs/spaces
* Update Doc/whatsnew/3.12.rst

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2023-06-13 12:39:29 +02:00
Mark Shannon c3d2d64b4c
Fix magic number (GH-105722) 2023-06-13 10:34:27 +01:00
Mark Shannon 09ffa69e2e
GH-105678: Split MAKE_FUNCTION into MAKE_FUNCTION and SET_FUNCTION_ATTRIBUTE (GH-105680) 2023-06-13 09:51:05 +01:00
Erlend E. Aasland 217589d4f3
gh-105375: Improve error handling in _Unpickler_SetInputStream() (#105667)
Prevent exceptions from possibly being overwritten in case of multiple
failures.
2023-06-13 10:38:01 +02:00
Kumar Aditya 840d02f3f0
GH-105684: Require `asyncio.Task` implementations to support `set_name` method (#105685) 2023-06-13 06:06:40 +00:00
Kumar Aditya 829ac13b69
GH-104787: use bitfields in `_asyncio` (#104788) 2023-06-13 11:11:34 +05:30
Guido van Rossum 8da9d1b163
gh-105540: Fix code generator tests (#105707)
This involves expanding PEEK, POKE and JUMPBY macros,
and removing super and register tests (those features no longer exist).
2023-06-12 21:55:15 +00:00
Erlend E. Aasland ca3cc4b95d
gh-105375: Explicitly initialise all {Pickler,Unpickler}Object fields (#105686)
All fields must be explicitly initialised to prevent manipulation of
uninitialised fields in dealloc.

Align initialisation order with the layout of the object structs.
2023-06-12 23:35:07 +02:00
Jay f0fb782ddb
gh-105331: Change `asyncio.sleep` to raise ``ValueError` for nan (#105641)
Co-authored-by: Guido van Rossum <gvanrossum@gmail.com>
Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
2023-06-12 20:29:02 +00:00
Guido van Rossum 9544948e7e
Remove support for legacy bytecode instructions (#105705)
(A legacy instruction is of the form `instr(FOOBAR)`,
i.e. missing the `(... -- ...)` stack/cache effect annotation.)
2023-06-12 18:19:04 +00:00
Guido van Rossum b9e7dc797d
gh-105229: Remove syntactic support for super-instructions (#105703)
It will not be used again.
2023-06-12 17:47:08 +00:00
Dora203 4f7d3b602d
gh-105436: The environment block should end with two null wchar_t values (GH-105495) 2023-06-12 17:14:55 +01:00
Petr Viktorin 2b90796be6
gh-103968: PyType_FromMetaclass: Allow metaclasses with tp_new=NULL (GH-105386) 2023-06-12 17:45:49 +02:00
Steve Dower 58f0bda341
ARM64 clamping bug also exists in MSVC 14.35 (GH-105679) 2023-06-12 15:09:14 +00:00
Nikita Sobolev a8d69fe92c
gh-105673: Fix uninitialized warning in sysmodule.c (#105674)
In sys_add_xoption(), 'value' may be uninitialized for some error paths.
2023-06-12 08:47:56 +00:00
Irit Katriel 58f5227d7c
gh-105481: add pseudo-instructions to the bytecodes DSL (#105506) 2023-06-11 22:31:59 +01:00
Erlend E. Aasland 20a56d8bec
gh-105375: Harden pyexpat initialisation (#105606)
Add proper error handling to add_errors_module() to prevent exceptions
from possibly being overwritten.
2023-06-11 20:18:46 +00:00
Erlend E. Aasland 41cddc2e93
gh-105375: Improve error handling in the sys extension module (#105611)
In _PySys_AddXOptionWithError() and sys_add_xoption(),
bail on first error to prevent exceptions from possibly being
overwritten.
2023-06-11 20:02:49 +00:00
Erlend E. Aasland e8998e46a7
gh-105375: Improve error handling in _ctypes (#105593)
Prevent repeated PyLong_FromVoidPtr() from possibly overwriting the
current exception.
2023-06-11 19:46:19 +00:00
Erlend E. Aasland 555be81026
gh-105375: Improve error handling in PyUnicode_BuildEncodingMap() (#105491)
Bail on first error to prevent exceptions from possibly being overwritten.
2023-06-11 21:29:19 +02:00
Erlend E. Aasland 567d6ae8e7
gh-105375: Improve PyErr_WarnExplicit() error handling (#105610)
Bail on first error to prevent exceptions from possibly being
overwritten.
2023-06-11 21:23:28 +02:00
Samet YASLAN 3f7c0810f6
bpo-44185: Added close() to mock_open __exit__ (#26902) 2023-06-11 19:51:21 +01:00
Tomas R 18d16e93b6
gh-102676: Add more convenience properties to `dis.Instruction` (#103969)
Adds start_offset, cache_offset, end_offset, baseopcode,
baseopname, jump_target and oparg to dis.Instruction.

Also slightly improves the disassembly output by allowing
opnames to overflow into the space reserved for opargs.
2023-06-11 08:50:34 -07:00