Commit 28288beb authored by Stéphane Wirtel's avatar Stéphane Wirtel Committed by Victor Stinner
Browse files

bpo-30614: testInitNonExistentFile() of test_bz2 leaks references (#2033)



* bpo-30614: testInitNonExistentFile() of test_bz2 leaks references

Extract the code of BZ2File_dealloc and create a new BZ2File_clear()
function. Call BZ2File_clear() in BZ2File_dealloc().

Define BZ2File_clear() as tp_clear.

Move the lock initialization before the "self->file =
PyObject_CallFunction" in BZ2File_init() and check the lock is not
created twice.

Call BZ2File_clear() in BZ2File_init() after the init of the lock

Co-Authored-By: default avatarVictor Stinner <victor.stinner@gmail.com>

* Create bz2module.c

Fix after the review of Victor Stinner
parent 3c7b67bb
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment