Skip to content

Preserve module factory cache entries - #612

Open
fly1d wants to merge 1 commit into
html5lib:masterfrom
fly1d:fix/factory-cache-keys
Open

fly1d wants to merge 1 commit into
html5lib:masterfrom
fly1d:fix/factory-cache-keys

Conversation

@fly1d

@fly1d fly1d commented Oct 28, 2026 •

Copy link
Copy Markdown

Fixes #585.

Requesting an etree builder with fullTree=False, then True, then False returns a new class for the first configuration. Cache misses test literal keys while initializing the module and argument buckets, discarding previously cached configurations. A parser built with the earlier class can then fail an isinstance check against the class obtained again.

Preserve those buckets when inserting a new configuration, and remove the redundant intermediate entry. Add factory and public tree-builder regressions, a changelog entry and author attribution.

Validation on Python 3.11.16/macOS arm64, using local setuptools==70.3.0 build/test constraints:

  • The seven new cases produce six failures and one pass on unchanged main; all seven pass with the fix.
  • Tox py311-base: 17506 passed, 15885 skipped, 683 xfailed; flake8 passed.
  • Tox py311-optional with chardet==5.2.0: 23570 passed, 6038 skipped, 1017 xfailed; flake8 passed.

The setuptools constraint avoids the existing pkg_resources packaging failure. With current optional dependencies (chardet==7.7.0), test_char_win1252 fails on both this branch and unchanged main. These are local compatibility constraints; repository requirements and test configuration are unchanged.

AppVeyor 1.0.452: py27-base passed (22183 passed, 10874 skipped, 1017 xfailed), including flake8. The other jobs stop before tests: the launcher cannot find Python 3.7, and the Python 2.7 optional environment cannot build lxml without Visual C++ 9.0. The same setup failures appear in the preceding 1.0.451 build.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Potential Issue with moduleCache Key Handling in _utils.py

1 participant