[Python-checkins] [python/cpython] 28288b: bpo-30614: testInitNonExistentFile() of test_bz2 l...

GitHub noreply at github.com
Sat Jun 10 08:36:59 EDT 2017


  Branch: refs/heads/2.7
  Home:   https://github.com/python/cpython
  Commit: 28288bebaf61269d1e26bb0795c2de6b481e1cf0
      https://github.com/python/cpython/commit/28288bebaf61269d1e26bb0795c2de6b481e1cf0
  Author: Stéphane Wirtel <stephane at wirtel.be>
  Date:   2017-06-10 (Sat, 10 Jun 2017)

  Changed paths:
    M Modules/bz2module.c

  Log Message:
  -----------
  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: Victor Stinner <victor.stinner at gmail.com>

* Create bz2module.c

Fix after the review of Victor Stinner




More information about the Python-checkins mailing list