Commit Graph

13323 Commits

Author SHA1 Message Date
Nikita Sobolev 456d56698d
gh-104469: Convert _testcapi/watchers.c to use Argument Clinic (#104503)
Remove boilerplate code by converting the following functions:

- _testcapi.watch_dict
- _testcapi.unwatch_dict
- _testcapi.watch_type
- _testcapi.unwatch_type
- _testcapi.set_func_defaults_via_capi
- _testcapi.set_func_kwdefaults_via_capi
2023-05-15 22:59:41 +02:00
Eric Snow 26baa747c2
gh-104341: Adjust tstate_must_exit() to Respect Interpreter Finalization (gh-104437)
With the move to a per-interpreter GIL, this check slipped through the cracks.
2023-05-15 13:59:26 -06:00
Erlend E. Aasland b378d991f8
gh-101819: Fix _io clinic input for unused base class method stubs (#104418)
When preparing the _io extension module for isolation, many methods were
adapted to Argument Clinic. Some of these used the '*args: object'
signature, which is incorrect. These are now corrected to an exact
signature, and marked unused, since they are stub methods.
2023-05-15 13:21:38 +02:00
Erlend E. Aasland 186bf39f5c
gh-101819: Isolate `_io` (#101948)
Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
2023-05-15 09:26:27 +00:00
Dong-hee Na 48b3617de4
gh-104469 Convert _testcapi/float.c to use AC (gh-104470) 2023-05-15 12:44:00 +09:00
Kirill Podoprigora 2cd1c87d2a
gh-104456: Fix ref leak in _ctypes.COMError (#104457) 2023-05-14 21:05:35 +00:00
Hugo van Kemenade 25db95d224
gh-103857: Update deprecation stacktrace to point to calling line (#104431) 2023-05-12 22:25:45 +04:00
Jurica Bradarić 19ee53d52e
gh-93649: Split gc- and allocation tests from _testcapimodule.c (GH-104403) 2023-05-12 10:26:07 +01:00
Erlend E. Aasland 15795b57d9
gh-101819: Prepare _io._IOBase for module state (#104386)
- Add PyIOBase_Type to _io module state
- Pass defining class to _io._IOBase.fileno
2023-05-12 07:30:26 +00:00
Alex Henrie 3c2992e58b
gh-87526: Remove dead initialization from _zoneinfo parse_abbr() (#24700) 2023-05-12 08:48:42 +02:00
Jonathan Protzenko 7d7dd4cd70
gh-99108: Refresh HACL* from upstream (#104401)
Refresh HACL* from upstream and add a SHA3 test hashing over 4GiB of data.
2023-05-11 21:23:52 +00:00
Erlend E. Aasland ddc0e70a32
gh-101819: Fix inverted debug preprocessor check in winconsoleio.c (#104388) 2023-05-11 13:01:05 +00:00
Erlend E. Aasland e629ab6adf
gh-101819: Adapt _io.IOBase.seek and _io.IOBase.truncate to Argument Clinic (#104384) 2023-05-11 10:34:26 +00:00
Erlend E. Aasland ed41124bb5
gh-101819: Adapt _io._Buffered* methods to Argument Clinic (#104367) 2023-05-11 15:59:23 +05:30
Erlend E. Aasland d0a738c6df
gh-101819: Refactor `_io` futher in preparation for module isolation (#104369) 2023-05-11 15:56:30 +05:30
Erlend E. Aasland 7dabb35f83
gh-101819: Adapt _io.TextIOBase methods to Argument Clinic (#104383) 2023-05-11 15:49:22 +05:30
Christopher Chavez e464ec9f4c
gh-103538: Remove unused TK_AQUA code (GH-103539) 2023-05-10 18:53:13 +00:00
Sebastian Berg 7a3b03509e
gh-104263: Rely on Py_NAN and introduce Py_INFINITY (GH-104202)
This PR removes `_Py_dg_stdnan` and `_Py_dg_infinity` in favour of
using the standard `NAN` and `INFINITY` macros provided by C99.
This change has the side-effect of fixing a bug on MIPS where the
hard-coded value used by `_Py_dg_stdnan` gave a signalling NaN
rather than a quiet NaN.
---------

Co-authored-by: Mark Dickinson <dickinsm@gmail.com>
2023-05-10 17:44:52 +01:00
Erlend E. Aasland ce8d3db256
gh-101819: Adapt _io._BufferedIOBase_Type methods to Argument Clinic (#104355)
Make sure the defining class is passed to all methods,
so we can easily fetch module state from them in the future.
2023-05-10 16:22:55 +02:00
Erlend E. Aasland 2dcb289ed0
gh-101819: Clean up _io windows console io after gh-104197 (#104354) 2023-05-10 10:59:31 +00:00
Erlend E. Aasland 68a8ca6dc1
gh-101819: Harden _io init (#104352)
Fix potential refleak if PyModule_AddObject() fails.
2023-05-10 12:59:03 +02:00
Erlend E. Aasland 235b82721d
gh-101819: Refactor _io in preparation for module isolation (#104334)
- Replace query with parameter in bufferediobase_unsupported()
- Replace query with parameter in iobase_unsupported()
- Hide delegate: Add method wrapper for _PyIOBase_check_seekable
- Hide delegate: Add method wraper for _PyIOBase_check_readable
- Hide delegate: Add method wraper for _PyIOBase_check_writable
- Replace query with parameter in _PyIOBase_check_seekable()
- Replace query with parameter in _PyIOBase_check_readable()
- Replace query with parameter in _PyIOBase_check_writable()
2023-05-09 23:09:03 +00:00
Carl Meyer c3b595e73e
gh-97933: (PEP 709) inline list/dict/set comprehensions (#101441)
Co-authored-by: Irit Katriel <1055913+iritkatriel@users.noreply.github.com>
Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
2023-05-09 11:02:14 -06:00
Irit Katriel ca95edf177
gh-104240: return code unit metadata from codegen (#104300) 2023-05-09 14:33:40 +01:00
chgnrdv c21f828760
gh-104276: Make `_struct.unpack_iterator` type use type flag instead of custom constructor (#104277) 2023-05-09 12:41:09 +00:00
samschott 9a9b176eb7
gh-104180: Read SOCKS proxies from macOS System Configuration (#104181)
read SOCKS proxies from macOS System Configuration in ``urllib.request``.

---------

Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Co-authored-by: Oleg Iarygin <oleg@arhadthedev.net>
2023-05-09 10:24:29 +02:00
Nathaniel J. Smith faf196213e
GH-104308: socket.getnameinfo should release the GIL (#104307)
* socket.getnameinfo should release the GIL

* 📜🤖 Added by blurb_it.

---------

Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
2023-05-08 16:27:20 -07:00
Jonathan Protzenko 874010c6ca
gh-99108: fix typo in Modules/Setup (#104293)
case sensitive filename
2023-05-08 09:52:11 -07:00
Hugo van Kemenade d513ddee94
Trim trailing whitespace and test on CI (#104275)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2023-05-08 17:03:52 +03:00
Jonathan Protzenko 15665d896b
gh-99108: Replace SHA3 implementation HACL* version (#103597)
Replaces our built-in SHA3 implementation with a verified one from the HACL* project.

This implementation is used when OpenSSL does not provide SHA3 or is not present.

3.11 shiped with a very slow tiny sha3 implementation to get off of the <=3.10 reference implementation that wound up having serious bugs. This brings us back to a reasonably performing built-in implementation consistent with what we've just replaced our other guaranteed available standard hash algorithms with: code from the HACL* project.

---------

Co-authored-by: Gregory P. Smith <greg@krypto.org>
2023-05-07 20:50:04 -07:00
chgnrdv 06c2a4858b
gh-104265 Disallow instantiation of `_csv.Reader` and `_csv.Writer` (#104266) 2023-05-07 21:15:44 +00:00
Irit Katriel 2c2dc61e8d
gh-104240: make _PyCompile_CodeGen support different compilation modes (#104241) 2023-05-07 18:47:28 +01:00
Erlend E. Aasland 7a7eaff95c
gh-101819: Port _io.PyBytesIOBuffer_Type to heap type (#104264) 2023-05-07 14:01:27 +00:00
Erlend E. Aasland a05bad3254
gh-100370: fix OverflowError in sqlite3.Connection.blobopen for 32-bit builds (#103902) 2023-05-07 12:55:31 +02:00
Erlend E. Aasland cab1298a60
gh-101819: Adapt _io.PyWindowsConsoleIO_Type to heap type (#104197) 2023-05-07 11:23:11 +02:00
Erlend E. Aasland 3952379655
gh-101819: Port _io.PyIncrementalNewlineDecoder_Type to heap type (#104249) 2023-05-07 11:20:34 +02:00
Itamar Ostricher c53547c907
gh-97696: Use `PyObject_CallMethodNoArgs` and inline is_loop_running check in `_asyncio` (#104255) 2023-05-07 09:55:45 +05:30
Eric Snow fff193bbfe
gh-99113: Add a check for Py_MOD_PER_INTERPRETER_GIL_SUPPORTED (gh-104206)
Py_MOD_PER_INTERPRETER_GIL_SUPPORTED is a new supported value for Py_mod_multiple_interpreters, added in gh-104205.
2023-05-06 21:57:35 +00:00
Erlend E. Aasland 3b14b51d11
gh-101819: Remove unused 'locale_module' from _io state (#104246)
The locale module reference was introduced by 932ff8368 in 2013,
and rendered unused by 710e82630 (gh-23050) in 2020.
2023-05-06 20:26:06 +00:00
Victor Stinner c84029179c
gh-101819: Prepare to modernize the _io extension (#104178)
* Add references to static types to _PyIO_State:

  * PyBufferedIOBase_Type
  * PyBytesIOBuffer_Type
  * PyIncrementalNewlineDecoder_Type
  * PyRawIOBase_Type
  * PyTextIOBase_Type

* Add the defining class to methods:

  * _io.BytesIO.getbuffer()
  * _io.FileIO.close()

* Add get_io_state_by_cls() function.
* Add state parameter to _textiowrapper_decode()
* _io_TextIOWrapper___init__() now sets self->state before calling
  _textiowrapper_set_decoder().

Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
2023-05-06 01:53:55 +02:00
Jacob Bower 8b7f37dd4c
gh-97696: Remove redundant #include (#104216)
Remove "#include cpython/context.h"` from `_asynciomodule.c`.

It's already included in `Python.h`.
2023-05-05 16:50:06 -07:00
Eric Snow f3e7eb48f8
gh-99113: Add PyInterpreterConfig.own_gil (gh-104204)
We also add PyInterpreterState.ceval.own_gil to record if the interpreter actually has its own GIL.

Note that for now we don't actually respect own_gil; all interpreters still share the one GIL.  However, PyInterpreterState.ceval.own_gil does reflect PyInterpreterConfig.own_gil.  That lie is a temporary one that we will fix when the GIL really becomes per-interpreter.
2023-05-05 15:59:20 -06:00
Eric Snow a9c6e0618f
gh-99113: Add Py_MOD_PER_INTERPRETER_GIL_SUPPORTED (gh-104205)
Here we are doing no more than adding the value for Py_mod_multiple_interpreters and using it for stdlib modules.  We will start checking for it in gh-104206 (once PyInterpreterState.ceval.own_gil is added in gh-104204).
2023-05-05 21:11:27 +00:00
Eric Snow 1c420e138f
gh-104108: Add the Py_mod_multiple_interpreters Module Def Slot (gh-104148)
I'll be adding a value to indicate support for per-interpreter GIL in gh-99114.
2023-05-05 14:04:55 -06:00
Eric Snow 55671fe047
gh-99113: Share the GIL via PyInterpreterState.ceval.gil (gh-104203)
In preparation for a per-interpreter GIL, we add PyInterpreterState.ceval.gil, set it to the shared GIL for each interpreter, and use that rather than using _PyRuntime.ceval.gil directly.  Note that _PyRuntime.ceval.gil is still the actual GIL.
2023-05-05 13:23:00 -06:00
Tian Gao b979741731
gh-103533: Use PEP 669 APIs for cprofile (GH-103534) 2023-05-05 18:38:47 +01:00
Mark Shannon a0df9ee8fc
GH-96803: Add three C-API functions to make _PyInterpreterFrame less opaque for users of PEP 523. (GH-96849) 2023-05-05 17:53:07 +01:00
Erlend E. Aasland d0b4abedfb
gh-64631: Test exception messages in cloned Argument Clinic funcs (#104167) 2023-05-05 14:08:24 +02:00
Kumar Aditya 2318bedb36
GH-103092: port `_asyncio` freelist to module state (#104196) 2023-05-05 16:42:58 +05:30
Irit Katriel 81fc135f26
gh-104051: fix crash in test_xxtestfuzz with -We (#104052) 2023-05-05 11:34:13 +01:00