Open
Description
A local variable is overwritten:
futurize threads.py
(from https://github.com/univention/python-notifier/blob/83205cdded0a8ca769e7f75f3800610a6424d8c8/notifier/threads.py) results in the following diff:
diff -ru /usr/lib/python2.7/dist-packages/notifier/threads.py /usr/lib/python3/dist-packages/notifier/threads.py
--- /usr/lib/python2.7/dist-packages/notifier/threads.py 2018-07-04 10:36:25.000000000 +0200
+++ /usr/lib/python3/dist-packages/notifier/threads.py 2018-07-04 10:36:25.000000000 +0200
@@ -22,11 +22,14 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
# 02110-1301 USA
+from future import standard_library
+standard_library.install_aliases()
+from builtins import object
import notifier
import functools
import sys
-import thread
+import _thread
import traceback
__all__ = [ 'Simple' ]
@@ -60,7 +63,7 @@
self._exc_info = None
self._finished = False
self._id = None
- self._lock = thread.allocate_lock()
+ self._lock = _thread.allocate_lock()
global _threads
if not _threads:
notifier.dispatcher_add( _simple_threads_dispatcher )
@@ -68,7 +71,7 @@
def run( self ):
"""Starts the thread"""
- self._id = thread.start_new_thread( self._run, () )
+ self._id = _thread.start_new_thread( self._run, () )
def _run( self ):
"""Encapsulates the given thread function to handle the return
@@ -170,7 +173,7 @@
def inner_thread( func ):
def wrapped( *args, **kwargs ):
thread = Enhanced( notifier.Callback( func, *args, **kwargs ), finished_func )
- thread.run()
+ _thread.run()
return functools.wraps( func )( wrapped )
return inner_thread
→ The last hunk contains thread = ...
in the next line thread
is replaced with _thread
.