Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

isinstance return different result with sys.setprofile #318

Open
lonsdale8734 opened this issue Jan 4, 2024 · 1 comment
Open

isinstance return different result with sys.setprofile #318

lonsdale8734 opened this issue Jan 4, 2024 · 1 comment

Comments

@lonsdale8734
Copy link

python: 3.8.5

import sys
from typing import TypeVar


def run():
    sys.modules.pop("typing_extensions", None)
    from typing_extensions import ParamSpec
    return isinstance(ParamSpec("P"), TypeVar)


def trace_call(frame, event, arg):
   return trace_call


if __name__ == "__main__":
    print(run()) # True

    sys.setprofile(trace_call)
    print(run()) # False??

    sys.setprofile(None)
    print(run()) #  True
@srittau
Copy link
Collaborator

srittau commented Jan 4, 2024

FWIW, I can reproduce this with Python 3.8.18 and 3.9.18, but not with 3.10.13 and 3.11.6, where the typing version of ParamSpec is re-exported.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants