aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/Python/pythonrun.c
Commit message (Collapse)AuthorAge
* gh-131238: Remove more includes from pycore_interp.h (#131480)Victor Stinner2025-03-19
|
* gh-130080: implement PEP 765 (#130087)Irit Katriel2025-03-17
|
* GH-131238: More refactoring of core header files (GH-131351)Mark Shannon2025-03-17
| | | | Adds new pycore_stats.h header file to help break dependencies involving the pycore_code.h header.
* gh-117174: Add a new route in linecache to fetch interactive source code ↵Pablo Galindo Salgado2025-03-10
| | | | (#117500)
* Postpone <stdbool.h> inclusion after Python.h (#130641)Hugo Beauzée-Luyssen2025-02-28
| | | | | | | Remove inclusions prior to Python.h. <stdbool.h> will cause <features.h> to be included before Python.h can define some macros to enable some additional features, causing multiple types not to be defined down the line.
* gh-130163: Fix crashes related to PySys_GetObject() (GH-130503)Serhiy Storchaka2025-02-25
| | | | | | | | The use of PySys_GetObject() and _PySys_GetAttr(), which return a borrowed reference, has been replaced by using one of the following functions, which return a strong reference and distinguish a missing attribute from an error: _PySys_GetOptionalAttr(), _PySys_GetOptionalAttrString(), _PySys_GetRequiredAttr(), and _PySys_GetRequiredAttrString().
* GH-130396: Use computed stack limits on linux (GH-130398)Mark Shannon2025-02-25
| | | | | | | | | | | * Implement C recursion protection with limit pointers for Linux, MacOS and Windows * Remove calls to PyOS_CheckStack * Add stack protection to parser * Make tests more robust to low stacks * Improve error messages for stack overflow
* GH-91079: Revert "GH-91079: Implement C stack limits using addresses, not ↵Petr Viktorin2025-02-24
| | | | | | | | | counters. (GH-130007)" for now (GH130413) Revert "GH-91079: Implement C stack limits using addresses, not counters. (GH-130007)" for now Unfortunatlely, the change broke some buildbots. This reverts commit 2498c22fa0a2b560491bc503fa676585c1a603d0.
* GH-91079: Implement C stack limits using addresses, not counters. (GH-130007)Mark Shannon2025-02-19
| | | | | | | | | | | | * Implement C recursion protection with limit pointers * Remove calls to PyOS_CheckStack * Add stack protection to parser * Make tests more robust to low stacks * Improve error messages for stack overflow
* gh-128130: Fix unhandled keyboard interrupt data race (gh-129975)Sam Gross2025-02-13
| | | | | | | | | | Use an atomic operation when setting `_PyRuntime.signals.unhandled_keyboard_interrupt`. We now only clear the variable at the start of `_PyRun_Main`, which is the same function where we check it. This avoids race conditions where previously another thread might call `run_eval_code_obj()` and erroneously clear the unhandled keyboard interrupt.
* gh-128911: Use PyImport_ImportModuleAttr() function (#129657)Victor Stinner2025-02-05
| | | | | | * Replace PyImport_ImportModule() + PyObject_GetAttr() with PyImport_ImportModuleAttr(). * Replace PyImport_ImportModule() + PyObject_GetAttrString() with PyImport_ImportModuleAttrString().
* gh-127350: Add Py_fopen() and Py_fclose() functions (#127821)Victor Stinner2025-01-06
|
* Free arena on _PyCompile_AstOptimize failure in Py_CompileStringObject ↵Berker Peksag2024-12-16
| | | | | | (GH-127910) After commit 10a91d7e9 introduced arena cleanup, commit 2dfbd4f36 removed the free call when _PyCompile_AstOptimize fails.
* gh-125842: Fix `sys.exit(0xffff_ffff)` on Windows (#125896)Sam Gross2024-10-24
| | | | | | | | | | On Windows, `long` is a signed 32-bit integer so it can't represent `0xffff_ffff` without overflow. Windows exit codes are unsigned 32-bit integers, so if a child process exits with `-1`, it will be represented as `0xffff_ffff`. Also fix a number of other possible cases where `_Py_HandleSystemExit` could return with an exception set, leading to a `SystemError` (or fatal error in debug builds) later on during shutdown.
* gh-125604: Move _Py_AuditHookEntry, etc. Out of pycore_runtime.h (gh-125605)Eric Snow2024-10-18
| | | | | | | | | | | | This is essentially a cleanup, moving a handful of API declarations to the header files where they fit best, creating new ones when needed. We do the following: * add pycore_debug_offsets.h and move _Py_DebugOffsets, etc. there * inline struct _getargs_runtime_state and struct _gilstate_runtime_state in _PyRuntimeState * move struct _reftracer_runtime_state to the existing pycore_object_state.h * add pycore_audit.h and move to it _Py_AuditHookEntry , _PySys_Audit(), and _PySys_ClearAuditHooks * add audit.h and cpython/audit.h and move the existing audit-related API there *move the perfmap/trampoline API from cpython/sysmodule.h to cpython/ceval.h, and remove the now-empty cpython/sysmodule.h
* gh-121804: always show error location for SyntaxError's in basic repl (#123202)Sergey B Kirpichev2024-09-03
|
* gh-111201: A new Python REPL (GH-111567)Pablo Galindo Salgado2024-05-05
| | | | | | | Co-authored-by: Łukasz Langa <lukasz@langa.pl> Co-authored-by: Marta Gómez Macías <mgmacias@google.com> Co-authored-by: Lysandros Nikolaou <lisandrosnik@gmail.com> Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com> Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
* gh-116180: Check the globals argument in PyRun_* C API (GH-116637)NGRsoftlab2024-05-02
| | | | | It used to crash when passing NULL or non-dict as globals. Now it sets a SystemError.
* gh-116437: Use new C API PyDict_Pop() to simplify the code (GH-116438)Serhiy Storchaka2024-03-07
|
* gh-115914: minor cleanup: simplify filename_obj assignment in ↵Sergii K2024-02-25
| | | | | PyRun_AnyFileExFlags (gh-115916) This simplifies the code: less lines, easier to read. Logically equivalent, as any compiler likely already determined.
* gh-108082: Use PyErr_FormatUnraisable() (GH-111580)Serhiy Storchaka2023-11-02
| | | | | | Replace most of calls of _PyErr_WriteUnraisableMsg() and some calls of PyErr_WriteUnraisable(NULL) with PyErr_FormatUnraisable(). Co-authored-by: Victor Stinner <vstinner@python.org>
* gh-67224: Show source lines in tracebacks when using the -c option when ↵Pablo Galindo Salgado2023-10-26
| | | | running Python (#111200)
* gh-111132: Fix crash on interactive_filename in `run_mod` (#111136)Nikita Sobolev2023-10-20
|
* gh-110912: Correctly display tracebacks for MemoryError exceptions using the ↵Pablo Galindo Salgado2023-10-16
| | | | traceback module (#110921)
* gh-110805: Allow the repl to show source code and complete tracebacks (#110775)Pablo Galindo Salgado2023-10-13
|
* gh-110721: Use the traceback module for PyErr_Display() and fallback to the ↵Pablo Galindo Salgado2023-10-12
| | | | C implementation (#110702)
* gh-110079: Remove extern "C" { ...} in C code (#110080)Victor Stinner2023-09-29
|
* gh-109611: Add convenient C API function _PyFile_Flush() (GH-109612)Serhiy Storchaka2023-09-23
|
* gh-109179: Fix traceback display for SyntaxErrors with notes (#109197)Irit Katriel2023-09-11
|
* gh-108765: Cleanup #include in Python/*.c files (#108977)Victor Stinner2023-09-06
| | | Mention one symbol imported by each #include.
* gh-106320: Remove private pythonrun API (#108599)Victor Stinner2023-08-29
| | | | | | | | | | | Remove these private functions from the public C API: * _PyRun_AnyFileObject() * _PyRun_InteractiveLoopObject() * _PyRun_SimpleFileObject() * _Py_SourceAsString() Move them to the internal C API: add a new pycore_pythonrun.h header file. No longer export these functions.
* gh-108308: Remove _PyDict_GetItemStringWithError() function (#108426)Victor Stinner2023-08-24
| | | | | | | | Remove the internal _PyDict_GetItemStringWithError() function. It can now be replaced with the new public PyDict_ContainsString() and PyDict_GetItemStringRef() functions. getargs.c now now uses a strong reference for current_arg. find_keyword() returns a strong reference.
* gh-108314: Add PyDict_ContainsString() function (#108323)Victor Stinner2023-08-24
|
* gh-108113: Make it possible to optimize an AST (#108282)Irit Katriel2023-08-23
|
* gh-106320: Remove _PyDict_GetItemStringWithError() function (#108313)Victor Stinner2023-08-22
| | | | | | | | | Remove private _PyDict_GetItemStringWithError() function of the public C API: the new PyDict_GetItemStringRef() can be used instead. * Move private _PyDict_GetItemStringWithError() to the internal C API. * _testcapi get_code_extra_index() uses PyDict_GetItemStringRef(). Avoid using private functions in _testcapi which tests the public C API.
* gh-108113: Make it possible to create an optimized AST (#108154)Irit Katriel2023-08-21
|
* gh-106521: Remove _PyObject_LookupAttr() function (GH-106642)Serhiy Storchaka2023-07-12
|
* gh-106023: Update code using _PyObject_FastCall() (#106257)Victor Stinner2023-06-30
| | | Replace _PyObject_FastCall() calls with PyObject_Vectorcall().
* gh-106084: Remove old PyObject call aliases (#106085)Victor Stinner2023-06-26
| | | | | | | | | | | | | | 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-23
| | | | | | | | (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-105922: Use PyImport_AddModuleRef() function (#105999)Victor Stinner2023-06-23
| | | | Replace PyImport_AddModuleObject() + Py_XNewRef() with PyImport_AddModuleRef() to get directly a strong reference.
* gh-105922: Add PyImport_AddModuleRef() function (#105923)Victor Stinner2023-06-20
| | | | | | * 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-20
| | | | | | | | | | | 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-103895: Improve how invalid `Exception.__notes__` are displayed (#103897)Carey Metcalfe2023-05-01
|
* gh-102192: Replace PyErr_Fetch/Restore etc by more efficient alternatives ↵Irit Katriel2023-03-19
| | | | (#102816)
* gh-102778: Add sys.last_exc, deprecate sys.last_type, ↵Irit Katriel2023-03-18
| | | | sys.last_value,sys.last_traceback (#102779)
* gh-102755: Add PyErr_DisplayException(exc) (#102756)Irit Katriel2023-03-16
|
* gh-102192: Replace PyErr_Fetch/Restore etc by more efficient alternatives ↵Irit Katriel2023-03-16
| | | | (#102743)
* gh-102056: Fix a few bugs in error handling of exception printing code (#102078)Irit Katriel2023-02-20
|
* gh-101758: Clean Up Uses of Import State (gh-101919)Eric Snow2023-02-15
| | | | | | | | | | | | | | | This change is almost entirely moving code around and hiding import state behind internal API. We introduce no changes to behavior, nor to non-internal API. (Since there was already going to be a lot of churn, I took this as an opportunity to re-organize import.c into topically-grouped sections of code.) The motivation is to simplify a number of upcoming changes. Specific changes: * move existing import-related code to import.c, wherever possible * add internal API for interacting with import state (both global and per-interpreter) * use only API outside of import.c (to limit churn there when changing the location, etc.) * consolidate the import-related state of PyInterpreterState into a single struct field (this changes layout slightly) * add macros for import state in import.c (to simplify changing the location) * group code in import.c into sections *remove _PyState_AddModule() https://github.com/python/cpython/issues/101758