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

Checks fail for classes with immutable metaclasses #65

Closed
shiftinv opened this issue Feb 25, 2022 · 2 comments · Fixed by #66
Closed

Checks fail for classes with immutable metaclasses #65

shiftinv opened this issue Feb 25, 2022 · 2 comments · Fixed by #66
Assignees
Labels
enhancement New feature or request

Comments

@shiftinv
Copy link
Contributor

shiftinv commented Feb 25, 2022

First of all, thank you for this neat tool!

I've been seeing issues with checking classes that have immutable metaclasses, or generally metaclasses that raise an exception in their __setattr__ (or __delattr__), due to this:

t._SLOTSCHECK_POKE = 1 # type: ignore

This seems to be the case defined in the tests here:

class _RestrictiveMeta(type):
def __setattr__(self, name, value) -> None:
raise TypeError("BOOM!")
class _UnsettableClass(metaclass=_RestrictiveMeta):
pass

I'm not too familiar with the specifics of Python extensions, so I couldn't come up with any good solutions, but it would be nice if these types were supported as well.

edit: the second half of this answer may be useful? Seems like an implementation quirk though, so it would need some testing to make sure it's reliable :/

@ariebovenberg
Copy link
Owner

ariebovenberg commented Feb 26, 2022

@shiftinv many thanks for this find! The answer in the link may not be 100% provably correct, but it's way better than the current check.

related: #8

In any case: I can implement this rather easily.

@shiftinv
Copy link
Contributor Author

Awesome, thank you for the quick fix!

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

Successfully merging a pull request may close this issue.

2 participants