Skip to content

Stubtest: add some hacks so that sys.monitoring is checked in typeshed's CI #16269

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

AlexWaygood
Copy link
Member

@AlexWaygood AlexWaygood commented Oct 15, 2023

Currently, in typeshed's CI, stubtest isn't detecting that sys.monitoring is missing from typeshed. Even if you add sys.monitoring stubs to typeshed, stubtest doesn't verify that any of the details about sys.monitoring are correct, since sys.monitoring is somewhat unique: it's a genuine instance of types.ModuleType in the global namespace of the sys module, but import sys.monitoring will fail at runtime (sys isn't a package).

I verified locally that these changes cause stubtest to start complaining about sys.monitoring being missing with typeshed's current setup; and, if python/typeshed#10890 were merged, these changes here would cause stubtest to start complaining if there were any inaccuracies between the runtime and the stubs for sys.monitoring

@sobolevn
Copy link
Member

I would propose changing this in CPython :(

@AlexWaygood
Copy link
Member Author

AlexWaygood commented Oct 16, 2023

I would propose changing this in CPython :(

It's not the design I would have chosen, for sure. There was discussion on this in the original PR that implemented the feature: python/cpython#103083 (comment)

Perhaps Mark would be receptive to this being changed, reading through the comments again. I'm not sure.

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

Successfully merging this pull request may close these issues.

2 participants