| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
object_getstate_default kept the __slotnames__ list read-locked while it looked up each slot attribute. A getter or __getattr__ that changed the list (as in test_descr.test_issue24097) then waited forever for the write lock. A non-str entry in a cached __slotnames__ hit an unwrap and panicked. Take a reference to each name and drop the lock before the lookup, raise TypeError for a non-str name, let errors other than AttributeError propagate, and check the list size after each item, as CPython does. Assisted-by: Claude Code:claude-opus-5-5
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
Sorry, something went wrong.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info ⚙️ Run configuration
Reviewing files that changed from the base of the PR and between 3e0e401 and 0026fce. ⛔ Files ignored due to path filters (1)
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review. 📝 Walkthrough Walkthroughobject.__getstate__ now validates cached slot names, releases the list lock during attribute lookup, propagates lookup and insertion errors, and raises RuntimeError if the slot-name list changes length. Tests cover these cases and missing slots. ChangesObject getstate slot handling
Priority: ⬇️ Low Estimated code review effort: 2 (Simple) | ~10 minutes Change: Bug fix Suggested reviewers: youknowone Merge Risk: ⚪ Minimal · up to 0026f No merge-blocking issue is identified; merge after normal checks. Security Architecture ReviewSecurity architecture risk: 🟡 Moderate · up to 0026f The change removes the reported deadlock and invalid-name panic paths, but introduces another possible native panic when a concurrent thread shrinks the slot-name list before an indexed read. This requires control of the list and concurrent execution; broader service impact or privilege escalation is not established. Retained concerns
Security Blast Radius
Security Findings and Attack Paths
Trust Boundaries and Controls
Resilience and Maintainability Implications
Hardening Proposals
❌ Failed checks (1 warning)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. ❤️ ShareComment @coderabbitai help to get the list of available commands. |
Sorry, something went wrong.
📦 Library DependenciesThe following Lib/ modules were modified. Here are their dependencies: [x] test: cpython/Lib/test/test_descr.py (TODO: 2) dependencies: dependent tests: (no tests depend on descr) Legend:
|
Sorry, something went wrong.
Merging this PR will improve performance by 10.98%⚡ 1 improved benchmark Performance Changes
Tip Curious why performance improved? Comment @codspeedbot explain why performance improved on this PR, or directly use the CodSpeed MCP with your agent. Comparing luantaraschi:fix/object-getstate-guard (0026fce) with main (3e0e401) Footnotes
|
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
Summary
object_getstate_default held the __slotnames__ read lock while it looked up each slot attribute. If a getter or __getattr__ mutates the list during that lookup, which is exactly what test_descr.test_issue24097 does, it blocks on the write lock forever. On main that test hangs until the runner's 30 s timeout, so it was skipped.
A non-str entry in a cached __slotnames__ hit downcast_ref::<PyStr>().unwrap() instead:
The loop now clones each name out of the list and drops the lock before the lookup, and raises TypeError: attribute name must be string, not 'int' for a non-str name. Only AttributeError is ignored now (through get_attribute_opt): before, any exception from the lookup was swallowed, so a __getattr__ raising ValueError gave a state of None where CPython raises. The size check runs after each item, as CPython does.
Compared with CPython 3.14.7: the non-str and ValueError cases now raise the same exception and message. The mutating case raises RuntimeError like CPython does, with our existing message (CPython spells it __slotsname__). A missing attribute is still skipped.
Written with Claude Code (claude-opus-5-5) as a tool. I reviewed the diff and reproduced the hang and the panic before and after the change myself.
Summary by CodeRabbit