Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d94e37bb40 | ||
|
|
178da73d27 | ||
|
|
cc4c55839d |
@ -1,5 +1,5 @@
|
||||
'''
|
||||
Copyright (c) 2016, 2017, 2019 Timothy Savannah All Rights Reserved.
|
||||
Copyright (c) 2016, 2017, 2019, 2023 Timothy Savannah All Rights Reserved.
|
||||
|
||||
Licensed under the Lesser GNU Public License Version 3, LGPLv3. You should have recieved a copy of this with the source distribution as
|
||||
LICENSE, otherwise it is available at https://github.com/kata198/func_timeout/LICENSE
|
||||
@ -32,6 +32,7 @@ class StoppableThread(threading.Thread):
|
||||
|
||||
The exception is raised over and over, with a specifed delay (default 2.0 seconds)
|
||||
'''
|
||||
isNestedStoppableThread = None
|
||||
|
||||
|
||||
def _stopThread(self, exception, raiseEvery=2.0):
|
||||
@ -41,6 +42,12 @@ class StoppableThread(threading.Thread):
|
||||
if self.is_alive() is False:
|
||||
return True
|
||||
|
||||
currentThread = threading.current_thread()
|
||||
if issubclass(currentThread.__class__, StoppableThread):
|
||||
currentThread.isNestedStoppableThread = True
|
||||
else:
|
||||
currentThread.isNestedStoppableThread = False
|
||||
|
||||
self._stderr = open(os.devnull, 'w')
|
||||
|
||||
# Create "joining" thread which will raise the provided exception
|
||||
|
||||
@ -1,13 +1,13 @@
|
||||
'''
|
||||
Copyright (c) 2016, 2017, 2019 Tim Savannah All Rights Reserved.
|
||||
Copyright (c) 2016, 2017, 2019, 2023 Tim Savannah All Rights Reserved.
|
||||
|
||||
Licensed under the Lesser GNU Public License Version 3, LGPLv3. You should have recieved a copy of this with the source distribution as
|
||||
LICENSE, otherwise it is available at https://github.com/kata198/func_timeout/LICENSE
|
||||
'''
|
||||
|
||||
|
||||
__version__ = '4.3.5'
|
||||
__version_tuple__ = (4, 3, 5)
|
||||
__version__ = '4.4.0'
|
||||
__version_tuple__ = (4, 4, 0)
|
||||
|
||||
__all__ = ('func_timeout', 'func_set_timeout', 'FunctionTimedOut', 'StoppableThread')
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
# vim: set ts=4 sw=4 expandtab :
|
||||
|
||||
'''
|
||||
Copyright (c) 2016, 2017 Tim Savannah All Rights Reserved.
|
||||
Copyright (c) 2016, 2017, 2023 Tim Savannah All Rights Reserved.
|
||||
|
||||
Licensed under the Lesser GNU Public License Version 3, LGPLv3. You should have recieved a copy of this with the source distribution as
|
||||
LICENSE, otherwise it is available at https://github.com/kata198/func_timeout/LICENSE
|
||||
@ -68,6 +68,9 @@ def func_timeout(timeout, func, args=(), kwargs=None):
|
||||
ret.append( func(*args2, **kwargs2) )
|
||||
except FunctionTimedOut:
|
||||
# Don't print traceback to stderr if we time out
|
||||
currentThread = threading.current_thread()
|
||||
if getattr(currentThread, 'isNestedStoppableThread', False) is True:
|
||||
raise
|
||||
pass
|
||||
except Exception as e:
|
||||
exc_info = sys.exc_info()
|
||||
|
||||
6
setup.py
6
setup.py
@ -1,6 +1,6 @@
|
||||
#!/usr/bin/env python
|
||||
'''
|
||||
Copyright (c) 2016, 2017 Tim Savannah All Rights Reserved.
|
||||
Copyright (c) 2016, 2017, 2023 Tim Savannah All Rights Reserved.
|
||||
This software is licensed under the terms of the Lesser GNU General Public License Version 2.1 (LGPLv2.1)
|
||||
|
||||
You should have received a copy of this with the source distribution as LICENSE,
|
||||
@ -30,7 +30,7 @@ if __name__ == '__main__':
|
||||
log_description = summary
|
||||
|
||||
setup(name='func_timeout',
|
||||
version='4.3.5',
|
||||
version='4.4.0',
|
||||
packages=['func_timeout'],
|
||||
author='Tim Savannah',
|
||||
author_email='kata198@gmail.com',
|
||||
@ -50,6 +50,8 @@ if __name__ == '__main__':
|
||||
'Programming Language :: Python :: 3.5',
|
||||
'Programming Language :: Python :: 3.6',
|
||||
'Programming Language :: Python :: 3.7',
|
||||
'Programming Language :: Python :: 3.8',
|
||||
'Programming Language :: Python :: 3.9',
|
||||
'Topic :: Software Development :: Libraries :: Python Modules'
|
||||
]
|
||||
)
|
||||
|
||||
2
tests/.gitignore
vendored
Normal file
2
tests/.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
*.pyc
|
||||
GoodTests.py
|
||||
Loading…
Reference in New Issue
Block a user