summaryrefslogtreecommitdiffstats
path: root/Python
Commit message (Collapse)AuthorAgeFilesLines
...
* gh-104584: Emit macro expansions to opcode_metadata.h (#106163)Guido van Rossum2023-06-283-6/+40
| | | | | | | 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.)
* gh-106118: Add O_CLOEXEC preprocessor guard (#106120)Erlend E. Aasland2023-06-281-1/+4
|
* gh-106084: Remove _PyObject_CallMethod() function (#106159)Victor Stinner2023-06-271-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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()
* gh-104584: Change DEOPT_IF in uops executor (#106146)Guido van Rossum2023-06-272-12/+7
| | | 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!
* gh-106149: move jump target resolution from optimizer to assembler (#106150)Irit Katriel2023-06-273-100/+108
|
* gh-104584: Fix assert in DEOPT macro -- should fix buildbot (#106131)Guido van Rossum2023-06-271-1/+2
|
* gh-104584: Add #line directives to executor_cases.c.h (#106126)Guido van Rossum2023-06-271-0/+254
|
* gh-104584: Baby steps towards generating and executing traces (#105924)Guido van Rossum2023-06-279-271/+2326
| | | | | 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.
* gh-106084: Remove old PyObject call aliases (#106085)Victor Stinner2023-06-265-7/+7
| | | | | | | | | | | | | | 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.
* gh-106033: Get rid of new occurrences of PyDict_GetItem and PyObject_HasAttr ↵Serhiy Storchaka2023-06-231-7/+5
| | | | | | | | (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.
* gh-106030: Miscellaneous fixes in Python/suggestions.c (GH-106031)Serhiy Storchaka2023-06-231-15/+27
| | | | | | | | | | * 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.
* GH-106012: Fix monitoring of static code objects (GH-106017)Mark Shannon2023-06-231-13/+18
|
* gh-105927: PyImport_AddModule() uses _PyWeakref_GET_REF() (#106001)Victor Stinner2023-06-221-3/+19
| | | | | | | 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.
* gh-105922: Use PyImport_AddModuleRef() function (#105999)Victor Stinner2023-06-222-3/+2
| | | | Replace PyImport_AddModuleObject() + Py_XNewRef() with PyImport_AddModuleRef() to get directly a strong reference.
* gh-105979: Fix exception handling in `unmarshal_frozen_code` ↵chgnrdv2023-06-221-0/+1
| | | | (`Python/import.c`) (#105980)
* gh-105927: Avoid calling PyWeakref_GET_OBJECT() (#105997)Victor Stinner2023-06-221-3/+6
| | | | | | | * 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.
* gh-101538: Add experimental wasi-threads build (#101537)YAMAMOTO Takashi2023-06-221-0/+8
| | | | Co-authored-by: Brett Cannon <brett@python.org> Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
* GH-91095: Specialize calls to normal Python classes. (GH-99331)Mark Shannon2023-06-228-107/+346
|
* gh-105927: finalize_modules_clear_weaklist() uses _PyWeakref_GET_REF() (#105971)Victor Stinner2023-06-211-4/+5
| | | | | finalize_modules_clear_weaklist() now holds a strong reference to the module longer than before: replace PyWeakref_GET_OBJECT() with _PyWeakref_GET_REF().
* gh-105922: Add PyImport_AddModuleRef() function (#105923)Victor Stinner2023-06-202-12/+31
| | | | | | * Add tests on PyImport_AddModuleRef(), PyImport_AddModule() and PyImport_AddModuleObject(). * pythonrun.c: Replace Py_XNewRef(PyImport_AddModule(name)) with PyImport_AddModuleRef(name).
* gh-105922: Refactor PyRun_InteractiveOneObjectEx() (#105925)Victor Stinner2023-06-191-74/+108
| | | | | | | | | | | 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.
* gh-105481: generate _specializations and _specialized_instructions from ↵Irit Katriel2023-06-193-53/+55
| | | | bytecodes.c (#105913)
* gh-105908: fix `barry_as_FLUFL` future import (#105909)Crowthebird2023-06-191-6/+10
|
* GH-104584: Assorted fixes for the optimizer API. (GH-105683)Mark Shannon2023-06-193-191/+210
| | | | | | * Add test for long loops * Clear ENTER_EXECUTOR when deopting code objects.
* gh-105481: remove HAS_ARG, HAS_CONST, IS_JUMP_OPCODE, IS_PSEUDO_OPCODE and ↵Irit Katriel2023-06-174-27/+19
| | | | replace by their new versions (#105865)
* GH-105840: Fix assertion failures when specializing calls with too many ↵Brandt Bucher2023-06-161-2/+2
| | | | __defaults__ (GH-105847)
* GH-105588: Add missing error checks to some obj2ast_* converters (GH-105589)Brandt Bucher2023-06-151-0/+7
|
* gh-105481: add HAS_JUMP flag to opcode metadata (#105791)Irit Katriel2023-06-146-165/+185
|
* GH-77273: Better bytecodes for f-strings (GH-6132)Mark Shannon2023-06-146-373/+389
|
* GH-100987: Allow objects other than code objects as the "executable" of an ↵Mark Shannon2023-06-1415-477/+473
| | | | | | | | | | 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.
* gh-105699: Use a Thread-Local Variable for PKGCONTEXT (gh-105740)Eric Snow2023-06-141-0/+15
| | | 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.
* gh-104812: Run Pending Calls in any Thread (gh-104813)Eric Snow2023-06-134-83/+191
| | | 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.
* gh-105481: add flags to each instr in the opcode metadata table, to replace ↵Irit Katriel2023-06-135-609/+627
| | | | opcode.hasarg/hasname/hasconst (#105482)
* gh-105603: Change the PyInterpreterConfig.own gil Field (gh-105620)Eric Snow2023-06-131-4/+15
| | | We are changing it to be more flexible that a strict bool can be for possible future expanded used cases.
* GH-105678: Split MAKE_FUNCTION into MAKE_FUNCTION and SET_FUNCTION_ATTRIBUTE ↵Mark Shannon2023-06-135-337/+373
| | | | (GH-105680)
* gh-105673: Fix uninitialized warning in sysmodule.c (#105674)Nikita Sobolev2023-06-121-1/+1
| | | In sys_add_xoption(), 'value' may be uninitialized for some error paths.
* gh-105481: add pseudo-instructions to the bytecodes DSL (#105506)Irit Katriel2023-06-116-257/+396
|
* gh-105375: Improve error handling in the sys extension module (#105611)Erlend E. Aasland2023-06-111-6/+18
| | | | | In _PySys_AddXOptionWithError() and sys_add_xoption(), bail on first error to prevent exceptions from possibly being overwritten.
* gh-105375: Improve PyErr_WarnExplicit() error handling (#105610)Erlend E. Aasland2023-06-111-12/+16
| | | | Bail on first error to prevent exceptions from possibly being overwritten.
* gh-105375: Improve error handling in the builtins extension module (#105585)Erlend E. Aasland2023-06-111-8/+32
|
* gh-105375: Improve error handling in compiler_enter_scope() (#105494)Erlend E. Aasland2023-06-091-1/+5
|
* gh-105564: Don't include artificial newlines in the line attribute of tokens ↵Pablo Galindo Salgado2023-06-091-0/+3
| | | | (#105565)
* gh-105396: Deprecate PyImport_ImportModuleNoBlock() function (#105397)Victor Stinner2023-06-091-0/+6
| | | | Deprecate the PyImport_ImportModuleNoBlock() function which is just an alias to PyImport_ImportModule() since Python 3.3.
* gh-100227: Lock Around Modification of the Global Allocators State (gh-105516)Eric Snow2023-06-081-1/+2
| | | 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.
* gh-100227: Lock Around Adding Global Audit Hooks (gh-105515)Eric Snow2023-06-082-20/+43
| | | The risk of a race with this state is relatively low, but we play it safe anyway.
* gh-100227: Lock Around Use of the Global "atexit" State (gh-105514)Eric Snow2023-06-082-25/+27
| | | The risk of a race with this state is relatively low, but we play it safe anyway.
* GH-105229: Remove remaining two-codeunit superinstructions (GH-105326)Mark Shannon2023-06-087-588/+495
| | | | * Remove LOAD_CONST__LOAD_FAST and LOAD_FAST__LOAD_CONST superinstructions.
* gh-104635: Eliminate redundant STORE_FAST instructions in the compiler ↵Dong-hee Na2023-06-071-5/+18
| | | | (gh-105320)
* gh-105390: Add explicit type cast (#105466)Kirill Podoprigora2023-06-071-1/+2
|
* GH-104610: Remove the use of `PREDICT` macros. (GH-104651)Mark Shannon2023-06-073-551/+507
|