summaryrefslogtreecommitdiffstats
path: root/Include
Commit message (Collapse)AuthorAgeFilesLines
* bpo-40334: Improve various PEG-Parser related stuff (GH-19669)Lysandros Nikolaou2020-04-231-2/+4
| | | The changes in this commit are all related to @vstinner's original review comments of the initial PEP 617 implementation PR.
* bpo-40334: Rename PyConfig.use_peg to _use_peg_parser (GH-19670)Victor Stinner2020-04-231-1/+1
| | | | | | | | | | | * Rename PyConfig.use_peg to _use_peg_parser * Document PyConfig._use_peg_parser and mark it a deprecated * Mark -X oldparser option and PYTHONOLDPARSER env var as deprecated in the documentation. * Add use_old_parser() and skip_if_new_parser() to test.support * Remove sys.flags.use_peg: use_old_parser() uses _testinternalcapi.get_configs() instead. * Enhance test_embed tests * subprocess._args_from_interpreter_flags() copies -X oldparser
* bpo-40334: PEP 617 implementation: New PEG parser for CPython (GH-19503)Pablo Galindo2020-04-223-0/+39
| | | | Co-authored-by: Guido van Rossum <guido@python.org> Co-authored-by: Lysandros Nikolaou <lisandrosnik@gmail.com>
* bpo-39562: Prevent collision of future and compiler flags (GH-19230)Batuhan Taşkaya2020-04-222-13/+19
| | | | | | The constant values of future flags in the __future__ module is updated in order to prevent collision with compiler flags. Previously PyCF_ALLOW_TOP_LEVEL_AWAIT was clashing with CO_FUTURE_DIVISION.
* bpo-40302: Replace PY_INT64_T with int64_t (GH-19573)Victor Stinner2020-04-171-1/+1
| | | | | | | | | * Replace PY_INT64_T with int64_t * Replace PY_UINT32_T with uint32_t * Replace PY_UINT64_T with uint64_t sha3module.c no longer checks if PY_UINT64_T is defined since it's always defined and uint64_t is always available on platforms supported by Python.
* bpo-40302: Add pycore_byteswap.h header file (GH-19552)Victor Stinner2020-04-172-4/+93
| | | | | | | | | | | | | | Add a new internal pycore_byteswap.h header file with the following functions: * _Py_bswap16() * _Py_bswap32() * _Py_bswap64() Use these functions in _ctypes, sha256 and sha512 modules, and also use in the UTF-32 encoder. sha256, sha512 and _ctypes modules are now built with the internal C API.
* bpo-40267: Fix message when last input character produces a SyntaxError ↵Lysandros Nikolaou2020-04-151-0/+4
| | | | | | | | (GH-19521) When there is a SyntaxError after reading the last input character from the tokenizer and if no newline follows it, the error message used to be `unexpected EOF while parsing`, which is wrong.
* bpo-40268: Remove explicit pythread.h includes (#19529)Victor Stinner2020-04-152-2/+1
| | | | Remove explicit pythread.h includes: it is always included by Python.h.
* bpo-40170: Convert PyObject_IS_GC() macro to a function (GH-19464)Hai Shi2020-04-142-4/+12
|
* bpo-40268: Move struct _gc_runtime_state to pycore_gc.h (GH-19515)Victor Stinner2020-04-143-102/+101
|
* bpo-40232: Update PyOS_AfterFork_Child() to use _PyThread_at_fork_reinit() ↵Dong-hee Na2020-04-143-3/+7
| | | | (GH-19450)
* bpo-40268: Rename _PyInterpreterState_GET_UNSAFE() (GH-19509)Victor Stinner2020-04-142-2/+3
| | | | | | | Rename _PyInterpreterState_GET_UNSAFE() to _PyInterpreterState_GET() for consistency with _PyThreadState_GET() and to have a shorter name (help to fit into 80 columns). Add also "assert(tstate != NULL);" to the function.
* bpo-40268: Include explicitly pycore_interp.h (GH-19505)Victor Stinner2020-04-143-5/+6
| | | | pycore_pystate.h no longer includes pycore_interp.h: it's now included explicitly in files accessing PyInterpreterState.
* bpo-40241: Add pycore_interp.h header (GH-19499)Victor Stinner2020-04-132-165/+184
| | | | Move PyInterpreterState and related functions to a new internal pycore_interp.h header file.
* bpo-40268: Add pycore_runtime.h header file (GH-19493)Victor Stinner2020-04-132-121/+144
| | | | | | Move PyRuntimeState from pycore_pystate.h to pycore_runtime.h. Remove _PyGILState_check_enabled macro: access directly _PyRuntime.gilstate.check_enabled.
* bpo-40241: Add pycore_gc.h header file (GH-19494)Victor Stinner2020-04-133-56/+77
| | | | | | | | | | | | | | | | | | | | | | | | | | | Move the PyGC_Head structure and the following private macros to the internal C API: * _PyGCHead_FINALIZED() * _PyGCHead_NEXT() * _PyGCHead_PREV() * _PyGCHead_SET_FINALIZED() * _PyGCHead_SET_NEXT() * _PyGCHead_SET_PREV() * _PyGC_FINALIZED() * _PyGC_PREV_MASK * _PyGC_PREV_MASK_COLLECTING * _PyGC_PREV_MASK_FINALIZED * _PyGC_PREV_SHIFT * _PyGC_SET_FINALIZED() * _PyObject_GC_IS_TRACKED() * _PyObject_GC_MAY_BE_TRACKED() * _Py_AS_GC(o) Keep the private _PyGC_FINALIZED() macro in the public C API for backward compatibility with Python 3.8: make it an alias to the new PyObject_GC_IsFinalized() function. Move the SIZEOF_PYGC_HEAD constant from _testcapi module to _testinternalcapi module.
* bpo-40268: Add _PyInterpreterState_GetConfig() (GH-19492)Victor Stinner2020-04-132-0/+11
| | | | | | | | Don't access PyInterpreterState.config member directly anymore, but use new functions: * _PyInterpreterState_GetConfig() * _PyInterpreterState_SetConfig() * _Py_GetConfig()
* bpo-40246: Report a better error message for invalid string prefixes (GH-19476)Lysandros Nikolaou2020-04-121-0/+1
|
* bpo-40241: Add PyObject_GC_IsTracked and PyObject_GC_IsFinalized to the ↵Pablo Galindo2020-04-111-0/+2
| | | | | public C-API (GH-19461) Add the functions PyObject_GC_IsTracked and PyObject_GC_IsFinalized to the public API to allow to query if Python objects are being currently tracked or have been already finalized by the garbage collector respectively.
* bpo-40082: trip_signal() uses the main interpreter (GH-19441)Victor Stinner2020-04-082-6/+11
| | | | | | | | | | | | | | | | | | | | | | Fix the signal handler: it now always uses the main interpreter, rather than trying to get the current Python thread state. The following function now accepts an interpreter, instead of a Python thread state: * _PyEval_SignalReceived() * _Py_ThreadCanHandleSignals() * _PyEval_AddPendingCall() * COMPUTE_EVAL_BREAKER() * SET_GIL_DROP_REQUEST(), RESET_GIL_DROP_REQUEST() * SIGNAL_PENDING_CALLS(), UNSIGNAL_PENDING_CALLS() * SIGNAL_PENDING_SIGNALS(), UNSIGNAL_PENDING_SIGNALS() * SIGNAL_ASYNC_EXC(), UNSIGNAL_ASYNC_EXC() Py_AddPendingCall() now uses the main interpreter if it fails to the current Python thread state. Convert _PyThreadState_GET() and PyInterpreterState_GET_UNSAFE() macros to static inline functions.
* bpo-37127: Remove _pending_calls.finishing (GH-19439)Victor Stinner2020-04-081-1/+0
|
* bpo-40226: PyInterpreterState_Delete() deletes pending calls (GH-19436)Victor Stinner2020-04-081-3/+4
| | | | | | | | | | | | | | | PyInterpreterState_New() is now responsible to create pending calls, PyInterpreterState_Delete() now deletes pending calls. * Rename _PyEval_InitThreads() to _PyEval_InitGIL() and rename _PyEval_InitGIL() to _PyEval_FiniGIL(). * _PyEval_InitState() and PyEval_FiniState() now create and delete pending calls. _PyEval_InitState() now returns -1 on memory allocation failure. * Add init_interp_create_gil() helper function: code shared by Py_NewInterpreter() and Py_InitializeFromConfig(). * init_interp_create_gil() now also calls _PyEval_FiniGIL(), _PyEval_InitGIL() and _PyGILState_Init() in subinterpreters, but these functions now do nothing when called from a subinterpreter.
* Remove extraneous ')' in abstract.h (GH-19146)Jimmy Yang2020-04-081-1/+1
|
* bpo-40170: Remove PyIndex_Check() macro (GH-19428)Victor Stinner2020-04-081-6/+0
| | | | | Always declare PyIndex_Check() as an opaque function to hide implementation details: remove PyIndex_Check() macro. The macro accessed directly the PyTypeObject.tp_as_number member.
* bpo-40170: Add _PyIndex_Check() internal function (GH-19426)Victor Stinner2020-04-081-0/+22
| | | | | | | | | Add _PyIndex_Check() function to the internal C API: fast inlined verson of PyIndex_Check(). Add Include/internal/pycore_abstract.h header file. Replace PyIndex_Check() with _PyIndex_Check() in C files of Objects and Python subdirectories.
* bpo-40170: PyType_HasFeature() now always calls PyType_GetFlags() (GH-19378)Victor Stinner2020-04-072-5/+10
| | | | | | | | PyType_HasFeature() now always calls PyType_GetFlags() to hide implementation details. Previously, it accessed directly the PyTypeObject.tp_flags member when the limited C API was not used. Add fast inlined version _PyType_HasFeature() and _PyType_IS_GC() for object.c and typeobject.c.
* bpo-40170: Convert PyObject_CheckBuffer() macro to a function (GH-19376)Victor Stinner2020-04-071-3/+1
| | | | | Convert PyObject_CheckBuffer() macro to a function to hide implementation details: the macro accessed directly the PyTypeObject.tp_as_buffer member.
* bpo-40170: PyObject_NEW() becomes an alias to PyObject_New() (GH-19379)Victor Stinner2020-04-072-61/+59
| | | | | | | | | | | | The PyObject_NEW() macro becomes an alias to the PyObject_New() macro, and the PyObject_NEW_VAR() macro becomes an alias to the PyObject_NewVar() macro, to hide implementation details. They no longer access directly the PyTypeObject.tp_basicsize member. Exclude _PyObject_SIZE() and _PyObject_VAR_SIZE() macros from the limited C API. Replace PyObject_NEW() with PyObject_New() and replace PyObject_NEW_VAR() with PyObject_NewVar().
* bpo-40089: Add _at_fork_reinit() method to locks (GH-19195)Victor Stinner2020-04-071-0/+9
| | | | | | | | | | | | | | | Add a private _at_fork_reinit() method to _thread.Lock, _thread.RLock, threading.RLock and threading.Condition classes: reinitialize the lock after fork in the child process; reset the lock to the unlocked state. Rename also the private _reset_internal_locks() method of threading.Event to _at_fork_reinit(). * Add _PyThread_at_fork_reinit() private function. It is excluded from the limited C API. * threading.Thread._reset_internal_locks() now calls _at_fork_reinit() on self._tstate_lock rather than creating a new Python lock object.
* bpo-39481: Implementation for PEP 585 (#18239)Guido van Rossum2020-04-072-0/+15
| | | | | | | | | | | | This implements things like `list[int]`, which returns an object of type `types.GenericAlias`. This object mostly acts as a proxy for `list`, but has attributes `__origin__` and `__args__` that allow recovering the parts (with values `list` and `(int,)`. There is also an approximate notion of type variables; e.g. `list[T]` has a `__parameters__` attribute equal to `(T,)`. Type variables are objects of type `typing.TypeVar`.
* bpo-40170: PyObject_GET_WEAKREFS_LISTPTR() becomes a function (GH-19377)Victor Stinner2020-04-062-2/+8
| | | | | | | | Convert the PyObject_GET_WEAKREFS_LISTPTR() macro to a function to hide implementation details: the macro accessed directly to the PyTypeObject.tp_weaklistoffset member. Add _PyObject_GET_WEAKREFS_LISTPTR() static inline function to the internal C API.
* bpo-40141: Add line and column information to ast.keyword nodes (GH-19283)Pablo Galindo2020-04-011-2/+8
|
* bpo-40130: _PyUnicode_AsKind() should not be exported. (GH-19265)Serhiy Storchaka2020-04-011-6/+0
| | | | | Make it a static function, and pass known attributes (kind, data, length) instead of the PyUnicode object.
* bpo-40096: Support __attribute__((__noreturn__)) on xlc (GH-19204)Batuhan Taşkaya2020-03-291-0/+1
|
* bpo-38644: Pass tstate explicitly in signalmodule.c (GH-19184)Victor Stinner2020-03-261-0/+2
| | | | PyOS_InterruptOccurred() now checks _Py_ThreadCanHandleSignals() before checking if SIGINT is tripped.
* bpo-38644: Add _PySys_Audit() which takes tstate (GH-19180)Victor Stinner2020-03-262-1/+28
| | | | | | | | | | | | | | | Add _PySys_Audit() function to the internal C API: similar to PySys_Audit(), but requires a mandatory tstate parameter. Cleanup sys_audit_tstate() code: remove code path for NULL tstate, since the function exits at entry if tstate is NULL. Remove also code path for NULL tstate->interp: should_audit() now ensures that it is not NULL (even if tstate->interp cannot be NULL in practice). PySys_AddAuditHook() now checks if tstate is not NULL to decide if tstate can be used or not, and tstate is set to NULL if the runtime is not initialized yet. Use _PySys_Audit() in sysmodule.c.
* bpo-38410: Properly handle PySys_Audit() failures (GH-16657)Zackery Spytz2020-03-261-2/+2
|
* bpo-39947: Add PyThreadState_GetID() function (GH-19163)Victor Stinner2020-03-251-0/+1
| | | | Add PyThreadState_GetID() function: get the unique identifier of a Python thread state.
* bpo-39947: Add _PyThreadState_GetDict() function (GH-19160)Victor Stinner2020-03-251-0/+2
|
* bpo-39882: Add _Py_FatalErrorFormat() function (GH-19157)Victor Stinner2020-03-251-0/+5
|
* bpo-20526: Fix PyThreadState_Clear(): don't decref frame (GH-19120)Victor Stinner2020-03-241-0/+1
| | | | | | | | PyThreadState.frame is a borrowed reference, not a strong reference: PyThreadState_Clear() must not call Py_CLEAR(tstate->frame). Remove test_threading.test_warnings_at_exit(): we cannot warranty that the Python thread state of daemon threads is cleared in a reliable way during Python shutdown.
* Post 3.9.0a5Łukasz Langa2020-03-231-1/+1
|
* Python 3.9.0a5v3.9.0a5Łukasz Langa2020-03-231-2/+2
|
* bpo-40024: Add PyModule_AddType() helper function (GH-19088)Dong-hee Na2020-03-221-0/+4
|
* bpo-39946: Remove _PyThreadState_GetFrame (GH-19094)Victor Stinner2020-03-202-6/+0
| | | | | Remove _PyRuntime.getframe hook and remove _PyThreadState_GetFrame macro which was an alias to _PyRuntime.getframe. They were only exposed by the internal C API. Remove also PyThreadFrameGetter type.
* bpo-39947: Add PyThreadState_GetFrame() function (GH-19092)Victor Stinner2020-03-201-1/+2
| | | | Add PyThreadState_GetFrame() function: get the current frame of a Python thread state.
* bpo-40010: Optimize pending calls in multithreaded applications (GH-19091)Victor Stinner2020-03-201-2/+8
| | | | | | | | | | | | | | | If a thread different than the main thread schedules a pending call (Py_AddPendingCall()), the bytecode evaluation loop is no longer interrupted at each bytecode instruction to check for pending calls which cannot be executed. Only the main thread can execute pending calls. Previously, the bytecode evaluation loop was interrupted at each instruction until the main thread executes pending calls. * Add _Py_ThreadCanHandlePendingCalls() function. * SIGNAL_PENDING_CALLS() now only sets eval_breaker to 1 if the current thread can execute pending calls. Only the main thread can execute pending calls.
* bpo-40010: COMPUTE_EVAL_BREAKER() checks for subinterpreter (GH-19087)Victor Stinner2020-03-201-1/+27
| | | | | | | | | COMPUTE_EVAL_BREAKER() now also checks if the Python thread state belongs to the main interpreter. Don't break the evaluation loop if there are pending signals but the Python thread state it belongs to a subinterpeter. * Add _Py_IsMainThread() function. * Add _Py_ThreadCanHandleSignals() function.
* bpo-39984: Move pending calls to PyInterpreterState (GH-19066)Victor Stinner2020-03-191-4/+4
| | | | | | | | | | | | | | | | | If Py_AddPendingCall() is called in a subinterpreter, the function is now scheduled to be called from the subinterpreter, rather than being called from the main interpreter. Each subinterpreter now has its own list of scheduled calls. * Move pending and eval_breaker fields from _PyRuntimeState.ceval to PyInterpreterState.ceval. * new_interpreter() now calls _PyEval_InitThreads() to create pending calls lock. * Fix Py_AddPendingCall() for subinterpreters. It now calls _PyThreadState_GET() which works in a subinterpreter if the caller holds the GIL, and only falls back on PyGILState_GetThisThreadState() if _PyThreadState_GET() returns NULL.
* bpo-39220: Do not optimise annotation if 'from __future__ import ↵Pablo Galindo2020-03-181-1/+6
| | | | | | annotations' is used (GH-17866) Do not apply AST-based optimizations if 'from __future__ import annotations' is used in order to prevent information lost in the final version of the annotations.