Commit Graph

60 Commits

Author SHA1 Message Date
Serhiy Storchaka ac5569b1fa Issue #24115: Update uses of PyObject_IsTrue(), PyObject_Not(),
PyObject_IsInstance(), PyObject_RichCompareBool() and _PyDict_Contains()
to check for and handle errors correctly.
2015-05-30 17:48:19 +03:00
Serhiy Storchaka fa494fd883 Issue #24115: Update uses of PyObject_IsTrue(), PyObject_Not(),
PyObject_IsInstance(), PyObject_RichCompareBool() and _PyDict_Contains()
to check for and handle errors correctly.
2015-05-30 17:45:22 +03:00
Victor Stinner 13019fdef3 Issue #22117: Add a new _PyTime_FromSeconds() function
Fix also _Py_InitializeEx_Private(): initialize time before initializing
import, import_init() uses the _PyTime API (for thread locks).
2015-04-03 13:10:54 +02:00
Victor Stinner 6aa446cf03 PEP 475: on EINTR, retry the function even if the timeout is equals to zero
Retry:

* signal.sigtimedwait()
* threading.Lock.acquire()
* threading.RLock.acquire()
* time.sleep()
2015-03-30 21:33:51 +02:00
Victor Stinner 869e1778c0 Issue #22117: Replace usage of _PyTime_ROUND_UP with _PyTime_ROUND_CEILING
All these functions only accept positive timeouts, so this change has no effect
in practice.
2015-03-30 03:49:14 +02:00
Victor Stinner f5faad2bf0 Issue #22117: The thread module uses the new _PyTime_t timestamp API
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.
2015-03-28 03:52:05 +01:00
Victor Stinner ae58649721 Issue #22043: time.monotonic() is now always available
threading.Lock.acquire(), threading.RLock.acquire() and socket operations now
use a monotonic clock, instead of the system clock, when a timeout is used.
2014-09-02 23:18:25 +02:00
Raymond Hettinger 62f4dad816 Issue 21137: Better repr for threading.Lock() 2014-05-25 18:22:35 -07:00
Victor Stinner e8794526db threading.RLock._acquire_restore() now raises a TypeError instead of a
SystemError when it is not called with 2 arguments
2014-01-02 12:47:24 +01:00
Victor Stinner bd303c165b Issue #19512, #19515: remove shared identifiers, move identifiers where they
are used.

Move also _Py_IDENTIFIER() defintions to the top in modified files to remove
identifiers duplicated in the same file.
2013-11-07 23:07:29 +01:00
Victor Stinner 090543736f Issue #19512: add some common identifiers to only create common strings once,
instead of creating temporary Unicode string objects

