homepage

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.

Author maatt
Recipients maatt
Date 2015年10月25日.03:09:32
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1445742573.23.0.0225018159767.issue25472@psf.upfronthosting.co.za>
In-reply-to
Content
If I try to pickle and unpickle an object of a class that has specialized a generic superclass, when I try to unpickle I get this error:
TypeError: descriptor '__dict__' for 'A' objects doesn't apply to 'B' object
Test case:
from typing import Generic, TypeVar
import pickle
T = TypeVar("T")
class A(Generic[T]):
 def __init__(self, x: T):
 self.x = x
class B(A[str]):
 def __init__(self, x: str):
 self.x = x
b = B("hello")
z = pickle.dumps(b)
print(z)
_ = pickle.loads(z)
History
Date User Action Args
2015年10月25日 03:09:33maattsetrecipients: + maatt
2015年10月25日 03:09:33maattsetmessageid: <1445742573.23.0.0225018159767.issue25472@psf.upfronthosting.co.za>
2015年10月25日 03:09:33maattlinkissue25472 messages
2015年10月25日 03:09:32maattcreate

AltStyle によって変換されたページ (->オリジナル) /