Movatterモバイル変換


[0]ホーム

URL:


homepage

Message315030

This issue trackerhas been migrated toGitHub, and is currentlyread-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Authorjhaydaman
Recipientsasvetlov, jhaydaman, yselivanov
Date2018-04-06.18:02:45
SpamBayes Score-1.0
Marked as misclassifiedYes
Message-id<1523037765.71.0.682650639539.issue33238@psf.upfronthosting.co.za>
In-reply-to
Content
When the concurrent Future wrapped by asyncio.wrap_future has set_result or set_exception called multiple times, I get the following traceback:Traceback (most recent call last):  File "/usr/local/lib/python3.6/asyncio/events.py", line 145, in _run    self._callback(*self._args)  File "/usr/local/lib/python3.6/asyncio/futures.py", line 399, in _set_state    _copy_future_state(other, future)  File "/usr/local/lib/python3.6/asyncio/futures.py", line 369, in _copy_future_state    assert not dest.done()AssertionErrorMinimal reproducible example:import asyncioimport concurrent.futuresf = concurrent.futures.Future()async_f = asyncio.wrap_future(f)f.set_result(1)f.set_result(1)loop = asyncio.get_event_loop()loop.run_until_complete(async_f)The documentation says that set_result and set_exception are only meant for Executors, so, arguably using them outside of that context would fall into undocumented behavior rather than a bug. But it still seems like it should be the second set_result that raises something like InvalidStateError. Alternatively, this can be avoided if _copy_future_state checks for done in addition to cancellation. What should happen here?
History
DateUserActionArgs
2018-04-06 18:02:45jhaydamansetrecipients: +jhaydaman,asvetlov,yselivanov
2018-04-06 18:02:45jhaydamansetmessageid: <1523037765.71.0.682650639539.issue33238@psf.upfronthosting.co.za>
2018-04-06 18:02:45jhaydamanlinkissue33238 messages
2018-04-06 18:02:45jhaydamancreate
Supported byThe Python Software Foundation,
Powered byRoundup
Copyright © 1990-2022,Python Software Foundation
Legal Statements

[8]ページ先頭

©2009-2026 Movatter.jp