This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Error when using Generic and __slots__
Type: behavior Stage: resolved
Components: Versions: Python 3.7, Python 3.6, Python 3.5
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: gvanrossum Nosy List: gvanrossum, levkivskyi, ned.deily, python-dev
Priority: normal Keywords:

Created on 2016-11-24 20:04 by gvanrossum, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Messages (4)
msg281649 - (view) Author: Guido van Rossum (gvanrossum) * (Python committer) Date: 2016-11-24 20:04
Proxy for https://github.com/python/typing/issues/332 (issue) and https://github.com/python/typing/pull/334 (fix).

"""
from typing import Generic, TypeVar

class C(Generic[TypeVar('T')]):
	__slots__ = ('potato',)

# ValueError: 'potato' in __slots__ conflicts with class variable
C[int]

This is because bare C is created with a class member descriptor potato, and instantiating it tries to create a class with all the attributes in C.
"""

@ned, I'll leave it up to you whether this is of sufficient severity to put in 3.6rc1 or not.

Do I need to attach the fix as a diff to this bug?
msg281940 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2016-11-29 03:35
I don't have a good sense of the severity of this issue but it doesn't seem like it qualifies as release critical.  On the other hand, the changes are isolated to typing and typing is more fluid than older, more established modules.  If you think it should go in 3.6.0rc1, I won't object.
msg282023 - (view) Author: Guido van Rossum (gvanrossum) * (Python committer) Date: 2016-11-29 17:44
OK, having thought about it some more, given that you don't seem to object too strenuously, I'm going to merge the fix. May it be the last one!
msg282025 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2016-11-29 17:51
New changeset 0bbd29405c9d by Guido van Rossum in branch '3.5':
Issue #28790: Fix error when using Generic and __slots__ (Ivan L)
https://hg.python.org/cpython/rev/0bbd29405c9d

New changeset 2dd08b5b5ee6 by Guido van Rossum in branch '3.6':
Issue #28790: Fix error when using Generic and __slots__ (Ivan L) (3.5->3.6)
https://hg.python.org/cpython/rev/2dd08b5b5ee6

New changeset b9915ca4b3da by Guido van Rossum in branch 'default':
Issue #28790: Fix error when using Generic and __slots__ (Ivan L) (3.6->3.7)
https://hg.python.org/cpython/rev/b9915ca4b3da
History
Date User Action Args
2022-04-11 14:58:40adminsetgithub: 72976
2016-11-29 19:41:23ned.deilysetstage: commit review -> resolved
2016-11-29 17:51:44gvanrossumsetstatus: open -> closed
type: behavior
resolution: fixed
stage: commit review
2016-11-29 17:51:22python-devsetnosy: + python-dev
messages: + msg282025
2016-11-29 17:44:14gvanrossumsetmessages: + msg282023
2016-11-29 03:35:59ned.deilysetmessages: + msg281940
2016-11-24 20:05:34gvanrossumsetnosy: + levkivskyi
2016-11-24 20:04:07gvanrossumcreate