Skip to content

Constants.__setstate__ loads pre-1.3.0 pickle blobs via a silent migration shim; drop the shim in 2.0 #279

Description

@derek73

The 1.3.0 pickle fix (#167#169 family) changed Constants.__getstate__ from a dir() sweep to explicit state. Blobs written by the old sweep (1.2.x and earlier, plus pre-fix 1.3.0 builds) carry the read-only computed suffixes_prefixes_titles property in their state, so __setstate__ includes a migration shim that skips any computed-property key instead of raising on its missing setter. The shim's own comment scopes its lifetime: it "can be dropped a release or two after 1.3.0 once they've re-pickled."

The problem with dropping it as-is: the legacy path is completely silent today. Every other planned 2.0 removal warns in advance; this one would surface as a raw AttributeError on a property with no setter, with no breadcrumb pointing at the actual cause (a stale blob) or the fix (re-pickle). This affects any pickle containing a Constants written before the fix — including HumanName pickles that embed their own config.

2.0: drop the skip-and-continue behavior. Keep the one-line detection (isinstance(getattr(type(self), name, None), property)) but raise a clear ValueError naming the problem and the fix ("state contains computed-property keys — this blob was written by nameparser ≤ 1.2.x; re-pickle it under 1.3/1.4"), matching the existing missing-field ValueError style directly below it in __setstate__.

Bridge (1.4) — tracked in #263

  • DeprecationWarning when the legacy path triggers (once per __setstate__ call, not per skipped key): the blob is legacy-format, will stop loading in 2.0, re-pickle to migrate

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions