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 eric.smith
Recipients JelleZijlstra, barry, eric.smith, gvanrossum, kj, larry, lukasz.langa, methane, xtreak
Date 2021-04-27.00:03:28
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1619481809.14.0.989530428528.issue43817@roundup.psfhosted.org>
In-reply-to
Content
I'd like to see the default behavior be to raise an exception if eval fails on any annotation.

I think it's reasonable to provide a way to find out which specific keys have problems, but I don't think that should be the default. Wouldn't it be good enough to have a flag which says "just return me a dict which only has keys for items which don't contain errors"? Let's call it silence_errors for discussion sake. You could then figure out which ones contain errors by:

getattr(obj, "__annotations__", {}).keys() - get_annotations(obj, silence_errors=True).keys()

That is, silence_errors works on a per-key basis, not the call to get_annotations() as a whole.
History
Date User Action Args
2021-04-27 00:03:29eric.smithsetrecipients: + eric.smith, gvanrossum, barry, larry, methane, lukasz.langa, JelleZijlstra, xtreak, kj
2021-04-27 00:03:29eric.smithsetmessageid: <1619481809.14.0.989530428528.issue43817@roundup.psfhosted.org>
2021-04-27 00:03:29eric.smithlinkissue43817 messages
2021-04-27 00:03:28eric.smithcreate