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

Emit a warning when instrumentation encounters a type it cannot check #347

Open
1 task done
agronholm opened this issue Apr 26, 2023 · 1 comment
Open
1 task done

Comments

@agronholm
Copy link
Owner

agronholm commented Apr 26, 2023

Things to check first

  • I have searched the existing issues and didn't find my feature already requested there

Feature description

The instrumentation code should emit an InstrumentationWarning (when in debug mode) when it encounters a type that has been designated as "ignored" (due to, for example, being imported under if TYPE_CHECKING:.

Use case

It may be sometimes difficult to understand why a type check has been omitted from the instrumented code. Adding code comments for this is not possible because comments are not part of the abstract syntax tree.

@agronholm
Copy link
Owner Author

There is the option of storing the comments on the transformer itself, and injecting them into the debug output using less sophisticated methods like string searching. This is very difficult to do reliably though.

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

No branches or pull requests

1 participant