Skip to content

Commit

Permalink
Merge pull request #1664 from LilSpazJoekp/master
Browse files Browse the repository at this point in the history
Broaden exception catch for async check
  • Loading branch information
bboe authored Feb 7, 2021
2 parents 1453036 + fc3af25 commit 68ef2de
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
4 changes: 4 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ Change Log
Unreleased
----------

**Fixed**

* Asynchronous check will no longer fail in Python 3.6 multithreading edge cases.

7.1.3 (2021/02/05)
------------------

Expand Down
12 changes: 6 additions & 6 deletions praw/reddit.py
Original file line number Diff line number Diff line change
Expand Up @@ -375,14 +375,14 @@ def _check_for_async(self):
except NameError:
pass
in_async = False
if sys.version_info >= (3, 7, 0):
try:
try:
if sys.version_info >= (3, 7, 0):
asyncio.get_running_loop()
in_async = True
except RuntimeError:
pass
else:
in_async = asyncio.get_event_loop().is_running()
else:
in_async = asyncio.get_event_loop().is_running()
except Exception: # Quietly fail if any exception occurs during the check
pass
if in_async:
logger.warning(
"It appears that you are using PRAW in an asynchronous"
Expand Down

0 comments on commit 68ef2de

Please sign in to comment.