Commit Graph

13524 Commits

Author SHA1 Message Date
Victor Stinner 27f9491c60
gh-105107: Remove PyCFunction_Call() function (#105181)
* Keep the function in the stable ABI.
* Add unit tests on PyCFunction_Call() since it remains supported in
  the stable ABI.
2023-06-01 11:25:55 +02:00
Victor Stinner 424049cc11
gh-105145: Remove old functions to config Python init (#105154)
Remove the following old functions to configure the Python
initialization, deprecated in Python 3.11:

* PySys_AddWarnOptionUnicode()
* PySys_AddWarnOption()
* PySys_AddXOption()
* PySys_HasWarnOptions()
* PySys_SetArgvEx()
* PySys_SetArgv()
* PySys_SetPath()
* Py_SetPath()
* Py_SetProgramName()
* Py_SetPythonHome()
* Py_SetStandardStreamEncoding()
* _Py_SetProgramFullPath()

Most of these functions are kept in the stable ABI, except:

* Py_SetStandardStreamEncoding()
* _Py_SetProgramFullPath()

Update Doc/extending/embedding.rst and Doc/extending/extending.rst to
use the new PyConfig API.

_testembed.c:

* check_stdio_details() now sets stdio_encoding and stdio_errors
  of PyConfig.
* Add definitions of functions removed from the API but kept in the
  stable ABI.
* test_init_from_config() and test_init_read_set() now use
  PyConfig_SetString() instead of PyConfig_SetBytesString().

Remove _Py_ClearStandardStreamEncoding() internal function.
2023-06-01 09:14:02 +02:00
Victor Stinner 8ed705c083
gh-105156: Deprecate the old Py_UNICODE type in C API (#105157)
Deprecate the old Py_UNICODE and PY_UNICODE_TYPE types in the C API:
use wchar_t instead.

Replace Py_UNICODE with wchar_t in multiple C files.

Co-authored-by: Inada Naoki <songofacandy@gmail.com>
2023-06-01 08:56:35 +02:00
sunmy2019 a99b9d911e
gh-102251: Explicitly free state for test modules with state in test_import (#105085)
Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
2023-05-31 23:12:10 +02:00
Victor Stinner dd29ae26f8
gh-105156: Argument Clinic avoids Py_UNICODE type (#105161)
Argument Clinic now uses "const wchar_t*" type instead of
"const Py_UNICODE*" type for the "Py_UNICODE" format.
2023-05-31 17:52:33 +00:00
Victor Stinner 58a2e09816
gh-62948: IOBase finalizer logs close() errors (#105104) 2023-05-31 11:41:19 +00:00
Inada Naoki adccff3b3f
gh-104922: Make `PY_SSIZE_T_CLEAN` not mandatory again (#105051) 2023-05-31 18:38:55 +09:00
Eric Snow 7be667dfaf
gh-105020: Share tp_bases and tp_mro Between Interpreters For All Static Builtin Types (gh-105115)
In gh-103912 we added tp_bases and tp_mro to each PyInterpreterState.types.builtins entry.  However, doing so ignored the fact that both PyTypeObject fields are public API, and not documented as internal (as opposed to tp_subclasses).  We address that here by reverting back to shared objects, making them immortal in the process.
2023-05-31 00:13:35 +00:00
Irit Katriel b7aadb4583
gh-105071: add PyUnstable_Exc_PrepReraiseStar to expose except* implementation in the unstable API (#105072) 2023-05-30 15:03:36 +01:00
Steve Dower cda1bd3c9d
gh-88745: Add _winapi.CopyFile2 and update shutil.copy2 to use it (GH-105055) 2023-05-30 11:00:29 +01:00
sunmy2019 d14eb3433c
gh-102251: Fix reference leak in _testsinglephase initialization (#105082)
Correctly decref 'initialized' in init_module()

Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
2023-05-30 09:27:55 +00:00
Steve Dower bfd20d257e
gh-104803: Implement ntpath.isdevdrive for checking whether a path is on a Windows Dev Drive (GH-104805) 2023-05-29 10:05:32 +01:00
Raymond Hettinger 402ee5a68b
GH-101588: Deprecate pickle/copy/deepcopy support in itertools (GH-104965) 2023-05-26 15:32:53 -05:00
Kumar Aditya 72c3d2e105
GH-104787: use managed dict in `_asyncio` (#104795) 2023-05-26 10:30:27 +05:30
Gregory P. Smith d08679212d
gh-104372: Drop the GIL around the vfork() call. (#104782)
On Linux where the `subprocess` module can use the `vfork` syscall for
faster spawning, prevent the parent process from blocking other threads
by dropping the GIL while it waits for the vfork'ed child process `exec`
outcome.  This prevents spawning a binary from a slow filesystem from
blocking the rest of the application.

Fixes #104372.
2023-05-25 20:14:09 +00:00
Victor Stinner f66be6b11a
gh-104773: PEP 594: Remove the audioop module (#104937) 2023-05-25 17:59:00 +02:00
Victor Stinner e4127eaa1e
gh-104773: PEP 594: Remove the crypt module (#104908)
Remove the crypt module and its private _crypt extension, deprecated
in Python 3.11.
2023-05-25 15:45:46 +02:00
Steve Dower 6031727a37
gh-104820: Fixes os.stat on Windows to better handle file systems that do not support FileIdInformation (GH-104892) 2023-05-25 00:16:13 +01:00
Victor Stinner 17e1fe0f9b
gh-104773: PEP 594: Remove the nis module (#104897) 2023-05-25 00:08:36 +02:00
Victor Stinner 684e99d01d
gh-104773: PEP 594: Remove the spwd module (#104871)
Remove spwd from the configure script and Modules/Setup.
2023-05-24 20:34:41 +00:00
Jonathan Protzenko 160321e530
gh-99108: Refresh HACL* (#104808)
Refresh HACL* from upstream to improve SHA2 performance and fix a 32-bit issue in SHA3.
2023-05-24 13:30:11 -07:00
Victor Stinner fc07fe4e37
gh-104773: PEP 594: Remove the ossaudiodev module (#104862)
* Remove ossaudiodev extension in configure.ac and regenerate
  the configure script.
* Remove ossaudiodev in Modules/Setup and Modules/Setup.stdlib.in.
2023-05-24 15:00:51 +02:00
Gregory P. Smith 7f963bfc79
gh-104372: use == -1 before PyErr_Occurred (#104831)
The ideal pattern for this.  (already in the 3.11 backport)
2023-05-24 04:15:49 +00:00
Carl Meyer e0b3078705
gh-103295: fix stack overwrite on 32-bit in perf map test harness (#104811) 2023-05-23 16:04:31 -06:00
chgnrdv 13b5d79090
Fix missing/incomplete NULL checks in multiple source files (#104564)
Co-authored-by: Oleg Iarygin <oleg@arhadthedev.net>
2023-05-23 14:01:17 -06:00
Dong-hee Na 76170f5458
gh-104469: Convert _testcapi/long to use AC (gh-104720) 2023-05-23 22:52:36 +09:00
Gregory P. Smith 2e5d8a90aa
gh-99108: Release the GIL around hashlib built-in computation (#104675)
This matches the GIL releasing behavior of our existing `_hashopenssl`
module, extending it to the HACL* built-ins.

Includes adding comments to better describe the ENTER/LEAVE macros
purpose and explain the lock strategy in both existing and new code.
2023-05-23 00:06:41 +00:00
Kumar Aditya b9c807a260
GH-103092: isolate `_ssl` (#104725) 2023-05-22 06:14:48 +05:30
Serhiy Storchaka f3466bc040
gh-98836: Extend PyUnicode_FromFormat() (GH-98838)
* Support for conversion specifiers o (octal) and X (uppercase hexadecimal).
* Support for length modifiers j (intmax_t) and t (ptrdiff_t).
* Length modifiers are now applied to all integer conversions.
* Support for wchar_t C strings (%ls and %lV).
* Support for variable width and precision (*).
* Support for flag - (left alignment).
2023-05-22 00:32:39 +03:00
Hugo van Kemenade 5841fbc1a2
gh-103857: Document utcnow and utcfromtimestamp deprecations in What's New (#104542)
Co-authored-by: Paul Ganssle <1377457+pganssle@users.noreply.github.com>
2023-05-21 13:45:44 -06:00
Mark Shannon 93923793f6
GH-101291: Add low level, unstable API for pylong (GH-101685)
Co-authored-by: Petr Viktorin <encukou@gmail.com>
2023-05-21 14:45:48 +01:00
gsallam be0c106789
gh-103295: expose API for writing perf map files (#103546)
Co-authored-by: Aniket Panse <aniketpanse@fb.com>
Co-authored-by: Gregory P. Smith <greg@krypto.org>
Co-authored-by: Carl Meyer <carl@oddbird.net>
2023-05-21 11:12:24 +01:00
Dong-hee Na 2e91c7e626
gh-104469: Convert _testcapi/exceptions to use AC (gh-104502) 2023-05-21 18:39:45 +09:00
Kirill Podoprigora 99b641886a
gh-104698: Fix reference leak in mmapmodule.c (#104700)
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2023-05-21 01:19:56 +01:00
Gregory P. Smith d1732feea0
gh-104372: Use non-Raw malloc for c_fds_to_keep in _posixsubprocess (#104697)
Use non-Raw malloc for c_fds_to_keep as the code could ask for 0 length.
2023-05-20 17:09:23 +00:00
Prince Roshan ceaa4c3476
gh-103987: fix several crashes in mmap module (#103990)
Co-authored-by: sunmy2019 <59365878+sunmy2019@users.noreply.github.com>
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2023-05-19 20:34:12 -07:00
Matthias Görgens 6e39fa1955
gh-94906: Support multiple steps in math.nextafter (#103881)
This PR updates `math.nextafter` to add a new `steps` argument. The behaviour is as though `math.nextafter` had been called `steps` times in succession.

---------

Co-authored-by: Mark Dickinson <mdickinson@enthought.com>
2023-05-19 21:03:49 +01:00
Christopher Chavez 625887e6df
gh-103839: Allow building Tkinter against Tcl 8.7 without external libtommath (GH-103842) 2023-05-19 15:09:59 -04:00
Irit Katriel ac56a854b4
gh-104645: fix error handling in marshal tests (#104646) 2023-05-19 17:23:57 +01:00
Mark Shannon c26d03d5d6
GH-102818: Do not call `PyTraceBack_Here` in sys.settrace trampoline. (GH-104579) 2023-05-19 12:40:48 +01:00
Ronald Oussoren 616fcad6e2
GH-103545: Add macOS specific constants for ``os.setpriority`` to ``os`` (#104606)
This adds a number of PRIO_DARWIN_* constants to the os module for use with os.setpriority.

---------

Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
2023-05-19 09:15:11 +02:00
Jelle Zijlstra b9dce3aec4
gh-104549: Set __module__ on TypeAliasType (#104550) 2023-05-18 15:56:15 -07:00
Carl Meyer 0589c6a4d3
gh-104615: don't make unsafe swaps in apply_static_swaps (#104620) 2023-05-18 21:22:03 +00:00
Mark Shannon cfa517d5a6
GH-96803: Document and test new unstable internal frame API functions (GH-104211)
Weaken contract of PyUnstable_InterpreterFrame_GetCode to return PyObject*.
2023-05-18 10:10:15 +01:00
Gregory P. Smith c649df63e0
gh-104372: Cleanup _posixsubprocess `make_inheritable` for async signal safety and no GIL requirement (#104518)
Move all of the Python C API calls into the parent process up front
instead of doing PyLong_AsLong and PyErr_Occurred and PyTuple_GET from
the post-fork/vfork child process.

Much of this was long overdue. We shouldn't have been using PyTuple and
PyLong APIs within all of these low level functions anyways.
2023-05-17 08:59:45 -07:00
Mark Shannon f7df173949
GH-101520: Move tracemalloc functionality into core, leaving interface in Modules. (#104508) 2023-05-17 14:17:16 +01:00
Dong-hee Na b58bc8c2a9
gh-104469: Update README.txt for _testcapi (gh-104529)
* gh-104469: Update README.txt for _testcapi

Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
Co-authored-by: Kirill Podoprigora <kirill.bast9@mail.ru>
2023-05-17 12:56:20 +09:00
Kumar Aditya 1b5a2b085c
GH-103092: isolate `_elementtree` (#104561) 2023-05-17 05:05:07 +05:30
Kumar Aditya 20e994c535
GH-103092: isolate `pyexpat` (#104506) 2023-05-16 20:03:01 +00:00
Kumar Aditya 442a3e65da
GH-104510: Fix refleaks in `_io` base types (#104516) 2023-05-16 20:08:17 +05:30
Jelle Zijlstra 24d8b88420
gh-103763: Implement PEP 695 (#103764)
This implements PEP 695, Type Parameter Syntax. It adds support for:

- Generic functions (def func[T](): ...)
- Generic classes (class X[T](): ...)
- Type aliases (type X = ...)
- New scoping when the new syntax is used within a class body
- Compiler and interpreter changes to support the new syntax and scoping rules 

Co-authored-by: Marc Mueller <30130371+cdce8p@users.noreply.github.com>
Co-authored-by: Eric Traut <eric@traut.com>
Co-authored-by: Larry Hastings <larry@hastings.org>
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2023-05-15 20:36:23 -07:00
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
sunmy2019 163034515a
gh-104190: fix ubsan crash (#104191) 2023-05-05 15:24:03 +05:30
Dong-hee Na e5b8b19d99
gh-104106: Add gcc fallback of mkfifoat/mknodat for macOS (gh-104129) 2023-05-05 12:27:25 +09:00
Serhiy Storchaka 2ba931ff72
gh-99593: Add tests for Unicode C API (part 2) (#99868)
Add tests for lower-level functions.

Co-authored-by: Oleg Iarygin <oleg@arhadthedev.net>
2023-05-04 15:25:09 +00:00
Jelle Zijlstra 04f6733275
gh-102500: Implement PEP 688 (#102521)
Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
2023-05-04 07:59:46 -07:00
Gleb Smirnoff b17d32c114
gh-96534: socketmodule: support FreeBSD divert(4) socket (#96536) 2023-05-04 14:57:05 +00:00
Erlend E. Aasland 4f524da484
gh-103092: Port _ctypes.COMError to heap type (#104020) 2023-05-04 13:03:24 +00:00
Petr Viktorin cd9a56c2b0
gh-103509: PEP 697 -- Limited C API for Extending Opaque Types (GH-103511)
Co-authored-by: Oleg Iarygin <oleg@arhadthedev.net>
Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
2023-05-04 09:56:53 +02:00
Petr Viktorin 524a7f77fd
gh-103968: Deprecate creating heap types whose metaclass has custom tp_new. (GH-103972)
(That's a mouthful of an edge case!)

Co-authored-by: Barney Gale <barney.gale@gmail.com>
2023-05-03 15:17:14 +02:00
Eric Snow 292076a9aa
gh-104109: Expose Py_NewInterpreterFromConfig() in the Public C-API (gh-104110)
We also expose PyInterpreterConfig. This is part of the PEP 684 (per-interpreter GIL) implementation.  We will add docs as soon as we can.

FYI, I'm adding the new config field for per-interpreter GIL in gh-99114.
2023-05-02 21:40:00 -06:00
Eric Snow de64e75616
gh-94673: More Per-Interpreter Fields for Builtin Static Types (gh-103912)
his involves moving tp_dict, tp_bases, and tp_mro to PyInterpreterState, in the same way we did for tp_subclasses.  Those three fields are effectively const for builtin static types (unlike tp_subclasses).  In theory we only need to make their values immortal, along with their contents.  However, that isn't such a simple proposition.  (See gh-103823.)  In the meantime the simplest solution is to move the fields into the interpreter.

One alternative is to statically allocate the values, but that's its own can of worms.
2023-05-02 21:30:03 -06:00
Dong-hee Na d81ca7ec02
gh-84436: Add integration C API tests for immortal objects (gh-103962) 2023-05-03 00:05:30 +09:00
Jurica Bradarić 87223f32ab
gh-103743: Add PyUnstable_Object_GC_NewWithExtraData (GH-103744)
Co-authored-by: Petr Viktorin <encukou@gmail.com>
Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
2023-05-02 13:38:46 +02:00
Eric Snow f73abf8e03
gh-94673: Hide Objects in PyTypeObject Behind Accessors (gh-104074)
This makes it much cleaner to move more PyTypeObject fields to PyInterpreterState.
2023-05-01 20:34:43 -06:00
Eric Snow fdd878650d
gh-94673: Properly Initialize and Finalize Static Builtin Types for Each Interpreter (gh-104072)
Until now, we haven't been initializing nor finalizing the per-interpreter state properly.
2023-05-01 19:36:00 -06:00
Irit Katriel 80b714835d
gh-87092: Expose assembler to unit tests (#103988) 2023-05-01 22:29:30 +01:00
Itamar Ostricher a474e04388
gh-97696: asyncio eager tasks factory (#102853)
Co-authored-by: Jacob Bower <jbower@meta.com>
Co-authored-by: Carol Willing <carolcode@willingconsulting.com>
2023-05-01 15:10:13 -06:00
chgnrdv 2a884ceb36
Fix typo in "expected" word in few source files (#104034) 2023-05-01 09:45:50 -06:00
Dong-hee Na e147694252
gh-104028: Reduce object creation while calling callback function from gc (gh-104030) 2023-05-01 14:03:24 +00:00
Itamar Ostricher 85c7bf5bce
gh-103793: Defer formatting task name (#103767)
The default task name is "Task-<counter>" (if no name is passed in during Task creation).
This is initialized in `Task.__init__` (C impl) using string formatting, which can be quite slow.
Actually using the task name in real world code is not very common, so this is wasted init.

Let's defer this string formatting to the first time the name is read (in `get_name` impl),
so we don't need to pay the string formatting cost if the task name is never read.

We don't change the order in which tasks are assigned numbers (if they are) --
the number is set on task creation, as a PyLong instead of a formatted string.

Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2023-04-29 08:20:09 -07:00
Barry Warsaw e1f14643dc
gh-98040: Remove just the `imp` module (#98573) 2023-04-28 16:17:58 -07:00
Paul Ganssle 689723a4ab
GH-103944: Check error status when raising DeprecationWarning (#103949) 2023-04-28 15:44:13 -04:00
Wes Turner 52cedc5c10
Fix typo in math.log docstring (#103943) 2023-04-28 00:31:31 -07:00
Eric Snow d2e2e53f73
gh-94673: Ensure Builtin Static Types are Readied Properly (gh-103940)
There were cases where we do unnecessary work for builtin static types. This also simplifies some work necessary for a per-interpreter GIL.
2023-04-27 16:19:43 -06:00
Paul Ganssle 0b7fd8ffc5
GH-103857: Deprecate utcnow and utcfromtimestamp (#103858)
Using `datetime.datetime.utcnow()` and `datetime.datetime.utcfromtimestamp()` will now raise a `DeprecationWarning`.

We also have removed our internal uses of these functions and documented the change.
2023-04-27 11:32:30 -06:00
Finn Womack b701dce340
gh-102765: Update ntpath.isdir/isfile/islink/exists to use GetFileInformationByName when available (GH-103485) 2023-04-27 14:23:26 +00:00
Erlend E. Aasland 8a0c7f1e40
gh-103583: Isolate CJK codec modules (#103869) 2023-04-27 15:02:43 +02:00
Erlend E. Aasland e9c777208f
gh-103092: Isolate _ctypes, part 1 (#103893)
Establish global state and port the following types to heap types:

- DictRemover_Type
- PyCArg_Type
- PyCThunk_Type
- PyCField_Type
- StructParam_Type
2023-04-27 14:57:54 +02:00
Reese Hyde 1d99e9e46e
gh-89415: Add source-specific multicast constants to socket module (#103684)
Add socket options for source-specific multicast when present as C #defines.

Co-authored-by: Oleg Iarygin <dralife@yandex.ru>
2023-04-26 21:05:55 -07:00
Erlend E. Aasland bb8aa7a2b4
gh-103489: Add get/set config methods to sqlite3.Connection (#103506) 2023-04-26 19:57:48 +00:00
Erlend E. Aasland 222c63fc6b
gh-103015: Add entrypoint keyword param to sqlite3.Connection.load_extension (#103073) 2023-04-26 21:22:03 +02:00
Eric Snow df3173d28e
gh-101659: Isolate "obmalloc" State to Each Interpreter (gh-101660)
This is strictly about moving the "obmalloc" runtime state from
`_PyRuntimeState` to `PyInterpreterState`.  Doing so improves isolation
between interpreters, specifically most of the memory (incl. objects)
allocated for each interpreter's use.  This is important for a
per-interpreter GIL, but such isolation is valuable even without it.

FWIW, a per-interpreter obmalloc is the proverbial
canary-in-the-coalmine when it comes to the isolation of objects between
interpreters.  Any object that leaks (unintentionally) to another
interpreter is highly likely to cause a crash (on debug builds at
least).  That's a useful thing to know, relative to interpreter
isolation.
2023-04-24 17:23:57 -06:00
Oleg Iarygin dfc5c41632
gh-94518: Port 23-argument `_posixsubprocess.fork_exec` to Argument Clinic (#94519)
Convert fork_exec to pre-inlined-argparser Argument Clinic

Co-authored-by: Gregory P. Smith <greg@krypto.org>
2023-04-24 18:27:48 +00:00
Brett Simmers b7f4811c88
gh-103091: Add PyUnstable_Type_AssignVersionTag (#103095) 2023-04-24 10:07:47 -06:00
Alex Gaynor 543009347e
gh-103712: Increase the length of the type name in AttributeError messages (#103713) 2023-04-24 08:23:08 -06:00
Dong-hee Na 9c3442c093
gh-101408: PyObject_GC_Resize should calculate preheader size. (gh-101741) 2023-04-23 11:18:49 -06:00
Eddie Elizondo ea2c001650
gh-84436: Implement Immortal Objects (gh-19474)
This is the implementation of PEP683

Motivation:

The PR introduces the ability to immortalize instances in CPython which bypasses reference counting. Tagging objects as immortal allows up to skip certain operations when we know that the object will be around for the entire execution of the runtime.

Note that this by itself will bring a performance regression to the runtime due to the extra reference count checks. However, this brings the ability of having truly immutable objects that are useful in other contexts such as immutable data sharing between sub-interpreters.
2023-04-22 13:39:37 -06:00
Alexander Belopolsky 2b1260c557
gh-83861: Fix datetime.astimezone() method (GH-101545) 2023-04-19 14:02:29 -07:00
Erlend E. Aasland a6b07b5a34
gh-103583: Add ref. dependency between multibytecodec modules (#103589) 2023-04-19 10:02:17 -06:00
Erlend E. Aasland e989e0b62a
gh-103583: Always pass multibyte codec structs as const (#103588) 2023-04-18 21:08:16 -06:00
Erlend E. Aasland ffdbfe1976
gh-103617: Fix compiler warning in _iomodule.c (#103618) 2023-04-18 20:30:54 -06:00
Erlend E. Aasland 217911ede5
gh-103583: Add codecs and maps to _codecs_* module state (#103540) 2023-04-17 02:41:25 +02:00
Christopher Chavez 69e2c42f42
gh-103532: Remove TKINTER_PROTECT_LOADTK code (GH-103535)
This was only needed for Tk 8.4.13 and older,
but Tkinter already requires at least 8.5.12.
2023-04-14 09:04:16 -05:00
Skip Montanaro 330a942b63
gh-67230: add quoting rules to csv module (GH-29469)
Add two quoting styles for csv dialects.
They will help to work with certain databases in particular.

Automerge-Triggered-By: GH:merwok
2023-04-12 15:32:30 -07:00
Erlend E. Aasland 52f96d3ea3
gh-103092: Isolate `_collections` (#103093)
Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
2023-04-12 18:21:28 +05:30
Erlend E. Aasland f329a8bc1e
gh-103092: Isolate `socket` module (#103094) 2023-04-09 06:33:52 +05:30
Dong-hee Na 35167043e3
gh-103242: Migrate SSLContext.set_ecdh_curve not to use deprecated APIs (#103378)
Migrate `SSLContext.set_ecdh_curve()` not to use deprecated OpenSSL APIs.
2023-04-08 10:56:42 -07:00
Erlend E. Aasland 91794e5873
gh-83004: Harden _socket init (GH-103261)
Automerge-Triggered-By: GH:erlend-aasland
2023-04-07 16:43:44 -07:00
Dong-hee Na efb0a2cf3a
gh-103256: Fix hmac algorithm to support fallback implementation (gh-103286)
Co-authored-by: Gregory P. Smith <greg@krypto.org>
2023-04-07 10:51:29 +09:00
Eric Snow 03089fdccc
gh-101659: Add _Py_AtExit() (gh-103298)
The function is like Py_AtExit() but for a single interpreter.  This is a companion to the atexit module's register() function, taking a C callback instead of a Python one.

We also update the _xxinterpchannels module to use _Py_AtExit(), which is the motivating case.  (This is inspired by pain points felt while working on gh-101660.)
2023-04-05 18:42:02 -06:00
Eric Snow aa5a9b5eb7
gh-101659: Use the Raw Allocator in the _xxinterpchannels Module (gh-103287)
Using the raw allocator for any of the global state makes sense, especially as we move to a per-interpreter obmalloc state (gh-101660).
2023-04-05 15:13:12 -06:00
Nikita Sobolev 119f67de08
gh-103167: Fix `-Wstrict-prototypes` warnings by using `(void)` for functions with no args (GH-103168) 2023-04-05 09:22:33 +02:00
Charles Machalow 935aa45235
GH-75586: Make shutil.which() on Windows more consistent with the OS (GH-103179) 2023-04-04 23:24:13 +01:00
T. Wouters 89e6a34461
Fix a compiler warning in _xxsubinterpretermodule.c (#103245)
Fix a (correct) warning about potential uses of uninitialized memory in
_xxsubinterpreter. Unlike newly allocated PyObject structs or global
structs, stack-allocated structs are not initialised, and a few places in
the code expect the _sharedexception struct data to be either NULL or
initialised.
2023-04-04 16:51:30 +02:00
Erlend E. Aasland c00dcf0e38
gh-103092: Isolate `_pickle` module (#102982)
Co-authored-by: Mohamed Koubaa <koubaa.m@gmail.com>
Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
2023-04-04 15:38:54 +05:30
David Benjamin 02f9920900
gh-100062: Remove error code tables from _ssl and err_names_to_codes (GH-100063)
Prior to https://github.com/python/cpython/pull/25300, the
make_ssl_data.py script used various tables, exposed in _ssl, to update
the error list.

After that PR, this is no longer used. Moreover, the err_names_to_codes
map isn't used at all. Clean those up. This gets them out of the way if,
in the future, OpenSSL provides an API to do what the code here is doing
directly. (https://github.com/openssl/openssl/issues/19848)
2023-04-03 23:44:00 +01:00
Kumar Aditya e6f7d35be7
GH-103182: use vectorcall in `_asyncio` instead of variadic calling APIs (#103175) 2023-04-03 18:14:32 +05:30
Ikko Eltociear Ashimine a0305c5fdf
fix typo in _ssl.c (GH-103192)
seperated -> separated

Automerge-Triggered-By: GH:AlexWaygood
2023-04-02 08:25:46 -07:00
Brian Haley ecc5441505
Add IPv6 into to the docstring for socket.getsockname (#102961)
Signed-off-by: Brian Haley <haleyb.dev@gmail.com>
2023-03-30 11:40:58 -07:00
Liyang Zhang 11ed70b1dc
Fix typos in faulthandler, testcapi error messages (#103020) 2023-03-25 14:27:02 -07:00
Raymond Hettinger 1fd603fad2
GH-102833: Mention the key function in the docstrings (GH-103009) 2023-03-25 02:19:20 -05:00
David Benjamin acfe02f3b0
gh-100372: Use BIO_eof to detect EOF for SSL_FILETYPE_ASN1 (GH-100373)
In PEM, we need to parse until error and then suppress `PEM_R_NO_START_LINE`, because PEM allows arbitrary leading and trailing data. DER, however, does not. Parsing until error and suppressing `ASN1_R_HEADER_TOO_LONG` doesn't quite work because that error also covers some cases that should be rejected.

Instead, check `BIO_eof` early and stop the loop that way.

Automerge-Triggered-By: GH:Yhg1s
2023-03-24 06:04:30 -07:00
Raymond Hettinger d49409196e
GH-100989: remove annotation from docstring (GH-102991) 2023-03-24 00:39:12 -05:00
Raymond Hettinger 7f01a11199
GH-100989: Revert Improve the accuracy of collections.deque docstrings (GH-102979) 2023-03-23 19:50:17 -05:00
Mark Shannon 7559f5fda9
GH-101291: Rearrange the size bits in PyLongObject (GH-102464)
* Eliminate all remaining uses of Py_SIZE and Py_SET_SIZE on PyLongObject, adding asserts.

* Change layout of size/sign bits in longobject to support future addition of immortal ints and tagged medium ints.

* Add functions to hide some internals of long object, and for setting sign and digit count.

* Replace uses of IS_MEDIUM_VALUE macro with _PyLong_IsCompact().
2023-03-22 14:49:51 +00:00
Benjamin Fogle af9c34f6ef
gh-96931: Fix incorrect results in ssl.SSLSocket.shared_ciphers (#96932) 2023-03-22 15:08:41 +01:00
Max Bachmann ea93bde4ec
gh-102027: Fix macro name (#102124)
This fixes the ssse3 / sse2 detection when sse4 is available.

Co-authored-by: Oleg Iarygin <oleg@arhadthedev.net>
2023-03-22 14:44:28 +01:00
David Benjamin 420bbb783b
GH-95494: Fix transport EOF handling in OpenSSL 3.0 (GH-95495)
GH-25309 enabled SSL_OP_IGNORE_UNEXPECTED_EOF by default, with a comment
that it restores OpenSSL 1.1.1 behavior, but this wasn't quite right.
That option causes OpenSSL to treat transport EOF as the same as
close_notify (i.e. SSL_ERROR_ZERO_RETURN), whereas Python actually has
distinct SSLEOFError and SSLZeroReturnError exceptions. (The latter is
usually mapped to a zero return from read.) In OpenSSL 1.1.1, the ssl
module would raise them for transport EOF and close_notify,
respectively. In OpenSSL 3.0, both act like close_notify.

Fix this by, instead, just detecting SSL_R_UNEXPECTED_EOF_WHILE_READING
and mapping that to the other exception type.

There doesn't seem to have been any unit test of this error, so fill in
the missing one. This had to be done with the BIO path because it's
actually slightly tricky to simulate a transport EOF with Python's fd
based APIs. (If you instruct the server to close the socket, it gets
confused, probably because the server's SSL object is still referencing
the now dead fd?)
2023-03-22 13:16:26 +01:00
Timo Ludwig c74073657e
gh-100989: Improve the accuracy of collections.deque docstrings (#100990)
Co-authored-by: C.A.M. Gerlach <CAM.Gerlach@Gerlach.CAM>
2023-03-22 12:46:58 +01:00
Artem Mukhin 0a60deaeaf
GH-94808: Cover `PyOS_mystrnicmp` and `PyOS_mystricmp` (gh-102469) 2023-03-22 20:35:27 +09:00
Sergey B Kirpichev d1a89ce515
gh-102839: remove AC for math.log (GH-102863) 2023-03-21 18:48:19 -05:00
Eric Snow e6ecd3e6b4
gh-94673: Isolate the _io module to Each Interpreter (gh-102663)
Aside from sys and builtins, _io is the only core builtin module that hasn't been ported to multi-phase init.  We may do so later (e.g. gh-101948), but in the meantime we must at least take care of the module's static types properly.  (This came up while working on gh-101660.)

https://github.com/python/cpython/issues/94673
2023-03-21 14:01:38 -06:00
Eric Snow 3bb475662b
gh-98608: Stop Treating All Errors from _Py_NewInterpreterFromConfig() as Fatal (gh-102657)
Prior to this change, errors in _Py_NewInterpreterFromConfig() were always fatal.  Instead, callers should be able to handle such errors and keep going.  That's what this change supports.  (This was an oversight in the original implementation of _Py_NewInterpreterFromConfig().)  Note that the existing [fatal] behavior of the public Py_NewInterpreter() is preserved.

https://github.com/python/cpython/issues/98608
2023-03-21 10:49:12 -06:00
Irit Katriel 5c471f3f2a
gh-102755: PyErr_DisplayException only in ABI >= 3.12. Tests cover PyErr_Display as well (GH-102849) 2023-03-21 10:36:18 +01:00
Max Bachmann 96e05b62e8
gh-102255: Use GetVersionEx instead of GetVersionExW to match argument type (GH-102583)
Since we pass a structure of type `OSVERSIONINFOEX`, we need to call
`GetVersionEx` instead of `GetVersionExW`.
2023-03-20 15:47:17 +00:00
Raymond Hettinger 3adb23a17d
Add more comments to hypot() (GH-102817) 2023-03-18 12:21:48 -05:00
Raymond Hettinger 72186aa637
Simplify and improve accuracy for subnormals in hypot() (GH-102785) 2023-03-17 14:06:52 -05:00
Irit Katriel 3f9285a8c5
gh-102755: Add PyErr_DisplayException(exc) (#102756) 2023-03-16 22:18:04 +00:00
Steve Dower 0f175766e2
gh-99726: Improves correctness of stat results for Windows, and uses faster API when available (GH-102149)
This deprecates `st_ctime` fields on Windows, with the intent to change them to contain the correct value in 3.14. For now, they should keep returning the creation time as they always have.
2023-03-16 17:27:21 +00:00
Irit Katriel e108af6eca
gh-102192: remove redundant exception fields from ssl module socket (#102466) 2023-03-16 16:41:10 +00:00
Irit Katriel 51d693c584
gh-102594: PyErr_SetObject adds note to exception raised on normalization error (#102675) 2023-03-16 10:16:01 +00:00
Raymond Hettinger 0a22aa0528
Simplify and speed-up math.hypot() and math.dist() (GH-102734) 2023-03-15 15:15:23 -05:00
Max Bachmann afa6092ee4
gh-102281: Fix potential nullptr dereference + use of uninitialized memory (gh-102282) 2023-03-15 21:58:43 +09:00
Jacob Bower cbd3fbfb6e
gh-102013: Add PyUnstable_GC_VisitObjects (#102014) 2023-03-14 01:35:54 +00:00
Eric Snow 959ea2f9e9
gh-101659: Avoid Allocation for Shared Exceptions in the _xxsubinterpreters Module (gh-102659)
https://github.com/python/cpython/issues/101659
2023-03-13 16:01:44 -06:00
Eric Snow 74885a08db
gh-101524: Fix the ChannelID tp_name (gh-102655)
https://github.com/python/cpython/issues/101524
2023-03-13 15:50:16 -06:00
chgnrdv 85ba8a3e03
gh-102650: Remove duplicate include directives from multiple source files (#102651)
Remove duplicate include directives from multiple source files
2023-03-13 13:25:17 -06:00
Steve Dower cb35882773
gh-102519: Add os.listdrives, os.listvolumes and os.listmounts on Windows (GH-102544) 2023-03-10 12:21:37 +00:00
Irit Katriel 2999e02836
gh-102192: Replace PyErr_Fetch/Restore etc by more efficient alternatives in `_ctypes` (#102477) 2023-03-10 14:32:32 +05:30
Max Bachmann c6858d1e7f
gh-102255: Improve build support for Windows API partitions (GH-102256)
Add `MS_WINDOWS_DESKTOP`, `MS_WINDOWS_APPS`, `MS_WINDOWS_SYSTEM` and `MS_WINDOWS_GAMES` preprocessor definitions to allow switching off functionality missing from particular API partitions ("partitions" are used in Windows to identify overlapping subsets of APIs).
CPython only officially supports `MS_WINDOWS_DESKTOP` and `MS_WINDOWS_SYSTEM` (APPS is included by normal desktop builds, but APPS without DESKTOP is not covered). Other configurations are a convenience for people building their own runtimes.
`MS_WINDOWS_GAMES` is for the Xbox subset of the Windows API, which is also available on client OS, but is restricted compared to `MS_WINDOWS_DESKTOP`. These restrictions may change over time, as they relate to the build headers rather than the OS support, and so we assume that Xbox builds will use the latest available version of the GDK.
2023-03-09 21:09:12 +00:00
Eric Snow cf6e7c5e55
gh-100227: Isolate the Import State to Each Interpreter (gh-101941)
Specific changes:

* move the import lock to PyInterpreterState
* move the "find_and_load" diagnostic state to PyInterpreterState

Note that the import lock exists to keep multiple imports of the same module in the same interpreter (but in different threads) from stomping on each other.  Independently, we use a distinct global lock to protect globally shared import state, especially related to loaded extension modules.  For now we can rely on the GIL as that lock but with a per-interpreter GIL we'll need a new global lock.

The remaining state in _PyRuntimeState.imports will (probably) continue being global.

https://github.com/python/cpython/issues/100227
2023-03-09 09:46:21 -07:00
Eric Snow cbb0aa71d0
gh-102304: Consolidate Direct Usage of _Py_RefTotal (gh-102514)
This simplifies further changes to _Py_RefTotal (e.g. make it atomic or move it to PyInterpreterState).

https://github.com/python/cpython/issues/102304
2023-03-08 12:03:50 -07:00
JosephSBoyle b097925858
gh-102507 Remove invisible pagebreak characters (#102531)
Co-authored-by: AlexWaygood <alex.waygood@gmail.com>
2023-03-08 13:58:14 +00:00
Kumar Aditya 1a84cc007e
GH-102397: Fix segfault from race condition in signal handling (#102399)
Co-authored-by: Gregory P. Smith <greg@krypto.org>
2023-03-08 13:29:39 +05:30
Carl Meyer 1e703a4733
gh-102381: don't call watcher callback with dead object (#102382)
Co-authored-by: T. Wouters <thomas@python.org>
2023-03-07 17:10:58 -07:00
Irit Katriel a33ca2ad1f
gh-102493: fix normalization in PyErr_SetObject (#102502)
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2023-03-07 13:27:46 -08:00
Irit Katriel f105fe4f0a
gh-102192: Replace PyErr_Fetch/Restore etc by more efficient alternatives in sub interpreters module (#102472) 2023-03-06 17:49:31 +00:00
Byeongmin Choi 77a3196b7c
gh-101863: Fix wrong comments in EUC-KR codec (gh-102417) 2023-03-05 01:01:54 +09:00
Alexey Izbyshev c2bd55d26f
gh-102179: Fix `os.dup2` error reporting for negative fds (#102180) 2023-03-04 19:54:08 +05:30
Dong-hee Na ed55c69ebd
gh-101101: Fix test_code_extra to reset value for refleak test (gh-102350) 2023-03-02 20:32:05 +09:00