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

Extending ProbablisticModel protocol hierarchy breaks isinstance checks #836

Open
uri-granta opened this issue Apr 9, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@uri-granta
Copy link
Collaborator

Running the following code snippet in a fresh Python 3.10 venv with trieste installed via pip:

from trieste.models.interfaces import ProbabilisticModel
from typing import Protocol
class SomeProbabilisticModel(ProbabilisticModel, Protocol): pass
assert not isinstance(1, ProbabilisticModel)

results in the following error:

TypeError: Protocols with non-method members don't support issubclass()

Removing the SomeProbabilisticModel definition on line 3 fixes the issue, as does moving the definition into trieste itself. It also seems to be fixed with Python 3.12.

It would be nice to figure out what is causing this, as it prevents us from reliably being able to use isinstance checks.

@uri-granta uri-granta added the bug Something isn't working label Apr 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant