Skip to content

Fix dependency group malformed parse caching#1248

Merged
henryiii merged 4 commits into
pypa:mainfrom
r266-tech:fix-dependency-groups-error-cache
Jun 16, 2026
Merged

Fix dependency group malformed parse caching#1248
henryiii merged 4 commits into
pypa:mainfrom
r266-tech:fix-dependency-groups-error-cache

Conversation

@r266-tech

Copy link
Copy Markdown
Contributor

Refs #1239

Summary

  • reject non-string include-group values before constructing a dependency-group include
  • avoid storing parsed dependency groups when parsing collected errors, so repeated lookups keep reporting malformed data
  • add regression coverage for repeated malformed lookup on the same resolver

Tests

  • uv run pytest tests/test_dependency_groups.py -q
  • uv run ruff check src/packaging/dependency_groups.py tests/test_dependency_groups.py

Comment thread src/packaging/dependency_groups.py Outdated
@henryiii henryiii requested a review from sirosen June 12, 2026 01:27
henryiii: prefer the 'msg = ...; errors.error(TypeError(msg))' form (PR pypa#981
style) for the include-group type error.
@r266-tech

Copy link
Copy Markdown
Contributor Author

Done in 3cecdcf — switched the include-group type error to the msg = ...; errors.error(TypeError(msg)) form.

Comment thread src/packaging/dependency_groups.py Outdated
…scarded by the raising caller; clearer per review)
@r266-tech

Copy link
Copy Markdown
Contributor Author

Switched the error-path to return () per @sirosen — agreed it reads more clearly that no meaningful result is produced (the value is discarded anyway, since lookup raises when errors.errors is non-empty). @henryiii thanks for the latitude. The malformed-parse caching fix and its regression test are unchanged.

@henryiii henryiii merged commit 349abfa into pypa:main Jun 16, 2026
59 checks passed
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.

3 participants