Skip to content

Update atomdict#266

Open
frmdstryr wants to merge 1 commit intonucleic:mainfrom
frmdstryr:update-atomdict
Open

Update atomdict#266
frmdstryr wants to merge 1 commit intonucleic:mainfrom
frmdstryr:update-atomdict

Conversation

@frmdstryr
Copy link
Copy Markdown
Contributor

@frmdstryr frmdstryr commented Apr 30, 2026

This validates the key before use in AtomDict_setdefault and DefaultAtomDict_missing to avoid the unlikely yet possible case where the key is coerced which would cause the second lookup to return null.

It also corrects the bases argument as described in the recent code review, checks for unicode decode errors in DefaultDict_repr, cleans up some outdated version guards, and changes DefaultAtomDict_missing to METH_O.

@frmdstryr frmdstryr force-pushed the update-atomdict branch 3 times, most recently from cfac883 to debdfa2 Compare May 6, 2026 11:47
@MatthieuDartiailh
Copy link
Copy Markdown
Member

Out of curiosity do you have a use case for this coercion of the key before access ? I agree it is correct but it feels unfortunate. I wonder if we should validate only if the key is not found to avoid the performance hit.

@codecov
Copy link
Copy Markdown

codecov Bot commented May 8, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.52%. Comparing base (b2b0595) to head (8ce3987).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #266   +/-   ##
=======================================
  Coverage   97.52%   97.52%           
=======================================
  Files          24       24           
  Lines        1093     1093           
  Branches      167      167           
=======================================
  Hits         1066     1066           
  Misses         13       13           
  Partials       14       14           
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@frmdstryr
Copy link
Copy Markdown
Contributor Author

I've never used it no.

@frmdstryr
Copy link
Copy Markdown
Contributor Author

It could do an unvalidated key lookup first, if it fails, lookup then do what is it does in this pr? Or do you have another idea?

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.

2 participants