This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author asvetlov
Recipients asvetlov, iritkatriel, yselivanov, zbentley
Date 2022-03-10.02:05:52
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1646877952.85.0.684465838297.issue45033@roundup.psfhosted.org>
In-reply-to
Content
'catch (boost::python::error_already_set e)' is equal to `except BaseException as e:`
In Python, blind catching base exception is dangerous, the code should re-raise it usually.
The same is true for boost::python usage.

> how would it tell the difference between a "real" exception raised from within whatever function is currently returning and the "fake" StopIteration exception that is in the error global while an async function returns?

There is no "fake" exception. async function is a kind of Python generator object that uses StopIteration exception for finishing.
The same is true for a regular Python iterator; nothing asyncio specific.

I suggest writing a functional equivalent for `except Exception as e: print(e)` instead of catching BaseException error.
History
Date User Action Args
2022-03-10 02:05:52asvetlovsetrecipients: + asvetlov, yselivanov, iritkatriel, zbentley
2022-03-10 02:05:52asvetlovsetmessageid: <1646877952.85.0.684465838297.issue45033@roundup.psfhosted.org>
2022-03-10 02:05:52asvetlovlinkissue45033 messages
2022-03-10 02:05:52asvetlovcreate