Add also more identifiers in pythonrun.c to avoid temporary Unicode string
objets for the interactive interpreter.
2013-11-06 22:41:44 +01:00
Victor Stinner 357f5155dc Issue #19437: Fix _threading.RLock constructor (rlock_new), call
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())
2013-11-05 15:10:19 +01:00
Antoine Pitrou 7b4769937f Issue #18808: Thread.join() now waits for the underlying thread state to be destroyed before returning.
This prevents unpredictable aborts in Py_EndInterpreter() when some non-daemon threads are still running.
2013-09-07 23:38:37 +02:00
R David Murray 811724ce7f merge #17091: update docstring for _thread.Lock.acquire. 2013-02-04 10:25:51 -05:00
R David Murray b7be42b1f9 merge #17091: update docstring for _thread.Lock.acquire. 2013-02-04 10:22:39 -05:00
R David Murray 95b7110a11 #17091: update docstring for _thread.Lock.acquire.
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.
2013-02-04 10:15:58 -05:00
Andrew Svetlov 3ba3a3ee56 Issue #15422: get rid of PyCFunction_New macro 2012-12-25 13:32:35 +02:00
Kristjan Valur Jonsson 69cf913ba1 Issue #15124: Optimize _thread.LockType deletion and acquisition when
not contested, similar to what _thread.RLock already has.
2012-06-22 18:40:02 +00:00
Benjamin Peterson dba1b40b60 merge 3.2 2012-04-02 11:28:49 -04:00
Benjamin Peterson e900096dc4 prevent writing to stderr from messing up the exception state (closes #14474) 2012-04-02 11:15:17 -04:00
Éric Araujo 5397c797f4 Merge 3.2 2011-06-01 19:47:24 +02:00
Éric Araujo 9bcf8bfb24 Fix error message to use the Python name instead of the C name 2011-05-31 14:08:26 +02:00
Victor Stinner d5c355ccc7 Issue #11223: Replace threading._info() by sys.thread_info 2011-04-30 14:53:09 +02:00
Victor Stinner c2824d41c3 Issue #11915: threading.RLock()._release_save() raises a RuntimeError if the
lock was not acquired.
2011-04-24 23:41:33 +02:00
Victor Stinner 754851f456 Issue #11223: Add threading._info() function providing informations about the
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).
2011-04-19 23:58:51 +02:00
Ezio Melotti 4969f709cc #11515: Merge with 3.1. 2011-03-15 05:59:46 +02:00
Ezio Melotti 42da663e6f #11515: fix several typos. Patch by Piotr Kasprzyk. 2011-03-15 05:18:48 +02:00
Ezio Melotti 373089239b #11515: Merge with 3.2. 2011-03-15 06:03:08 +02:00
Antoine Pitrou 125d5c8770 Issue #11408: In threading.Lock.acquire(), only call gettimeofday() when
really necessary.  Patch by Charles-François Natali.
2011-03-06 08:40:35 +01:00
Antoine Pitrou fcf81fd031 Issue #11140: Lock.release() now raises a RuntimeError when attempting
to release an unacquired lock, as claimed in the threading documentation.
The _thread.error exception is now an alias of RuntimeError.
2011-02-28 22:03:34 +00:00
Brett Cannon b94767ff44 Issue #8914: fix various warnings from the Clang static analyzer v254. 2011-02-22 20:15:44 +00:00
Antoine Pitrou 810023db3e Issue #8844: Regular and recursive lock acquisitions can now be interrupted
by signals on platforms using pthreads.  Patch by Reid Kleckner.
2010-12-15 22:59:16 +00:00
Antoine Pitrou fcd2a7960c Merged revisions 84344 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k

........
  r84344 | antoine.pitrou | 2010-08-28 20:17:03 +0200 (sam., 28 août 2010) | 4 lines

  Issue #1868: Eliminate subtle timing issues in thread-local objects by
  getting rid of the cached copy of thread-local attribute dictionary.
........
2010-08-28 18:27:09 +00:00
Antoine Pitrou 1a9a9d5433 Issue #1868: Eliminate subtle timing issues in thread-local objects by
getting rid of the cached copy of thread-local attribute dictionary.
2010-08-28 18:17:03 +00:00
Alexander Belopolsky 102594f7ff Merged revisions 84106 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k

........
  r84106 | alexander.belopolsky | 2010-08-16 16:17:07 -0400 (Mon, 16 Aug 2010) | 1 line

  Issue #8983: Corrected docstrings.
........
2010-08-16 20:26:04 +00:00
Alexander Belopolsky 977a684c94 Issue #8983: Corrected docstrings. 2010-08-16 20:17:07 +00:00
Antoine Pitrou 87d5260362 Merged revisions 83918 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k

........
  r83918 | antoine.pitrou | 2010-08-10 00:38:19 +0200 (mar., 10 août 2010) | 5 lines

  Issue #3757: thread-local objects now support cyclic garbage collection.
  Thread-local objects involved in reference cycles will be deallocated
  timely by the cyclic GC, even if the underlying thread is still running.
........
2010-08-09 22:41:38 +00:00
Antoine Pitrou 5af4f4b983 Issue #3757: thread-local objects now support cyclic garbage collection.
Thread-local objects involved in reference cycles will be deallocated
timely by the cyclic GC, even if the underlying thread is still running.
2010-08-09 22:38:19 +00:00
Antoine Pitrou 7f14f0d8a0 Recorded merge of revisions 81032 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k

................
  r81032 | antoine.pitrou | 2010-05-09 17:52:27 +0200 (dim., 09 mai 2010) | 9 lines

  Recorded merge of revisions 81029 via svnmerge from
  svn+ssh://pythondev@svn.python.org/python/trunk

  ........
    r81029 | antoine.pitrou | 2010-05-09 16:46:46 +0200 (dim., 09 mai 2010) | 3 lines

    Untabify C files. Will watch buildbots.
  ........
