Repository navigation
Deprecate the 2.x Lexicon translation: a 2.x pickle load warns (#754) - #1002
Merged
Merged
Conversation
The translation of 2.x set spellings and pickles into readings is migration scaffolding: it stays in 3.0 and is deleted in 3.1. A Lexicon pickled by 2.x (and a Parser or locale pack holding one) now loads with a DeprecationWarning, once per Lexicon, attributed to the caller's pickle.loads line, naming the re-pickle remedy. The old spellings already raise, so their per-word fix is unchanged. Records the lifetime and what 3.1 does instead in decisions/vocabulary-model; notes it in docs/migrate.rst, the release log and AGENTS.md's Pickling bullet. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
derek73
force-pushed
the
feat/deprecate-2x-lexicon-translation
branch
from
November 2, 2026 23:00
062a0ef to
1e56caa
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of #754. Makes the decided lifetime of the 2.x translation real: it is migration scaffolding, kept in 3.0 deprecated and deleted in 3.1.
What changes
Lexiconpickle load warns.Lexicon.__setstate__emits aDeprecationWarningafter a 2.x state loads successfully. It fires once for eachLexiconloaded, so aParseror locale pack holding one warns once, and a refused state raises without a warning. The message says the pickle was written by nameparser 2.x, that 3.1 will refuse it, and that the loaded object should be re-pickled under 3.0 (pickle.dumps(obj))._warn_at_callergains acategoryparameter.pickle.loadsis C and adds no Python frame, so the helper's walk reaches the caller's ownpickle.loadsline. A test pinsw.filename == __file__._lexicon.pydiff stays at the warning site. The translation code itself is untouched; a parallel simplify pass is working elsewhere in that file.Tests
_loadedrecords it and asserts exactly oneDeprecationWarningwith the message.Lexicons), each attributed to the test file.parsers_4ib.pickle, and a fresh one) loads with no warning.Docs
decisions/vocabulary-model: a dated entry recording the lifetime, what 3.1 does instead, and why that is a minor-release change. In 3.1, an old spelling gets a short fixedTypeErrorpointing atdocs/migrate.rst's table of kinds, and a 2.x pickle is refused with "re-pickle under 3.0". The calls already fail in 3.0, and pickle breaks ship in minors with a release-log bullet.docs/migrate.rst: a short note on the warning, the re-pickle remedy and the 3.1 change to the errors.Gates
uv run pytest(34,737 passed) and--python 3.15: pass.-n0 -m serial: 42 passed on a quiet machine. A first run under load from parallel sessions failed 5 timing tests.mypy,ruff: pass.README.rst: pass.snapshot.jsonl: byte-identical. No parse moves.The 3.1 deletion is #1003; the decisions entry and the release bullet point at it.
🤖 Generated with Claude Code