Commit Graph

13492 Commits

Author SHA1 Message Date
Victor Stinner 5e4af2a3e9
gh-106320: Move private _PySet API to the internal API (#107041)
* Add pycore_setobject.h header file.
* Move the following API to the internal C API:

  * _PySet_Dummy
  * _PySet_NextEntry()
  * _PySet_Update()
2023-07-22 17:04:34 +02:00
Victor Stinner d228825e08
gh-106320: Remove _PyOS_ReadlineTState API (#107034)
Remove _PyOS_ReadlineTState variable from the public C API.
The symbol is still exported for the readline shared extension.
2023-07-22 14:45:56 +00:00
Victor Stinner eda9ce1487
gh-106320: Move _PyNone_Type to the internal C API (#107030)
Move private types _PyNone_Type and _PyNotImplemented_Type to
internal C API.
2023-07-22 14:12:17 +00:00
Victor Stinner 89f9875448
gh-106320: Move private _PyHash API to the internal C API (#107026)
* No longer export most private _PyHash symbols, only export the ones
  which are needed by shared extensions.
* Modules/_xxtestfuzz/fuzzer.c now uses the internal C API.
2023-07-22 13:49:37 +00:00
Victor Stinner 41ca164551
gh-106004: Add PyDict_GetItemRef() function (#106005)
* Add PyDict_GetItemRef() and PyDict_GetItemStringRef() functions.
  Add these functions to the stable ABI version 3.13.
* Add unit tests on the PyDict C API in test_capi.
2023-07-21 23:10:51 +02:00
Serhiy Storchaka 8d397ee825
gh-47146: Fix reference counting in _testcapi.structmember initializer (GH-106862) 2023-07-21 12:30:14 +03:00
Irit Katriel 9c81fc2dbe
gh-105481: do not auto-generate pycore_intrinsics.h (#106913) 2023-07-20 17:46:04 +01:00
Charlie Zhao a1620dd7b7
gh-106078: Prepare to isolate decimal module (#106880)
* move signal_map to global_state

* move cond_map to global_state
2023-07-20 09:24:35 +00:00
Serhiy Storchaka a293fa5915
gh-86493: Use PyModule_Add() instead of PyModule_AddObjectRef() (GH-106860) 2023-07-18 23:59:53 +03:00
Irit Katriel 40f3f11a77
gh-105481: Generate the opcode lists in dis from data extracted from bytecodes.c (#106758) 2023-07-18 19:42:44 +01:00
Serhiy Storchaka 3e65baee72
gh-86493: Fix possible leaks in some modules initialization (GH-106768)
Fix _ssl, _stat, _testinternalcapi, _threadmodule, cmath, math, posix, time.
2023-07-18 10:50:47 +03:00
Serhiy Storchaka 745492355b
gh-86493: Fix possible leaks in modules initialization: _curses_panel, _decimal, posix, xxsubtype (GH-106767) 2023-07-18 09:00:22 +03:00
Nikita Sobolev ebf2c56b33
gh-106831: Fix NULL check of d2i_SSL_SESSION() result in _ssl.c (#106832) 2023-07-17 19:55:40 +00:00
Victor Stinner ad95c7253a
gh-106687: _ssl: use uint64_t for SSL options (#106700)
SSL_CTX_get_options() uses uint64_t for options:
https://www.openssl.org/docs/man3.1/man3/SSL_CTX_get_options.html

Fix this compiler warning on Windows with MSC:

    conversion from 'uint64_t' to 'long', possible loss of data
2023-07-17 17:55:30 +02:00
Inada Naoki 2566b74b26
gh-81283: compiler: remove indent from docstring (#106411)
Co-authored-by: Éric <merwok@netwok.org>
2023-07-15 19:33:32 +09:00
Irit Katriel 6a70edf24c
gh-105481: expose opcode metadata via the _opcode module (#106688) 2023-07-14 18:41:52 +01:00
Grant Ramsay 21d98be422
gh-105293: Do not call SSL_CTX_set_session_id_context on client side SSL context (#105295)
* gh-105293: Do not call SSL_CTX_set_session_id_context on client side SSL context

Openssl states this is a "server side only" operation.
Calling this on a client side socket can result in unexpected behavior

* Add news entry on SSL "set session id context" changes
2023-07-14 00:10:54 -07: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
Serhiy Storchaka be1b968dc1
gh-106521: Remove _PyObject_LookupAttr() function (GH-106642) 2023-07-12 08:57:10 +03: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
Charlie Zhao e5c32a811c
gh-106078: Move external C-API functions to decimal module global state (#106616) 2023-07-11 16:36:42 +05:30
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
Charlie Zhao 93846657a3
gh-106078: Move static variables initialized once to decimal module global state (#106475) 2023-07-10 17:27:25 +05:30
Kumar Aditya 8fb6edf479
GH-104787: use managed weakrefs in `_asyncio` (#106516) 2023-07-10 17:18:03 +05:30
Serhiy Storchaka 51ea664d18
gh-99593: Add tests for Unicode C API (part 3) (GH-104728)
Add tests for codecs.
2023-07-10 14:04:34 +03:00
Victor Stinner ee46cb6aa9
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>
2023-07-09 15:50:26 +00:00
littlebutt's workshop d137c2cae2
gh-104469: Convert_testcapi/vectorcall.c to use AC (gh-106557) 2023-07-09 21:08:18 +09:00
Serhiy Storchaka b305c69d10
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
2023-07-08 18:00:39 +03:00
Radislav Chugunov 69a39bd9ad
gh-105873: Make `_xxsubinterpreters` use exception type name in shared exception (#105874) 2023-07-08 08:44:50 +00:00
Radislav Chugunov 2ef1dc37f0
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.
2023-07-08 10:47:01 +03:00
Charlie Zhao 1c9e493462
gh-106078: Move static objects related to `CONTEXTVAR` to the decimal module global state (#106395)
Co-authored-by: Erlend E. Aasland <erlend@python.org>
2023-07-08 13:14:24 +05:30
Mark Shannon 318ea2c72e
GH-106360: Support very basic superblock introspection (#106422)
* Add len() and indexing support to uop superblocks.
2023-07-04 17:23:00 +01:00
Nikita Sobolev 80f1c6c49b
gh-106406: Fix _Py_IsInterpreterFinalizing() in _winapi.c (#106408) 2023-07-04 16:19:20 +02:00
Victor Stinner c9ce983ae1
gh-106320: Remove private pylifecycle.h functions (#106400)
Remove private pylifecycle.h functions: move them to the internal C
API ( pycore_atexit.h, pycore_pylifecycle.h and pycore_signal.h). No
longer export most of these functions.

Move _testcapi.test_atexit() to _testinternalcapi.
2023-07-04 09:41:43 +00:00
Victor Stinner 8a73b57b9b
gh-106320: Remove _PyUnicode_TransformDecimalAndSpaceToASCII() (#106398)
Remove private _PyUnicode_TransformDecimalAndSpaceToASCII() and other
private _PyUnicode C API functions: move them to the internal C API
(pycore_unicodeobject.h). No longer most of these functions.

Replace _testcapi.unicode_transformdecimalandspacetoascii() with
_testinternal._PyUnicode_TransformDecimalAndSpaceToASCII().
2023-07-04 08:59:09 +00:00
Victor Stinner ec931fc394
gh-106320: Remove _PyBytesWriter C API (#106399)
Remove the _PyBytesWriter C API: move it to the internal C API
(pycore_bytesobject.h).
2023-07-04 08:27:23 +00:00
Victor Stinner 2e92edbf6d
gh-106320: Remove private _PyImport C API functions (#106383)
* Remove private _PyImport C API functions: move them to the internal
  C API (pycore_import.h).
* No longer export most of these private functions.
* _testcapi avoids private _PyImport_GetModuleAttrString().
2023-07-03 23:02:07 +00:00
Charlie Zhao bf06c6825c
gh-106078: Move `context template` to decimal module global state (#106346) 2023-07-04 01:40:01 +05:30
Carl Meyer 58906213cc
gh-91053: make func watcher tests resilient to other func watchers (#106286) 2023-07-03 08:25:22 -06:00
Victor Stinner c5afc97fc2
gh-106320: Remove private _PyErr C API functions (#106356)
Remove private _PyErr C API functions: move them to the internal
C API (pycore_pyerrors.h).
2023-07-03 10:48:50 +00:00
Victor Stinner 35963da40f
gh-106320: Create pycore_modsupport.h header file (#106355)
Remove the following functions from the C API, move them to the internal C
API: add a new pycore_modsupport.h internal header file:

* PyModule_CreateInitialized()
* _PyArg_NoKwnames()
* _Py_VaBuildStack()

No longer export these functions.
2023-07-03 09:39:11 +00:00
Victor Stinner 5ccbbe5bb9
gh-106320: Move _PyUnicodeWriter to the internal C API (#106342)
Move also _PyUnicode_FormatAdvancedWriter().

CJK codecs and multibytecodec.c now define the Py_BUILD_CORE_MODULE
macro.
2023-07-03 10:23:43 +02:00
Victor Stinner 4e3aa7cd31
gh-106320: _testcapi avoids private _PyUnicode_EqualToASCIIString() (#106341)
Replace private _PyUnicode_EqualToASCIIString() with public
PyUnicode_CompareWithASCIIString().
2023-07-02 21:56:58 +00:00
Victor Stinner c38c66687f
gh-106320: Add pycore_complexobject.h header file (#106339)
Add internal pycore_complexobject.h header file.

Move _Py_c_xxx() functions and _PyComplex_FormatAdvancedWriter()
function to this new header file.
2023-07-02 21:19:59 +00:00
Charlie Zhao dbefa88b27
gh-106078: Move DecimalException to _decimal state (#106301) 2023-07-02 16:50:40 +00:00
Victor Stinner bc7eb17084
gh-106320: Use _PyInterpreterState_GET() (#106336)
Replace PyInterpreterState_Get() with inlined
_PyInterpreterState_GET().
2023-07-02 16:37:37 +00:00
Inada Naoki d5bd32fb48
gh-104922: remove PY_SSIZE_T_CLEAN (#106315) 2023-07-02 15:07:46 +09:00
Victor Stinner 8571b271e7
gh-106320: Remove private _PyInterpreterState functions (#106325)
Remove private _PyThreadState and _PyInterpreterState C API
functions: move them to the internal C API (pycore_pystate.h and
pycore_interp.h). Don't export most of these functions anymore, but
still export functions used by tests.

Remove _PyThreadState_Prealloc() and _PyThreadState_Init() from the C
API, but keep it in the stable API.
2023-07-02 01:39:38 +00:00
Victor Stinner feb51f3a64
gh-106320: Remove private _PyTraceMalloc C API functions (#106324)
* Remove private _PyTraceMalloc C API functions: move them to the
  internal C API.
* Don't export most of these functions anymore, but still export
  _PyTraceMalloc_GetTraceback() used by tests.
* Rename Include/tracemalloc.h to Include/cpython/tracemalloc.h
2023-07-02 00:49:18 +00:00
Victor Stinner 18b1fdebe0
gh-106320: Remove _PyInterpreterState_Get() alias (#106321)
Replace calls to the (removed) slow _PyInterpreterState_Get() with
fast inlined _PyInterpreterState_GET() function.
2023-07-01 23:44:07 +00:00