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 larry
Recipients JelleZijlstra, barry, eric.smith, gvanrossum, kj, larry, lukasz.langa, methane, xtreak
Date 2021-04-26.21:21:55
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1619472116.39.0.951193198135.issue43817@roundup.psfhosted.org>
In-reply-to
Content
> I'm not a big user of the inspect module, but I always thought that
> its use was so that you could look at a function (or other object)
> *produced by a 3rd party* and learn something about it.

That's interesting!  I always thought its main use was the opposite--it was so third parties could introspect *your* functions.  Like, Pydantic examines your function's signature so it can wrap it with runtime validation.  (Though in this specific case, I believe Pydantic examines __annotations__ directly.)  I also dimly recall a Python library that built COM bindings around your code, but I can't find it right now.

I can't remember ever writing application code that used inspect.signature() to inspect library functions--but I've certainly written library functions that used inspect.signature() to inspect application code.


> Asking for the signature is one such operation, and I'd be rather
> upset if I couldn't inspect the annotation if that 3rd party happened
> to have added a bad string annotation.

Do you think that's likely?  I'd be quite surprised if it was common for third party libraries to have string annotations--either manual or using automatic stringizing--in the first place.  I thought string annotations were really only used as part of type hints, and the type-hinted code was all internal code bases from large organizations, not third-party libraries.  But I concede I know little about it.

Following on to that, the annotations would have to be bad, which means again either someone made a typo or it was done deliberately.  The latter reason would be simply obnoxious if done by a third-party library--third-party libraries should not have the circular imports problem used to justifiy such practices.

I suppose third-party libraries are just as error-prone as anybody else, so if they were manually stringizing their annotations, it could happen there.  Which I agree would be annoying, just like any bug in a third-party library.  But I wouldn't agree this specific error is so special that we need to suppress it.
History
Date User Action Args
2021-04-26 21:21:56larrysetrecipients: + larry, gvanrossum, barry, eric.smith, methane, lukasz.langa, JelleZijlstra, xtreak, kj
2021-04-26 21:21:56larrysetmessageid: <1619472116.39.0.951193198135.issue43817@roundup.psfhosted.org>
2021-04-26 21:21:56larrylinkissue43817 messages
2021-04-26 21:21:55larrycreate