Fix last traces of old threading API.

This commit is contained in:
Georg Brandl 2008-06-13 06:32:25 +00:00
parent 7634ff5ad6
commit f992640ed3
7 changed files with 25 additions and 25 deletions

View file

@ -383,7 +383,7 @@ _condition_map = {ConversionSyntax:InvalidOperation,
# The getcontext() and setcontext() function manage access to a thread-local
# current context. Py2.4 offers direct support for thread locals. If that
# is not available, use threading.currentThread() which is slower but will
# is not available, use threading.current_thread() which is slower but will
# work for older Pythons. If threads are not part of the build, create a
# mock threading object with threading.local() returning the module namespace.
@ -405,15 +405,15 @@ except AttributeError:
# To fix reloading, force it to create a new context
# Old contexts have different exceptions in their dicts, making problems.
if hasattr(threading.currentThread(), '__decimal_context__'):
del threading.currentThread().__decimal_context__
if hasattr(threading.current_thread(), '__decimal_context__'):
del threading.current_thread().__decimal_context__
def setcontext(context):
"""Set this thread's context to context."""
if context in (DefaultContext, BasicContext, ExtendedContext):
context = context.copy()
context.clear_flags()
threading.currentThread().__decimal_context__ = context
threading.current_thread().__decimal_context__ = context
def getcontext():
"""Returns this thread's context.
@ -423,10 +423,10 @@ except AttributeError:
New contexts are copies of DefaultContext.
"""
try:
return threading.currentThread().__decimal_context__
return threading.current_thread().__decimal_context__
except AttributeError:
context = Context()
threading.currentThread().__decimal_context__ = context
threading.current_thread().__decimal_context__ = context
return context
else: