You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
correct identification of stdlib TypeVar objs (#412)
* correct identification of stdlib TypeVar objs
In Python <= 3.7, the module attribute of TypeVar constructs is always
set to typing and thus irrelevant to the true origin of the construct
(stdlib, third-party, user-defined). cloudpickle used to cirumvent this
issue in `_whichmodule` by exhaustively search for the construct in all
imported modules. This would generate false positive in the case of
stdlib TypeVar constructs such as AnyStr being used by imported
third-party module. For such TypeVar construct, `_whichmodule` would
occasionally flag them as belonging to the third party module. This
resulted in a flaky test
(`test_lookup_module_and_qualname_stdlib_typevar`) where `typing.AnyStr`
was occasionally marked as defined in `_pytest.capture` instead of
`typing`.
Co-authored-by: Olivier Grisel <[email protected]>
0 commit comments