mirror of
https://github.com/eternnoir/pyTelegramBotAPI.git
synced 2023-08-10 21:12:57 +03:00
Fix python3 raise exception error.
This commit is contained in:
parent
29a42a398b
commit
855ff40070
@ -2,9 +2,11 @@
|
|||||||
|
|
||||||
import threading
|
import threading
|
||||||
import sys
|
import sys
|
||||||
|
import six
|
||||||
from six import string_types
|
from six import string_types
|
||||||
|
|
||||||
# Python3 queue support.
|
# Python3 queue support.
|
||||||
|
|
||||||
try:
|
try:
|
||||||
import Queue
|
import Queue
|
||||||
except ImportError:
|
except ImportError:
|
||||||
@ -66,7 +68,7 @@ class WorkerThread(threading.Thread):
|
|||||||
|
|
||||||
def raise_exceptions(self):
|
def raise_exceptions(self):
|
||||||
if self.exception_event.is_set():
|
if self.exception_event.is_set():
|
||||||
raise self.exc_info[0], self.exc_info[1], self.exc_info[2]
|
six.reraise(self.exc_info[0], self.exc_info[1], self.exc_info[2])
|
||||||
|
|
||||||
def clear_exceptions(self):
|
def clear_exceptions(self):
|
||||||
self.exception_event.clear()
|
self.exception_event.clear()
|
||||||
@ -96,7 +98,7 @@ class ThreadPool:
|
|||||||
|
|
||||||
def raise_exceptions(self):
|
def raise_exceptions(self):
|
||||||
if self.exception_event.is_set():
|
if self.exception_event.is_set():
|
||||||
raise self.exc_info[0], self.exc_info[1], self.exc_info[2]
|
six.reraise(self.exc_info[0], self.exc_info[1], self.exc_info[2])
|
||||||
|
|
||||||
def clear_exceptions(self):
|
def clear_exceptions(self):
|
||||||
self.exception_event.clear()
|
self.exception_event.clear()
|
||||||
@ -129,7 +131,7 @@ class AsyncTask:
|
|||||||
if not self.done:
|
if not self.done:
|
||||||
self.thread.join()
|
self.thread.join()
|
||||||
if isinstance(self.result, BaseException):
|
if isinstance(self.result, BaseException):
|
||||||
raise self.result[0], self.result[1], self.result[2]
|
six.reraise(self.result[0], self.result[1], self.result[2])
|
||||||
else:
|
else:
|
||||||
return self.result
|
return self.result
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user