Univention Bugzilla – Attachment 8927 Details for
Bug 44806
Upgrade python-notifier
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
patch
44806.patch (text/plain), 3.79 KB, created by
Florian Best
on 2017-06-16 13:22 CEST
(
hide
)
Description:
patch
Filename:
MIME Type:
Creator:
Florian Best
Created:
2017-06-16 13:22 CEST
Size:
3.79 KB
patch
obsolete
>diff --git a/management/python-notifier/python-notifier/ChangeLog b/management/python-notifier/python-notifier/ChangeLog >index 4a1a70c..8938448 100644 >--- a/management/python-notifier/python-notifier/ChangeLog >+++ b/management/python-notifier/python-notifier/ChangeLog >@@ -118,7 +118,7 @@ > * notifier/version.py: set version to 0.8.5 > > * notifier/popen.py: when using Shell the command must not be >- split but passed as a string to the subprocess module >+ splitted but passed as a string to the subprocess module > > 2010-06-15 Andreas Büsching <crunchy@bitkipper.net> > >diff --git a/management/python-notifier/python-notifier/README.md b/management/python-notifier/python-notifier/README.md >index 05897e9..a7bff9b 100644 >--- a/management/python-notifier/python-notifier/README.md >+++ b/management/python-notifier/python-notifier/README.md >@@ -168,7 +168,7 @@ shown in the following code snippet. > # within the object > class Test2( object ): > def __init__( self, test ): >- test.signals_connect( 'signal1', self._cb_signal ) >+ test.signal_connect( 'signal1', self._cb_signal ) > > def _cb_signal( self, signal ): > pass >@@ -189,7 +189,7 @@ function as shown in the following snippet. > signals.emit( 'signal1', a, b ) > > # within an object >- test.signals_emit( 'signal1', a, b, c ) >+ test.signal_emit( 'signal1', a, b, c ) > > The signature of the callback function for a signal depends on the > specific signal provider, e.g. each signal may provide as many arguments >diff --git a/management/python-notifier/python-notifier/notifier/threads.py b/management/python-notifier/python-notifier/notifier/threads.py >index f3e8a97..2aebcf4 100644 >--- a/management/python-notifier/python-notifier/notifier/threads.py >+++ b/management/python-notifier/python-notifier/notifier/threads.py >@@ -26,7 +26,7 @@ > > import functools > import sys >-import thread >+import threading > import traceback > > __all__ = [ 'Simple' ] >@@ -59,8 +59,8 @@ def __init__( self, name, function, callback ): > self._trace = None > self._exc_info = None > self._finished = False >- self._id = None >- self._lock = thread.allocate_lock() >+ self._thread = threading.Thread(target=self._run, name=self._name) >+ self._lock = threading.Lock() > global _threads > if not _threads: > notifier.dispatcher_add( _simple_threads_dispatcher ) >@@ -72,26 +72,28 @@ def __del__( self ): > > def run( self ): > """Starts the thread""" >- self._id = thread.start_new_thread( self._run, () ) >+ self._thread.start() > > def _run( self ): > """Encapsulates the given thread function to handle the return > value in a thread-safe way and to catch exceptions raised from > within it.""" > try: >- tmp = self._function() >+ result = self._function() > trace = None > exc_info = None >- except BaseException, e: >+ except BaseException as exc: > exc_info = sys.exc_info() > trace = traceback.format_tb( sys.exc_info()[ 2 ] ) >- tmp = e >- self._lock.acquire() >- self._result = tmp >- self._trace = trace >- self._exc_info = exc_info >- self._finished = True >- self._lock.release() >+ result = exc >+ self.lock() >+ try: >+ self._result = result >+ self._trace = trace >+ self._exc_info = exc_info >+ self._finished = True >+ finally: >+ self.unlock() > > @property > def result( self ): >@@ -150,14 +152,16 @@ def _simple_threads_dispatcher(): > > for task in _threads[ : ]: > task.lock() >- if task.finished: >- task.announce() >- _threads.remove( task ) >- elif hasattr( task, '_signals' ): >- for signal, args in task._signals: >- task.signal_emit( signal, *args ) >- task._signals = [] >- task.unlock() >+ try: >+ if task.finished: >+ task.announce() >+ _threads.remove( task ) >+ elif hasattr( task, '_signals' ): >+ for signal, args in task._signals: >+ task.signal_emit( signal, *args ) >+ task._signals = [] >+ finally: >+ task.unlock() > > return len( _threads ) > 0 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
Actions:
View
|
Diff
Attachments on
bug 44806
: 8927