[3.8] [3.9] bpo-41654: Fix deallocator of MemoryError to account for … · python/cpython@77f4000 · GitHub
Skip to content

Commit 77f4000

Browse files
authored
[3.8] [3.9] bpo-41654: Fix deallocator of MemoryError to account for subclasses (GH-22020) (GH-22046)
When allocating MemoryError classes, there is some logic to use pre-allocated instances in a freelist only if the type that is being allocated is not a subclass of MemoryError. Unfortunately in the destructor this logic is not present so the freelist is altered even with subclasses of MemoryError.. (cherry picked from commit 9b648a9) Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>. (cherry picked from commit 87e91ae) Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
1 parent 38e3287 commit 77f4000

3 files changed

Lines changed: 44 additions & 2 deletions

File tree

Lib/test/test_exceptions.py

Lines changed: 30 additions & 0 deletions
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Fix a crash that occurred when destroying subclasses of
2+
:class:`MemoryError`. Patch by Pablo Galindo.

Objects/exceptions.c

Lines changed: 12 additions & 2 deletions

0 commit comments

Comments
 (0)