summaryrefslogtreecommitdiffstats
path: root/Modules/_threadmodule.c
Commit message (Collapse)AuthorAgeFilesLines
* bpo-35459: Use PyDict_GetItemWithError() instead of PyDict_GetItem(). (GH-11112)Serhiy Storchaka2019-02-251-10/+16
|
* bpo-35454: Fix miscellaneous minor issues in error handling. (#11077)Serhiy Storchaka2018-12-111-3/+5
| | | | | | * bpo-35454: Fix miscellaneous minor issues in error handling. * Fix a null pointer dereference.
* bpo-33012: Fix invalid function cast warnings with gcc 8. (GH-6749)Serhiy Storchaka2018-11-271-5/+5
| | | | | | Fix invalid function cast warnings with gcc 8 for method conventions different from METH_NOARGS, METH_O and METH_VARARGS excluding Argument Clinic generated code.
* bpo-35059: Cast void* to PyObject* (GH-10650)Victor Stinner2018-11-221-1/+2
| | | Don't pass void* to Python macros: use _PyObject_CAST().
* bpo-35081: Rename internal headers (GH-10275)Victor Stinner2018-11-121-1/+1
| | | | | | | | | | | | | | Rename Include/internal/ headers: * pycore_hash.h -> pycore_pyhash.h * pycore_lifecycle.h -> pycore_pylifecycle.h * pycore_mem.h -> pycore_pymem.h * pycore_state.h -> pycore_pystate.h Add missing headers to Makefile.pre.in and PCbuild: * pycore_condvar.h. * pycore_hamt.h * pycore_pyhash.h
* bpo-35081: Add pycore_ prefix to internal header files (GH-10263)Victor Stinner2018-10-311-1/+1
| | | | | | | | | | | | | | | | | | | | * Rename Include/internal/ header files: * pyatomic.h -> pycore_atomic.h * ceval.h -> pycore_ceval.h * condvar.h -> pycore_condvar.h * context.h -> pycore_context.h * pygetopt.h -> pycore_getopt.h * gil.h -> pycore_gil.h * hamt.h -> pycore_hamt.h * hash.h -> pycore_hash.h * mem.h -> pycore_mem.h * pystate.h -> pycore_state.h * warnings.h -> pycore_warnings.h * PCbuild project, Makefile.pre.in, Modules/Setup: add the Include/internal/ directory to the search paths of header files. * Update includes. For example, replace #include "internal/mem.h" with #include "pycore_mem.h".
* Fix misleading mentions of tp_size in comments (GH-9093)Peter Eisentraut2018-09-101-2/+2
| | | | Many type object initializations labeled a field "tp_size" in the comment, but the name of that field is tp_basicsize.
* bpo-34301: Add _PyInterpreterState_Get() helper function (GH-8592)Victor Stinner2018-08-031-5/+5
| | | | sys_setcheckinterval() now uses a local variable to parse arguments, before writing into interp->check_interval.
* bpo-33012: Fix invalid function cast warnings with gcc 8 for METH_NOARGS. ↵Siddhesh Poyarekar2018-04-291-19/+19
| | | | | | | | | (GH-6030) METH_NOARGS functions need only a single argument but they are cast into a PyCFunction, which takes two arguments. This triggers an invalid function cast warning in gcc8 due to the argument mismatch. Fix this by adding a dummy unused argument.
* bpo-32747: Remove trailing spaces in docstrings. (GH-5491)oldk2018-02-021-1/+1
|
* bpo-32544: Speed up hasattr() and getattr() (GH-5173)INADA Naoki2018-01-161-2/+4
| | | | | AttributeError was raised always when attribute is not found. This commit skip raising AttributeError when `tp_getattro` is `PyObject_GenericGetAttr`. It makes hasattr() and getattr() about 4x faster when attribute is not found.
* Fix CID-1420310: cast PY_TIMEOUT_MAX to _Py_time_t (#4646)Victor Stinner2017-11-301-1/+1
| | | | | | | | | | | | | Fix the following false-alarm Coverity warning: Result is not floating-point (UNINTENDED_INTEGER_DIVISION)integer_division: Dividing integer expressions 9223372036854775807LL and 1000LL, and then converting the integer quotient to type double. Any remainder, or fractional part of the quotient, is ignored. To compute and use a non-integer quotient, change or cast either operand to type double. If integer division is intended, consider indicating that by casting the result to type long long .
* Replace KB unit with KiB (#4293)Victor Stinner2017-11-081-2/+2
| | | | | | | | | | | kB (*kilo* byte) unit means 1000 bytes, whereas KiB ("kibibyte") means 1024 bytes. KB was misused: replace kB or KB with KiB when appropriate. Same change for MB and GB which become MiB and GiB. Change the output of Tools/iobench/iobench.py. Round also the size of the documentation from 5.5 MB to 5 MiB.
* bpo-30768: Recompute timeout on interrupted lock (GH-4103)Victor Stinner2017-10-241-2/+4
| | | | | | | | | | | | | | | | Fix the pthread+semaphore implementation of PyThread_acquire_lock_timed() when called with timeout > 0 and intr_flag=0: recompute the timeout if sem_timedwait() is interrupted by a signal (EINTR). See also the PEP 475. The pthread implementation of PyThread_acquire_lock() now fails with a fatal error if the timeout is larger than PY_TIMEOUT_MAX, as done in the Windows implementation. The check prevents any risk of overflow in PyThread_acquire_lock(). Add also PY_DWORD_MAX constant.
* bpo-31806: Use _PyTime_ROUND_TIMEOUT for the timeout argument parsing in ↵Pablo Galindo2017-10-181-2/+2
| | | | | | | | | more functions (#4026) Fix timeout rounding in time.sleep(), threading.Lock.acquire() and socket.socket.settimeout() to round correctly negative timeouts between -1.0 and 0.0. The functions now block waiting for events as expected. Previously, the call was incorrectly non-blocking.
* bpo-30860: Consolidate stateful runtime globals. (#3397)Eric Snow2017-09-081-5/+7
| | | | | | | * 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-7/+0
| | | | | | * Remove Setup.config * Always define WITH_THREAD for compatibility.
* Revert "bpo-30860: Consolidate stateful runtime globals." (#3379)Eric Snow2017-09-061-6/+5
| | | Windows buildbots started failing due to include-related errors.
* bpo-30860: Consolidate stateful runtime globals. (#2594)Eric Snow2017-09-061-5/+6
| | | | | | | | | * 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-6532: Make the thread id an unsigned integer. (#781)Serhiy Storchaka2017-03-231-15/+14
| | | | | | | | | | | * 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().
* bpo-29548: Fix some inefficient call API usage (GH-97)INADA Naoki2017-02-161-2/+1
|
* Issue #28999: Use Py_RETURN_NONE, Py_RETURN_TRUE and Py_RETURN_FALSE whereverSerhiy Storchaka2017-01-231-4/+2
| | | | possible. Patch is writen with Coccinelle.
* Issue #27895: Spelling fixes (Contributed by Ville Skyttä).Raymond Hettinger2016-08-301-1/+1
|
* Issue #18916: Update thread module docstringsBerker Peksag2016-05-021-3/+4
| | | | | | | | * Fix acquire() signature * Remove outdated help(LockType) reference * Replace PyThread_allocate_lock() with threading.Lock() Patch by Christopher Welborn.
* Issue #24115: Update uses of PyObject_IsTrue(), PyObject_Not(),Serhiy Storchaka2015-05-301-6/+12
|\ | | | | | | | | PyObject_IsInstance(), PyObject_RichCompareBool() and _PyDict_Contains() to check for and handle errors correctly.
| * Issue #24115: Update uses of PyObject_IsTrue(), PyObject_Not(),Serhiy Storchaka2015-05-301-6/+12
| | | | | | | | | | PyObject_IsInstance(), PyObject_RichCompareBool() and _PyDict_Contains() to check for and handle errors correctly.
* | Issue #22117: Add a new _PyTime_FromSeconds() functionVictor Stinner2015-04-031-1/+1
| | | | | | | | | | Fix also _Py_InitializeEx_Private(): initialize time before initializing import, import_init() uses the _PyTime API (for thread locks).
* | PEP 475: on EINTR, retry the function even if the timeout is equals to zeroVictor Stinner2015-03-301-1/+1
| | | | | | | | | | | | | | | | | | Retry: * signal.sigtimedwait() * threading.Lock.acquire() * threading.RLock.acquire() * time.sleep()
* | Issue #22117: Replace usage of _PyTime_ROUND_UP with _PyTime_ROUND_CEILINGVictor Stinner2015-03-301-3/+4
| | | | | | | | | | All these functions only accept positive timeouts, so this change has no effect in practice.
* | Issue #22117: The thread module uses the new _PyTime_t timestamp APIVictor Stinner2015-03-281-75/+64
| | | | | | | | | | | | | | | | | | Add also a new _PyTime_AsMicroseconds() function. threading.TIMEOUT_MAX is now be smaller: only 292 years instead of 292,271 years on 64-bit system for example. Sorry, your threads will hang a *little bit* shorter. Call me if you want to ensure that your locks wait longer, I can share some tricks with you.
* | Issue #22043: time.monotonic() is now always availableVictor Stinner2014-09-021-2/+2
| | | | | | | | | | threading.Lock.acquire(), threading.RLock.acquire() and socket operations now use a monotonic clock, instead of the system clock, when a timeout is used.
* | Issue 21137: Better repr for threading.Lock()Raymond Hettinger2014-05-261-3/+12
|/
* threading.RLock._acquire_restore() now raises a TypeError instead of aVictor Stinner2014-01-021-3/+3
| | | | SystemError when it is not called with 2 arguments
* Issue #19512, #19515: remove shared identifiers, move identifiers where theyVictor Stinner2013-11-071-1/+3
| | | | | | | are used. Move also _Py_IDENTIFIER() defintions to the top in modified files to remove identifiers duplicated in the same file.
* Issue #19512: add some common identifiers to only create common strings once,Victor Stinner2013-11-061-1/+1
| | | | | | | instead of creating temporary Unicode string objects Add also more identifiers in pythonrun.c to avoid temporary Unicode string objets for the interactive interpreter.
* Issue #19437: Fix _threading.RLock constructor (rlock_new), callVictor Stinner2013-11-051-10/+14
| | | | | | | | | Py_DECREF(self) if PyThread_allocate_lock() failed instead of calling directly type->tp_free(self), to keep the chained list of objects consistent when Python is compiled in debug mode fails, don't consume the row (restore it) and fail immediatly (don't call pysqlite_step())
* Issue #18808: Thread.join() now waits for the underlying thread state to be ↵Antoine Pitrou2013-09-071-0/+62
| | | | | | destroyed before returning. This prevents unpredictable aborts in Py_EndInterpreter() when some non-daemon threads are still running.
* merge #17091: update docstring for _thread.Lock.acquire.R David Murray2013-02-041-2/+2
|\
| * merge #17091: update docstring for _thread.Lock.acquire.R David Murray2013-02-041-2/+2
| |\
| | * #17091: update docstring for _thread.Lock.acquire.R David Murray2013-02-041-2/+2
| | | | | | | | | | | | | | | | | | The main docs were fixed to remove mention of None long ago, but the docstring was not. Reported by Armin Rigo, patch by Ian Cordasco.
* | | Issue #15422: get rid of PyCFunction_New macroAndrew Svetlov2012-12-251-1/+1
|/ /
* | Issue #15124: Optimize _thread.LockType deletion and acquisition whenKristjan Valur Jonsson2012-06-221-21/+17
| | | | | | | | not contested, similar to what _thread.RLock already has.
* | merge 3.2Benjamin Peterson2012-04-021-0/+3
|\ \ | |/
| * prevent writing to stderr from messing up the exception state (closes #14474)Benjamin Peterson2012-04-021-0/+3
| |
* | Merge 3.2Éric Araujo2011-06-011-1/+1
|\ \ | |/
| * Fix error message to use the Python name instead of the C nameÉric Araujo2011-05-311-1/+1
| |
* | Issue #11223: Replace threading._info() by sys.thread_infoVictor Stinner2011-04-301-13/+0
| |
* | Issue #11915: threading.RLock()._release_save() raises a RuntimeError if theVictor Stinner2011-04-241-0/+6
| | | | | | | | lock was not acquired.
* | Issue #11223: Add threading._info() function providing informations about theVictor Stinner2011-04-191-7/+17
| | | | | | | | | | | | | | | | | | thread implementation. Skip test_lock_acquire_interruption() and test_rlock_acquire_interruption() of test_threadsignals if a thread lock is implemented using a POSIX mutex and a POSIX condition variable. A POSIX condition variable cannot be interrupted by a signal (e.g. on Linux, the futex system call is restarted).
* | #11515: Merge with 3.2.Ezio Melotti2011-03-151-1/+1
|\ \ | |/