summaryrefslogtreecommitdiffstats
path: root/Python/pystate.c
Commit message (Collapse)AuthorAgeFilesLines
* bpo-30860: Fix a refleak. (#3567)Eric Snow2017-09-141-2/+0
| | | | | Resolves bpo-31420. (This was accidentally reverted when in #3565.)
* bpo-31404: Revert "remove modules from Py_InterpreterState (#1638)" (#3565)Eric Snow2017-09-141-0/+4
| | | PR #1638, for bpo-28411, causes problems in some (very) edge cases. Until that gets sorted out, we're reverting the merge. PR #3506, a fix on top of #1638, is also getting reverted.
* bpo-30860: Fix a refleak. (#3506)Eric Snow2017-09-121-2/+0
| | | | | | | | | | | | | | * Drop warnoptions from PyInterpreterState. * Drop xoptions from PyInterpreterState. * Don't set warnoptions and _xoptions again. * Decref after adding to sys.__dict__. * Drop an unused macro. * Check sys.xoptions *before* we delete it.
* bpo-30860: Consolidate stateful runtime globals. (#3397)Eric Snow2017-09-081-81/+100
| | | | | | | * group the (stateful) runtime globals into various topical structs * consolidate the topical structs under a single top-level _PyRuntimeState struct * add a check-c-globals.py script that helps identify runtime globals Other globals are excluded (see globals.txt and check-c-globals.py).
* bpo-31370: Remove support for threads-less builds (#3385)Antoine Pitrou2017-09-071-29/+1
| | | | | | * Remove Setup.config * Always define WITH_THREAD for compatibility.
* Revert "bpo-30860: Consolidate stateful runtime globals." (#3379)Eric Snow2017-09-061-107/+88
| | | Windows buildbots started failing due to include-related errors.
* correct initialization code (#3376)Benjamin Peterson2017-09-061-2/+1
| | | Explicitly initialize struct members rather than relying on compiler extensions.
* bpo-30860: Consolidate stateful runtime globals. (#2594)Eric Snow2017-09-061-88/+108
| | | | | | | | | * group the (stateful) runtime globals into various topical structs * consolidate the topical structs under a single top-level _PyRuntimeState struct * add a check-c-globals.py script that helps identify runtime globals Other globals are excluded (see globals.txt and check-c-globals.py).
* bpo-28411: Remove "modules" field from Py_InterpreterState. (#1638)Eric Snow2017-09-041-2/+0
| | | sys.modules is the one true source.
* bpo-30604: clean up co_extra support (#2144)Dino Viehland2017-06-211-1/+1
| | | bpo-30604: port fix from 3.6 dropping binary compatibility tweaks
* Doc nits for bpo-16500 (#1841)Antoine Pitrou2017-05-281-1/+1
| | | | | | * Doc nits for bpo-16500 * Fix more references
* bpo-16500: Allow registering at-fork handlers (#1715)Antoine Pitrou2017-05-271-0/+10
| | | | | | | | | | | | * bpo-16500: Allow registering at-fork handlers * Address Serhiy's comments * Add doc for new C API * Add doc for new Python-facing function * Add NEWS entry + doc nit
* bpo-22257: Small changes for PEP 432. (#1728)Eric Snow2017-05-231-0/+16
| | | PEP 432 specifies a number of large changes to interpreter startup code, including exposing a cleaner C-API. The major changes depend on a number of smaller changes. This patch includes all those smaller changes.
* bpo-29102: Add a unique ID to PyInterpreterState. (#1639)Eric Snow2017-05-231-0/+37
|
* bpo-30395 _PyGILState_Reinit deadlock fix (#1734)Jason Fried2017-05-221-0/+4
| | | | head_lock could be held by another thread when fork happened. We should reset it to avoid deadlock.
* bpo-6532: Make the thread id an unsigned integer. (#781)Serhiy Storchaka2017-03-231-2/+3
| | | | | | | | | | | * bpo-6532: Make the thread id an unsigned integer. From C API side the type of results of PyThread_start_new_thread() and PyThread_get_thread_ident(), the id parameter of PyThreadState_SetAsyncExc(), and the thread_id field of PyThreadState changed from "long" to "unsigned long". * Restore a check in thread_get_ident().
* remove ceval timestamp supportBenjamin Peterson2016-09-091-3/+0
|
* Issue #28003: Implement PEP 525 -- Asynchronous Generators.Yury Selivanov2016-09-091-0/+5
|
* Add the co_extra field and accompanying APIs to code objects.Brett Cannon2016-09-071-0/+1
| | | | This completes PEP 523.
* replace Py_(u)intptr_t with the c99 standard typesBenjamin Peterson2016-09-061-1/+1
|
* Implement the frame evaluation API aspect of PEP 523.Brett Cannon2016-09-051-0/+1
|
* Issue #27587: Merge from 3.5Berker Peksag2016-08-221-2/+4
|\
| * Issue #27587: Move null pointer check earlier in _PyState_AddModule()Berker Peksag2016-08-221-2/+4
| | | | | | | | | | | | | | | | | | This was found by PVS-Studio: V595 The 'def' pointer was utilized before it was verified against nullptr. Check lines: 286, 292. pystate.c 286 Initial patch by Christian Heimes.
| * Use Py_uintptr_t for atomic pointersVictor Stinner2016-01-221-23/+24
| | | | | | | | | | | | | | | | Issue #26161: Use Py_uintptr_t instead of void* for atomic pointers in pyatomic.h. Use atomic_uintptr_t when <stdatomic.h> is used. Using void* causes compilation warnings depending on which implementation of atomic types is used.
* | Issue #22557: Now importing already imported modules is up to 2.5 times faster.Serhiy Storchaka2016-08-021-0/+2
| |
* | Issue #26932: Fixed support of RTLD_* constants defined as enum values,Serhiy Storchaka2016-05-041-2/+2
| | | | | | | | not via macros (in particular on Android). Patch by Chi Hsuan Yen.
* | faulthandler now works in non-Python threadsVictor Stinner2016-03-161-0/+6
| | | | | | | | | | | | | | | | | | | | | | Issue #26563: * Add _PyGILState_GetInterpreterStateUnsafe() function: the single PyInterpreterState used by this process' GILState implementation. * Enhance _Py_DumpTracebackThreads() to retrieve the interpreter state from autoInterpreterState in last resort. The function now accepts NULL for interp and current_tstate parameters. * test_faulthandler: fix a ResourceWarning when test is interrupted by CTRL+c
* | Add more checks on the GILVictor Stinner2016-03-141-5/+19
| | | | | | | | | | | | | | | | | | | | | | | | Issue #10915, #15751, #26558: * PyGILState_Check() now returns 1 (success) before the creation of the GIL and after the destruction of the GIL. It allows to use the function early in Python initialization and late in Python finalization. * Add a flag to disable PyGILState_Check(). Disable PyGILState_Check() when Py_NewInterpreter() is called * Add assert(PyGILState_Check()) to: _Py_dup(), _Py_fstat(), _Py_read() and _Py_write()
* | Use Py_uintptr_t for atomic pointersVictor Stinner2016-01-221-23/+24
| | | | | | | | | | | | | | | | Issue #26161: Use Py_uintptr_t instead of void* for atomic pointers in pyatomic.h. Use atomic_uintptr_t when <stdatomic.h> is used. Using void* causes compilation warnings depending on which implementation of atomic types is used.
* | Merge 3.5Victor Stinner2016-01-201-13/+20
|\ \ | |/ | | | | Issue #26154: Add a new private _PyThreadState_UncheckedGet() function.
| * Add _PyThreadState_UncheckedGet()Victor Stinner2016-01-201-13/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Issue #26154: Add a new private _PyThreadState_UncheckedGet() function which gets the current thread state, but don't call Py_FatalError() if it is NULL. Python 3.5.1 removed the _PyThreadState_Current symbol from the Python C API to no more expose complex and private atomic types. Atomic types depends on the compiler or can even depend on compiler options. The new function _PyThreadState_UncheckedGet() allows to get the variable value without having to care of the exact implementation of atomic types. Changes: * Replace direct usage of the _PyThreadState_Current variable with a call to _PyThreadState_UncheckedGet(). * In pystate.c, replace direct usage of the _PyThreadState_Current variable with the PyThreadState_GET() macro for readability. * Document also PyThreadState_Get() in pystate.h
* | Issue #5319: New Py_FinalizeEx() API to exit with status 120 on failureMartin Panter2015-11-301-1/+1
|/
* Issue 24342: Let wrapper set by sys.set_coroutine_wrapper fail gracefullyYury Selivanov2015-06-021-0/+1
|
* PEP 489: Multi-phase extension module initializationNick Coghlan2015-05-231-2/+17
| | | | | | | | | | | | | | | | | | | | | | | Known limitations of the current implementation: - documentation changes are incomplete - there's a reference leak I haven't tracked down yet The leak is most visible by running: ./python -m test -R3:3 test_importlib However, you can also see it by running: ./python -X showrefcount Importing the array or _testmultiphase modules, and then deleting them from both sys.modules and the local namespace shows significant increases in the total number of active references each cycle. By contrast, with _testcapi (which continues to use single-phase initialisation) the global refcounts stabilise after a couple of cycles.
* PEP 0492 -- Coroutines with async and await syntax. Issue #24017.Yury Selivanov2015-05-121-0/+4
|
* Issue #23524: Replace _PyVerify_fd function with calls to ↵Steve Dower2015-04-121-11/+0
| | | | _set_thread_local_invalid_parameter_handler.
* Removed unintentional trailing spaces in non-external and non-generated C files.Serhiy Storchaka2015-03-181-1/+1
|
* Issue #23524: Replace _PyVerify_fd function with calling ↵Steve Dower2015-03-061-0/+11
| | | | _set_thread_local_invalid_parameter_handler on every thread.
* Fixed few compiler warnings.Serhiy Storchaka2015-02-161-2/+2
|
* Issue #19255: The builtins module is restored to initial value beforeSerhiy Storchaka2014-02-101-0/+2
| | | | cleaning other modules. The sys and builtins modules are cleaned last.
* Issue #19787: PyThread_set_key_value() now always set the valueVictor Stinner2013-12-131-9/+9
| | | | | | | | | | In Python 3.3, PyThread_set_key_value() did nothing if the key already exists (if the current value is a non-NULL pointer). When _PyGILState_NoteThreadState() is called twice on the same thread with a different Python thread state, it still keeps the old Python thread state to keep the old behaviour. Replacing the Python thread state with the new state introduces new bugs: see issues #10915 and #15751.
* Close #19576: PyGILState_Ensure() now initializes threads. At startup, PythonVictor Stinner2013-12-131-0/+5
| | | | | | has no concrete GIL. If PyGILState_Ensure() is called from a new thread for the first time and PyEval_InitThreads() was not called yet, a GIL needs to be created.
* Close #19199: Remove ``PyThreadState.tick_counter`` fieldVictor Stinner2013-10-091-1/+0
|
* Issue #18808: Thread.join() now waits for the underlying thread state to be ↵Antoine Pitrou2013-09-071-0/+5
| | | | | | destroyed before returning. This prevents unpredictable aborts in Py_EndInterpreter() when some non-daemon threads are still running.
* Issue #10241: Clear extension module dict copies at interpreter shutdown.Antoine Pitrou2013-08-101-0/+25
| | | | | | Patch by Neil Schemenauer, minimally modified. (re-apply after fix for tkinter-related crash)
* Backout 62658d9d8926 (issue #10241): it causes a crash at shutdown when ↵Antoine Pitrou2013-08-021-25/+0
| | | | deallocating a Tkapp object.
* Issue #10241: Clear extension module dict copies at interpreter shutdown.Antoine Pitrou2013-08-011-0/+25
| | | | Patch by Neil Schemenauer, minimally modified.
* Issue #18203: Replace malloc() with PyMem_RawMalloc() at Python initializationVictor Stinner2013-07-071-10/+10
| | | | | | | * Replace malloc() with PyMem_RawMalloc() * Replace PyMem_Malloc() with PyMem_RawMalloc() where the GIL is not held. * _Py_char2wchar() now returns a buffer allocated by PyMem_RawMalloc(), instead of PyMem_Malloc()
* Issue #18328: Reorder ops in PyThreadState_Delete*() functions. Now theChristian Heimes2013-07-011-2/+2
|\ | | | | | | | | | | tstate is first removed from TLS and then deallocated. CID 1019639 (#1 of 1): Use after free (USE_AFTER_FREE) use_after_free: Using freed pointer tstate.
| * Issue #18328: Reorder ops in PyThreadState_Delete*() functions. Now theChristian Heimes2013-07-011-2/+2
| | | | | | | | | | | | tstate is first removed from TLS and then deallocated. CID 1019639 (#1 of 1): Use after free (USE_AFTER_FREE) use_after_free: Using freed pointer tstate.