Commit Graph

8165 Commits

Author SHA1 Message Date
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 506cfdf141
gh-106320: Remove more private _PyUnicode C API functions (#106382)
Remove more private _PyUnicode C API functions:
move them to the internal C API (pycore_unicodeobject.h).

No longer export most pycore_unicodeobject.h functions.
2023-07-03 22:35:46 +00:00
Mark Shannon e5862113dd
GH-104584: Fix ENTER_EXECUTOR (GH-106141)
* Check eval-breaker in ENTER_EXECUTOR.

* Make sure that frame->prev_instr is set before entering executor.
2023-07-03 21:28:27 +01:00
Guido van Rossum 2028a4f6d9
gh-106290: Fix edge cases around uops (#106319)
- Tweak uops debugging output
- Fix the bug from gh-106290
- Rename `SET_IP` to `SAVE_IP` (per https://github.com/faster-cpython/ideas/issues/558)
- Add a `SAVE_IP` uop at the start of the trace (ditto)
- Allow `unbound_local_error`; this gives us uops for `LOAD_FAST_CHECK`, `LOAD_CLOSURE`, and `DELETE_FAST`
- Longer traces
- Support `STORE_FAST_LOAD_FAST`, `STORE_FAST_STORE_FAST`
- Add deps on pycore_uops.h to Makefile(.pre.in)
2023-07-03 20:05:11 +00: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
Jeremy Paige 0355625d94
Document PYTHONSAFEPATH along side -P (#106122) 2023-07-02 22:44:37 -07: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 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
Victor Stinner 46d77610fc
gh-106316: Remove pytime.h header file (#106317)
Remove the "cpython/pytime.h" header file: it only contained private
functions. Move functions to the internal pycore_time.h header file.

Move tests from _testcapi to _testinternalcapi. Rename also test
methods to have the same name than tested C functions.

No longer export these functions:

* _PyTime_Add()
* _PyTime_As100Nanoseconds()
* _PyTime_FromMicrosecondsClamp()
* _PyTime_FromTimespec()
* _PyTime_FromTimeval()
* _PyTime_GetPerfCounterWithInfo()
* _PyTime_MulDiv()
2023-07-01 22:27:18 +00:00
Md Sadman Chowdhury 822db860ea
Fix duplicate word typos in comments (#106225) 2023-07-01 12:47:14 -07:00
Irit Katriel 200f255411
gh-106149: move unconditional jump direction resolution from optimizer to assembler (#106291) 2023-07-01 11:28:07 +01:00
Nikita Sobolev 46c1097868
gh-106145: Make `end_{lineno,col_offset}` required on `type_param` nodes (#106224) 2023-06-30 23:45:08 +00:00
Kirill Podoprigora 2062e11501
gh-106267: Add type cast to generated code (#106289) 2023-06-30 12:11:10 -07:00
Dong-hee Na 02ce3d56e6
gh-106280: Remove unnecessary unreachable code (gh-106285) 2023-06-30 15:58:07 +00:00
Victor Stinner 80b3d8f337
gh-106023: Remove _PyObject_FastCallTstate() function (#106273) 2023-06-30 12:28:59 +02:00
Victor Stinner 0b51463862
Remove private _PyCodec_Lookup() function (#106269)
Remove the following private functions of the C API:

* _PyCodecInfo_GetIncrementalDecoder()
* _PyCodecInfo_GetIncrementalEncoder()
* _PyCodec_DecodeText()
* _PyCodec_EncodeText()
* _PyCodec_Forget()
* _PyCodec_Lookup()
* _PyCodec_LookupTextEncoding()

Move these functions to a new pycore_codecs.h internal header file.

These functions are no longer exported.
2023-06-30 09:34:01 +00:00
Inada Naoki f1034ba7f6
gh-106182: sys: Intern getfilesystemencoding() and getfilesystemencodeerrors() (#106183)
sys: Intern getfilesystemencoding() and getfilesystemencodeerrors()
2023-06-30 13:02:03 +09:00
Inada Naoki 77ddc9a7b1
fix typos (#106247)
Most typos are in comments, but two typos are in docstring.
2023-06-30 13:00:22 +09:00
Victor Stinner 8c5f74fc89
gh-106023: Update code using _PyObject_FastCall() (#106257)
Replace _PyObject_FastCall() calls with PyObject_Vectorcall().
2023-06-30 01:05:01 +00:00
Hood Chatham e7bc8d1636
gh-106210 Remove Emscripten import trampoline (#106211)
It's no longer necessary.

Co-authored-by: Brett Cannon <brett@python.org>
2023-06-29 17:20:49 -07:00
Brandt Bucher 7b2d94d875
GH-106008: Make implicit boolean conversions explicit (GH-106003) 2023-06-29 13:49:54 -07:00
hms 8bff940ad6
gh-105775: Convert LOAD_CLOSURE to a pseudo-op (#106059)
This enables super-instruction formation,
removal of checks for uninitialized variables,
and frees up an instruction.
2023-06-29 09:34:00 -07:00
Serhiy Storchaka 8bf6904b22
gh-101006: Improve error handling when read marshal data (GH-101007)
* EOFError no longer overrides other errors such as MemoryError or OSError at
  the start of the object.
* Raise more relevant error when the NULL object occurs as a code object
  component.
* Minimize an overhead of calling PyErr_Occurred().
2023-06-29 12:22:19 +03:00
Guido van Rossum 11731434df
gh-104584: Emit macro expansions to opcode_metadata.h (#106163)
This produces longer traces (superblocks?).

Also improved debug output (uop names are now printed instead of numeric opcodes). This would be simpler if the numeric opcode values were generated by generate_cases.py, but that's another project.

Refactored some code in generate_cases.py so the essential algorithm for cache effects is only run once. (Deciding which effects are used and what the total cache size is, regardless of what's used.)
2023-06-28 18:28:07 +00:00
Erlend E. Aasland 6c60684bf5
gh-106118: Add O_CLOEXEC preprocessor guard (#106120) 2023-06-28 13:11:32 +02:00
Victor Stinner 84caa3324a
gh-106084: Remove _PyObject_CallMethod() function (#106159)
Remove the following private functions from the public C API:

* _Py_CheckFunctionResult()
* _PyObject_CallMethod()
* _PyObject_CallMethodId()
* _PyObject_CallMethodIdNoArgs()
* _PyObject_CallMethodIdObjArgs()
* _PyObject_CallMethodIdOneArg()
* _PyObject_MakeTpCall()
* _PyObject_VectorcallMethodId()
* _PyStack_AsDict()

Move these functions to the internal C API (pycore_call.h).

No longer export the following functions:

* _PyObject_Call()
* _PyObject_CallMethod()
* _PyObject_CallMethodId()
* _PyObject_CallMethodIdObjArgs()
* _PyObject_Call_Prepend()
* _PyObject_FastCallDictTstate()
* _PyStack_AsDict()

The following functions are still exported for stdlib shared
extensions:

* _Py_CheckFunctionResult()
* _PyObject_MakeTpCall()

Mark the following internal functions as extern:

* _PyStack_UnpackDict()
* _PyStack_UnpackDict_Free()
* _PyStack_UnpackDict_FreeNoDecRef()
2023-06-28 01:34:37 +02:00
Guido van Rossum 6b5166fb12
gh-104584: Change DEOPT_IF in uops executor (#106146)
This effectively reverts bb578a0, restoring the original DEOPT_IF() macro in ceval_macros.h, and redefining it in the Tier 2 interpreter. We can get rid of the PREDICTED() macros there as well!
2023-06-27 14:17:41 -07:00
Irit Katriel 5290881009
gh-106149: move jump target resolution from optimizer to assembler (#106150) 2023-06-27 20:24:58 +01:00
Guido van Rossum bb578a0c30
gh-104584: Fix assert in DEOPT macro -- should fix buildbot (#106131) 2023-06-27 07:02:51 -07:00
Guido van Rossum 0762775a15
gh-104584: Add #line directives to executor_cases.c.h (#106126) 2023-06-27 06:56:39 -07:00
Guido van Rossum 51fc725117
gh-104584: Baby steps towards generating and executing traces (#105924)
Added a new, experimental, tracing optimizer and interpreter (a.k.a. "tier 2"). This currently pessimizes, so don't use yet -- this is infrastructure so we can experiment with optimizing passes. To enable it, pass ``-Xuops`` or set ``PYTHONUOPS=1``. To get debug output, set ``PYTHONUOPSDEBUG=N`` where ``N`` is a debug level (0-4, where 0 is no debug output and 4 is excessively verbose).

All of this code is likely to change dramatically before the 3.13 feature freeze. But this is a first step.
2023-06-26 19:02:57 -07:00
Victor Stinner 00e75a3372
gh-106084: Remove old PyObject call aliases (#106085)
Remove old aliases which were kept backwards compatibility with
Python 3.8:

* _PyObject_CallMethodNoArgs()
* _PyObject_CallMethodOneArg()
* _PyObject_CallOneArg()
* _PyObject_FastCallDict()
* _PyObject_Vectorcall()
* _PyObject_VectorcallMethod()
* _PyVectorcall_Function()

Update code which used these aliases to use new names.
2023-06-26 08:08:12 +02:00
Serhiy Storchaka 1d33d53780
gh-106033: Get rid of new occurrences of PyDict_GetItem and PyObject_HasAttr (GH-106034)
These functions are broken by design because they discard any exceptions raised
inside, including MemoryError and KeyboardInterrupt.  They should not be
used in new code.
2023-06-23 20:10:32 +03:00
Serhiy Storchaka c8c162ef52
gh-106030: Miscellaneous fixes in Python/suggestions.c (GH-106031)
* PyDict_GetItem() and PyObject_HasAttr() suppress arbitrary errors and
  should not be used.
* PyUnicode_CompareWithASCIIString() only works if the second argument
  is ASCII string.
* Refleak in get_suggestions_for_name_error.
* Use of borrowed pointer after possible freeing (self).
* Add some missing error checks.
2023-06-23 19:53:27 +03:00
Mark Shannon 9339d70ac2
GH-106012: Fix monitoring of static code objects (GH-106017) 2023-06-23 13:18:29 +01:00
Victor Stinner ee52158f20
gh-105927: PyImport_AddModule() uses _PyWeakref_GET_REF() (#106001)
It now raises an exception if sys.modules doesn't hold a strong
reference to the module.

Elaborate the comment explaining why a weak reference is used to
create a borrowed reference.
2023-06-23 01:23:08 +02:00
Victor Stinner 193a2b2eaa
gh-105922: Use PyImport_AddModuleRef() function (#105999)
Replace PyImport_AddModuleObject() + Py_XNewRef() with
PyImport_AddModuleRef() to get directly a strong reference.
2023-06-23 00:04:39 +02:00
chgnrdv cd5280367a
gh-105979: Fix exception handling in `unmarshal_frozen_code` (`Python/import.c`) (#105980) 2023-06-22 21:30:19 +00:00
Victor Stinner 46a3190fcf
gh-105927: Avoid calling PyWeakref_GET_OBJECT() (#105997)
* Replace PyWeakref_GET_OBJECT() with _PyWeakref_GET_REF().
* _sqlite/blob.c now holds a strong reference to the blob object
  while calling close_blob().
* _xidregistry_find_type() now holds a strong reference to registered
  while using it.
2023-06-22 22:31:31 +02:00
YAMAMOTO Takashi d8f87cdf94
gh-101538: Add experimental wasi-threads build (#101537)
Co-authored-by: Brett Cannon <brett@python.org>
Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
2023-06-22 11:26:10 -07:00
Mark Shannon 04492cbc9a
GH-91095: Specialize calls to normal Python classes. (GH-99331) 2023-06-22 09:48:19 +01:00
Victor Stinner 4328dc6465
gh-105927: finalize_modules_clear_weaklist() uses _PyWeakref_GET_REF() (#105971)
finalize_modules_clear_weaklist() now holds a strong reference to the
module longer than before: replace PyWeakref_GET_OBJECT() with
_PyWeakref_GET_REF().
2023-06-21 21:50:20 +02:00
Victor Stinner 03f1a132ee
gh-105922: Add PyImport_AddModuleRef() function (#105923)
* Add tests on PyImport_AddModuleRef(), PyImport_AddModule() and
  PyImport_AddModuleObject().
* pythonrun.c: Replace Py_XNewRef(PyImport_AddModule(name)) with
  PyImport_AddModuleRef(name).
2023-06-20 08:48:14 +02:00
Victor Stinner a5c2ad0c3d
gh-105922: Refactor PyRun_InteractiveOneObjectEx() (#105925)
Refactor PyRun_InteractiveOneObjectEx(), _PyRun_SimpleFileObject()
and PyRun_SimpleStringFlags():

* Keep a strong reference to the __main__ module while using its
  dictionary (PyModule_GetDict()). Use PyImport_AddModule() with
  Py_XNewRef().
* Declare variables closer to where they are defined.
* Rename variables to use name longer than 1 character.
* Add pyrun_one_parse_ast() sub-function.
2023-06-20 00:55:23 +02:00
Irit Katriel 33f0a8578b
gh-105481: generate _specializations and _specialized_instructions from bytecodes.c (#105913) 2023-06-19 23:47:04 +01:00
Crowthebird 28187a9c4f
gh-105908: fix `barry_as_FLUFL` future import (#105909) 2023-06-19 22:50:57 +01:00
Mark Shannon 581619941e
GH-104584: Assorted fixes for the optimizer API. (GH-105683)
* Add test for long loops

* Clear ENTER_EXECUTOR when deopting code objects.
2023-06-19 10:32:20 +01:00
Irit Katriel 14d01262da
gh-105481: remove HAS_ARG, HAS_CONST, IS_JUMP_OPCODE, IS_PSEUDO_OPCODE and replace by their new versions (#105865) 2023-06-17 17:00:16 +01:00
Brandt Bucher 2beab5bdef
GH-105840: Fix assertion failures when specializing calls with too many __defaults__ (GH-105847) 2023-06-16 11:01:15 -07:00
Brandt Bucher a4056c8f9c
GH-105588: Add missing error checks to some obj2ast_* converters (GH-105589) 2023-06-15 15:45:13 -07:00
Irit Katriel d1b0297d3e
gh-105481: add HAS_JUMP flag to opcode metadata (#105791) 2023-06-14 23:14:22 +00:00
Mark Shannon 1d857da7f0
GH-77273: Better bytecodes for f-strings (GH-6132) 2023-06-14 16:15:08 +01:00
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
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 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
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
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
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
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 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 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
Erlend E. Aasland d4fa52934a
gh-105375: Improve error handling in the builtins extension module (#105585) 2023-06-11 12:20:43 +02:00
Erlend E. Aasland 6c832ddcf2
gh-105375: Improve error handling in compiler_enter_scope() (#105494) 2023-06-09 18:55:53 +02:00
Pablo Galindo Salgado d7f46bcd98
gh-105564: Don't include artificial newlines in the line attribute of tokens (#105565) 2023-06-09 17:01:26 +01:00
Victor Stinner 3e525d2212
gh-105396: Deprecate PyImport_ImportModuleNoBlock() function (#105397)
Deprecate the PyImport_ImportModuleNoBlock() function which is just
an alias to PyImport_ImportModule() since Python 3.3.
2023-06-09 10:30:57 +02:00
Eric Snow 68dfa49627
gh-100227: Lock Around Modification of the Global Allocators State (gh-105516)
The risk of a race with this state is relatively low, but we play it safe anyway. We do avoid using the lock in performance-sensitive cases where the risk of a race is very, very low.
2023-06-08 14:06:54 -06:00
Eric Snow e822a676f1
gh-100227: Lock Around Adding Global Audit Hooks (gh-105515)
The risk of a race with this state is relatively low, but we play it safe anyway.
2023-06-08 18:38:15 +00:00
Eric Snow 7799c8e678
gh-100227: Lock Around Use of the Global "atexit" State (gh-105514)
The risk of a race with this state is relatively low, but we play it safe anyway.
2023-06-08 18:08:28 +00:00
Mark Shannon e830289c52
GH-105229: Remove remaining two-codeunit superinstructions (GH-105326)
* Remove LOAD_CONST__LOAD_FAST and LOAD_FAST__LOAD_CONST superinstructions.
2023-06-08 12:35:34 +01:00
Dong-hee Na aa5b762bd3
gh-104635: Eliminate redundant STORE_FAST instructions in the compiler (gh-105320) 2023-06-08 08:39:56 +09:00
Kirill Podoprigora 264a0110ff
gh-105390: Add explicit type cast (#105466) 2023-06-07 20:20:43 +00:00
Mark Shannon 064de0e3fc
GH-104610: Remove the use of `PREDICT` macros. (GH-104651) 2023-06-07 17:04:53 +01:00
Pablo Galindo Salgado 7279fb6408
gh-105435: Fix spurious NEWLINE token if file ends with comment without a newline (#105442) 2023-06-07 13:31:48 +01:00
Pablo Galindo Salgado ffd2654550
gh-105390: Correctly raise TokenError instead of SyntaxError for tokenize errors (#105399) 2023-06-07 12:04:40 +01:00
Pablo Galindo Salgado c0a6ed3934
gh-105259: Ensure we don't show newline characters for trailing NEWLINE tokens (#105364) 2023-06-06 12:52:16 +01:00
Dong-hee Na 058b960535
gh-103906: Remove immortal refcounting in compile/marshal.c (gh-103922) 2023-06-05 22:38:36 +09:00
Jelle Zijlstra 69d1245685
gh-105164: Detect annotations inside match blocks (#105177) 2023-06-05 06:07:17 -07:00
Mark Shannon 0689340366
GH-105229: Replace some superinstructions with single instruction equivalent. (GH-105230) 2023-06-05 11:07:04 +01:00
Mark Shannon e8ecb9ee6b
GH-104584: Allow optimizers to opt out of optimizing. (GH-105244) 2023-06-05 09:44:23 +01:00
Irit Katriel 94a1eea511
gh-103277: remove unused macros (#105247) 2023-06-03 05:12:07 -06:00
Dong-hee Na 2f5c1ae080
gh-87092: avoid gcc warning on uninitialized struct field in assemble… (gh-105243)
gh-87092: avoid gcc warning on uninitialized struct field in assemble.c (part2)
2023-06-02 16:00:50 +00:00
Jelle Zijlstra 44bb03f856
gh-105214: Use named constants for MAKE_FUNCTION oparg (#105215) 2023-06-02 14:10:45 +00:00
Mark Shannon 4bfa01b9d9
GH-104584: Plugin optimizer API (GH-105100) 2023-06-02 11:46:18 +01:00
Irit Katriel ee26ca13a1
gh-105184: document that marshal functions can fail and need to be checked with PyErr_Occurred (#105185) 2023-06-02 08:59:18 +01:00
Jelle Zijlstra 77d2579586
gh-104799: Default missing lists in AST to the empty list (#104834)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2023-06-01 18:39:39 -07:00
Victor Stinner ef300937c2
gh-92536: Remove PyUnicode_READY() calls (#105210)
Since Python 3.12, PyUnicode_READY() does nothing and always
returns 0.
2023-06-02 01:33:17 +02:00
Victor Stinner cbb9ba844f
gh-92536: Argument Clinic no longer emits PyUnicode_READY() (#105208)
Since Python 3.12, PyUnicode_READY() does nothing and always
returns 0.

Argument Clinic now also checks for .cpp files (PC/_wmimodule.cpp).
2023-06-02 01:31:58 +02:00
Eric Snow 3698fda06e
gh-104341: Call _PyEval_ReleaseLock() with NULL When Finalizing the Current Thread (gh-105109)
This avoids the problematic race in drop_gil() by skipping the FORCE_SWITCHING code there for finalizing threads.

(The idea for this approach came out of discussions with @markshannon.)
2023-06-01 16:24:10 -06:00
Irit Katriel 60f8117d0c
gh-105140: remove unused arg of _PyErr_ChainStackItem (#105141) 2023-06-01 20:57:28 +00:00
Victor Stinner ec0082ca46
gh-105182: Remove PyEval_AcquireLock() and PyEval_InitThreads() (#105183)
Remove functions in the C API:

* PyEval_AcquireLock()
* PyEval_ReleaseLock()
* PyEval_InitThreads()
* PyEval_ThreadsInitialized()

But keep these functions in the stable ABI.

Mention "make regen-limited-abi" in "make regen-all".
2023-06-01 13:41:56 +02:00
Irit Katriel 76b9c0cfaa
remove unused #includes of pycore_pymem.h (#105166) 2023-06-01 12:12:53 +01: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
Irit Katriel f990bb8b2d
gh-105148: make _PyASTOptimizeState internal to ast_opt.c (#105149) 2023-05-31 20:21:46 +01:00
Guido van Rossum df396b59af
gh-104909: Split BINARY_OP into micro-ops (#104910)
Co-authored-by: Brandt Bucher <brandtbucher@gmail.com>
2023-05-31 08:09:23 -07:00
Inada Naoki adccff3b3f
gh-104922: Make `PY_SSIZE_T_CLEAN` not mandatory again (#105051) 2023-05-31 18:38:55 +09:00