FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

gh-142615: disallow multiple initializations of asyncio tasks and futures by kumaraditya303 · Pull Request #142616 · python/cpython · GitHub

Repository navigation

Prev Previous commit
Next Next commit
do the same for python tasks
  • Loading branch information
kumaraditya303 committed Dec 12, 2025
commit ffa9ec9b1103ffbc9ee5a83f0662effa56c7cdb4
4 changes: 4 additions & 0 deletions Lib/asyncio/futures.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,10 @@ def __init__(self, *, loop=None):
loop object used by the future. If it's not provided, the future uses
the default event loop.
"""
if self._loop is not None:
raise RuntimeError(f'{self.__class__.__name__} object is already '
'initialized.')

if loop is None:
self._loop = events.get_event_loop()
else:
Expand Down
Loading

Back | FazBrowse Home | New Git URL