................
2010-05-09 16:14:21 +00:00
Antoine Pitrou f95a1b3c53 Recorded merge of revisions 81029 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r81029 | antoine.pitrou | 2010-05-09 16:46:46 +0200 (dim., 09 mai 2010) | 3 lines

  Untabify C files. Will watch buildbots.
........
2010-05-09 15:52:27 +00:00
Antoine Pitrou 7c3e577395 Issue #7316: the acquire() method of lock objects in the :mod:`threading`
module now takes an optional timeout argument in seconds.  Timeout support
relies on the system threading library, so as to avoid a semi-busy wait
loop.
2010-04-14 15:44:10 +00:00
Victor Stinner ef32bc8569 Merged revisions 78639 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k

................
  r78639 | victor.stinner | 2010-03-04 00:28:07 +0100 (jeu., 04 mars 2010) | 10 lines

  Merged revisions 78638 via svnmerge from
  svn+ssh://pythondev@svn.python.org/python/trunk

  ........
    r78638 | victor.stinner | 2010-03-04 00:20:25 +0100 (jeu., 04 mars 2010) | 3 lines

    Issue #7544: Preallocate thread memory before creating the thread to avoid a
    fatal error in low memory condition.
  ........
................
2010-03-03 23:32:07 +00:00
Victor Stinner 45b9be52de Merged revisions 78638 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r78638 | victor.stinner | 2010-03-04 00:20:25 +0100 (jeu., 04 mars 2010) | 3 lines

  Issue #7544: Preallocate thread memory before creating the thread to avoid a
  fatal error in low memory condition.
........
2010-03-03 23:28:07 +00:00
Victor Stinner 5774043795 Merged revisions 78611 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k

................
  r78611 | victor.stinner | 2010-03-03 01:50:12 +0100 (mer., 03 mars 2010) | 10 lines

  Merged revisions 78610 via svnmerge from
  svn+ssh://pythondev@svn.python.org/python/trunk

  ........
    r78610 | victor.stinner | 2010-03-03 01:43:44 +0100 (mer., 03 mars 2010) | 3 lines

    Issue #3299: fix thread.allocate_lock() error handler, replace PyObject_Del()
    by Py_DECREF() to fix a crash in pydebug mode.
  ........
................
2010-03-03 00:51:28 +00:00
Victor Stinner 8f3216a069 Merged revisions 78610 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r78610 | victor.stinner | 2010-03-03 01:43:44 +0100 (mer., 03 mars 2010) | 3 lines

  Issue #3299: fix thread.allocate_lock() error handler, replace PyObject_Del()
  by Py_DECREF() to fix a crash in pydebug mode.
........
2010-03-03 00:50:12 +00:00
Amaury Forgeot d'Arc 72aee3dcab Merged revisions 78393 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r78393 | amaury.forgeotdarc | 2010-02-24 00:19:39 +0100 (mer., 24 févr. 2010) | 2 lines

  #4852: Remove dead code in every thread implementation, unused for many years.
........
2010-02-24 00:10:48 +00:00
Antoine Pitrou 434736a1a6 Issue #3001: Add a C implementation of recursive locks which is used by
default when instantiating a `Threading.RLock` object. This makes
recursive locks as fast as regular non-recursive locks (previously,
they were slower by 10x to 15x).
2009-11-10 18:46:01 +00:00
Antoine Pitrou 9257f5eece Merged revisions 75969 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r75969 | antoine.pitrou | 2009-10-30 23:19:09 +0100 (ven., 30 oct. 2009) | 5 lines

  Remove official documentation entry for thread._count() and make the
  docstring more descriptive instead.
........
2009-10-30 22:23:02 +00:00
Antoine Pitrou 65c9c6426b Merged revisions 75958 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r75958 | antoine.pitrou | 2009-10-30 18:07:08 +0100 (ven., 30 oct. 2009) | 7 lines

  Issue #7222: Make thread "reaping" more reliable so that reference
  leak-chasing test runs give sensible results. The previous method of
  reaping threads could return successfully while some Thread objects were
  still referenced. This also introduces a new private function:
  :func:hread._count().
........
2009-10-30 17:25:12 +00:00
Benjamin Peterson bec4d57a39 Merged revisions 74524 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r74524 | gregory.p.smith | 2009-08-20 04:39:38 -0500 (Thu, 20 Aug 2009) | 2 lines

  Add weakref support to the thread.lock type.
........
2009-10-10 01:16:07 +00:00