mirror of
https://github.com/python-telegram-bot/python-telegram-bot.git
synced 2025-03-27 08:50:38 +01:00
Stabilize Application.run_*
on Python 3.7 (#3009)
This commit is contained in:
parent
be8f4f7aad
commit
a299867b1b
2 changed files with 9 additions and 0 deletions
|
@ -309,6 +309,10 @@ class Updater(AbstractAsyncContextManager):
|
||||||
pool_timeout=pool_timeout,
|
pool_timeout=pool_timeout,
|
||||||
allowed_updates=allowed_updates,
|
allowed_updates=allowed_updates,
|
||||||
)
|
)
|
||||||
|
except asyncio.CancelledError as exc:
|
||||||
|
# TODO: in py3.8+, CancelledError is a subclass of BaseException, so we can drop
|
||||||
|
# this clause when we drop py3.7
|
||||||
|
raise exc
|
||||||
except TelegramError as exc:
|
except TelegramError as exc:
|
||||||
# TelegramErrors should be processed by the network retry loop
|
# TelegramErrors should be processed by the network retry loop
|
||||||
raise exc
|
raise exc
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
# along with this program. If not, see [http://www.gnu.org/licenses/].
|
# along with this program. If not, see [http://www.gnu.org/licenses/].
|
||||||
"""This module contains an abstract class to make POST and GET requests."""
|
"""This module contains an abstract class to make POST and GET requests."""
|
||||||
import abc
|
import abc
|
||||||
|
import asyncio
|
||||||
from contextlib import AbstractAsyncContextManager
|
from contextlib import AbstractAsyncContextManager
|
||||||
from http import HTTPStatus
|
from http import HTTPStatus
|
||||||
from types import TracebackType
|
from types import TracebackType
|
||||||
|
@ -275,6 +276,10 @@ class BaseRequest(
|
||||||
connect_timeout=connect_timeout,
|
connect_timeout=connect_timeout,
|
||||||
pool_timeout=pool_timeout,
|
pool_timeout=pool_timeout,
|
||||||
)
|
)
|
||||||
|
except asyncio.CancelledError as exc:
|
||||||
|
# TODO: in py3.8+, CancelledError is a subclass of BaseException, so we can drop this
|
||||||
|
# clause when we drop py3.7
|
||||||
|
raise exc
|
||||||
except TelegramError as exc:
|
except TelegramError as exc:
|
||||||
raise exc
|
raise exc
|
||||||
except Exception as exc:
|
except Exception as exc:
|
||||||
|
|
Loading…
Add table
Reference in a new issue