New submission from Ilia Korvigo: I've got conflicts between Python's typing system and `__slots__`. Here is a small reproducible example.
from typing import TypeVar, Generic, Sequence T = TypeVar("T") class TestGeneric(Sequence, Generic[T]): __slots__ = ("test",) def __init__(self, test: T): self.test = [test] def __iter__(self): return iter(self.test) def __len__(self): return len(self.test) def __contains__(self, item): return item in self.test def __getitem__(self, _): return self.test[0] Now whenever I try to specify a content type, e.g. V = TestGeneric[int] I get ValueError: 'test' in __slots__ conflicts with class variable I use `Generics` in classes without slots a lot, hence I think this error has to be linked to `__slots__`. Moreover, the same class works fine, if you remove the `__slots__` ---------- components: Library (Lib) messages: 300797 nosy: grayfall priority: normal severity: normal status: open title: typing module conflicts with __slots__-classes type: behavior versions: Python 3.5 _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue31272> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com