You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fix dict.update/popitem/set.update, add more tests
- Fix dict.update() no-args crash: add nargs guard
- Fix dict.popitem() key tag: read from entry instead of hardcoding TAG_PTR
- Implement set.update() method and register in tp_dict
- Add test_popitem to test_dict.py (25 tests now)
- Restore dict.update() no-args test
- Update set.update test to use real method
- Update bugs.md with fixes #17-#19
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copy file name to clipboardExpand all lines: bugs.md
+17-3Lines changed: 17 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -81,14 +81,28 @@
81
81
**Root cause**: `dict_type.tp_call = 0`, so `type_call` used generic `instance_new` which allocated a PyDictObject-sized block but didn't initialize the hash table entries array.
82
82
**Fix**: Implement `dict_type_call` that calls `dict_new` for no-args case and copies entries for dict(other_dict) case.
83
83
84
+
### 17. dict.update() no-args crash (methods.asm)
85
+
**Symptom**: `d.update()` segfaults
86
+
**Root cause**: Always reads `args[1]` without checking nargs first
87
+
**Fix**: Add `cmp rsi, 1; jle .du_done` guard at start
88
+
89
+
### 18. dict.popitem() key tag hardcoded to TAG_PTR (methods.asm)
90
+
**Symptom**: `d.popitem()` segfaults on dicts with non-string keys
91
+
**Root cause**: Key tag hardcoded to TAG_PTR, `INCREF` used instead of `INCREF_VAL`, key tag not read from entry
92
+
**Fix**: Read key_tag from entry, use INCREF_VAL, pass correct tag to dict_del
0 commit comments