summaryrefslogtreecommitdiffstats
path: root/Python/pystate.c
Commit message (Collapse)AuthorAgeFilesLines
* 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.
* | Issue #17912: Use a doubly linked-list for thread states.Charles-Francois Natali2013-05-081-41/+17
| |
* | Issue #17094: Clear stale thread states after fork().Antoine Pitrou2013-05-051-0/+47
| | | | | | | | | | | | | | Note that this is a potentially disruptive change since it may release some system resources which would otherwise remain perpetually alive (e.g. database connections kept in thread-local storage).
* | Issue #17522: Add the PyGILState_Check() API.Kristján Valur Jónsson2013-03-231-0/+9
|/
* Issue #13992: The trashcan mechanism is now thread-safe. This eliminatesAntoine Pitrou2012-09-051-0/+3
| | | | | | | | | | | sporadic crashes in multi-thread programs when several long deallocator chains ran concurrently and involved subclasses of built-in container types. Because of this change, a couple extension modules compiled for 3.2.4 (those which use the trashcan mechanism, despite it being undocumented) will not be loadable by 3.2.3 and earlier. However, extension modules compiled for 3.2.3 and earlier will be loadable by 3.2.4.
* Issue #15726: Fix incorrect bounds checking in PyState_FindModule.Antoine Pitrou2012-08-201-1/+1
|\ | | | | | | Patch by Robin Schreiber.
| * Issue #15726: Fix incorrect bounds checking in PyState_FindModule.Antoine Pitrou2012-08-201-1/+1
| | | | | | | | Patch by Robin Schreiber.
* | Issue #15042: Add PyState_AddModule and PyState_RemoveModule.Martin v. Löwis2012-06-221-2/+43
| | | | | | | | | | | | Add version guard for Py_LIMITED_API additions. Issue #15081: Document PyState_FindModule. Patch by Robin Schreiber.
* | Issues #13959, 14647: Re-implement imp.reload() in Lib/imp.py.Brett Cannon2012-04-291-2/+0
| | | | | | | | Thanks to Eric Snow for the patch.
* | Issue #2377: Make importlib the implementation of __import__().Brett Cannon2012-04-141-0/+2
|/ | | | | | | importlib._bootstrap is now frozen into Python/importlib.h and stored as _frozen_importlib in sys.modules. Py_Initialize() loads the frozen code along with sys and imp and then uses _frozen_importlib._install() to set builtins.__import__() w/ _frozen_importlib.__import__().
* move outside WITH_THREAD conditionalBenjamin Peterson2012-04-131-2/+2
|
* take linkage def outside of WITH_THREAD conditional (closes #14569)Benjamin Peterson2012-04-131-4/+3
|
* Issue #13156: _PyGILState_Reinit(): Re-associate the auto thread state with theCharles-François Natali2011-11-221-4/+5
| | | | | | TLS key only if the thread that called fork() had an associated auto thread state (this might not be the case for example for a thread created outside of Python calling into a subinterpreter).
* Issue #10363: Deallocate global locks in Py_Finalize().Antoine Pitrou2011-10-301-0/+6
|
* Issue #10914: Initialize correctly the filesystem codec when creating a newVictor Stinner2011-04-261-0/+1
| | | | | | | subinterpreter to fix a bootstrap issue with codecs implemented in Python, as the ISO-8859-15 codec. Add fscodec_initialized attribute to the PyInterpreterState structure.
* Issue #10517: After fork(), reinitialize the TLS used by the PyGILState_*Antoine Pitrou2011-04-271-0/+17
| | | | | APIs, to avoid a crash with the pthread implementation in RHEL 5. Patch by Charles-François Natali.