GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — Frozen dataclasses with slots cannot override __getstate__ or __setstate__ · Issue #104035 · python/cpython Closed Closed Copy link Labels stdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error DescriptionYou are supposed to be able to override how See this example: import pickle from dataclasses import dataclass @dataclass(frozen=True, slots=True) class Foo: bar: int def __getstate__(self): print("getstate") return {"bar": self.bar} def __setstate__(self, state): print("setstate") object.__setattr__(self, "bar", state["bar"]) b = pickle.dumps(Foo(1)) foo = pickle.loads(b) The expected "getstate" and "setstate" lines are never printed because the supplied methods are never called. If either From the source code, it is pretty clear why this is happening. If Linked PRsActivity
MetadataMetadataAssigneesLabelsstdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error ProjectsMilestoneRelationshipsDevelopmentIssue actions |
| You are visitor 01402503 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |