Commit e1f9db5b authored by Boxiang Sun's avatar Boxiang Sun

decref file object when throw exception

parent 0aaf8b93
# expected: reffail
# - leaked refs
"Test posix functions"
from test import test_support
......
......@@ -6911,8 +6911,11 @@ posix_fdopen(PyObject *self, PyObject *args)
#endif
Py_END_ALLOW_THREADS
PyMem_FREE(mode);
if (fp == NULL)
// Pyston change: decref the file object when throw exception
if (fp == NULL) {
Py_DECREF(f);
return posix_error();
}
/* We now know we will succeed, so initialize the file object. */
((PyFileObject *)f)->f_fp = fp;
PyFile_SetBufSize(f, bufsize);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment