Repository navigation
Commit ec88f67
committed
gh-159285: Fix crash when copying an empty dict fails with MemoryError
copy_lock_held_untracked() asserted that the new empty dict was not
tracked by the GC without checking whether its allocation had failed,
so a debug build dereferenced NULL instead of raising MemoryError. This
affected dict.copy(), PyDict_Copy() and _PyDict_CopyAsDict(), which
type() uses for the class namespace.1 parent 64018ac commit ec88f67
3 files changed
Lines changed: 10 additions & 1 deletion
File tree
- Lib/test
- Misc/NEWS.d/next/Core_and_Builtins
- Objects
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
479 | 479 | | |
480 | 480 | | |
481 | 481 | | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
| 486 | + | |
| 487 | + | |
| 488 | + | |
482 | 489 | | |
483 | 490 | | |
484 | 491 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4497 | 4497 | | |
4498 | 4498 | | |
4499 | 4499 | | |
4500 | | - | |
| 4500 | + | |
4501 | 4501 | | |
4502 | 4502 | | |
4503 | 4503 | | |
| |||
0 commit comments