Skip to content

Commit

Permalink
close duplicated file discriptor in pygraphillion
Browse files Browse the repository at this point in the history
  • Loading branch information
takemaru committed Feb 22, 2017
1 parent b26929a commit 91acc36
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/pygraphillion.cc
Expand Up @@ -817,7 +817,7 @@ static PyObject* setset_dump(PySetsetObject* self, PyObject* obj) {
self->ss->dump(fp);
Py_END_ALLOW_THREADS;
#if IS_PY3 == 1
fflush(fp);
fclose(fp);
#else
PyFile_DecUseCount(file);
#endif
Expand Down Expand Up @@ -846,7 +846,9 @@ static PyObject* setset_load(PySetsetObject* self, PyObject* obj) {
PySetset_Type.tp_alloc(&PySetset_Type, 0));
ret->ss = new setset(setset::load(fp));
Py_END_ALLOW_THREADS;
#if IS_PY3 == 0
#if IS_PY3 == 1
fclose(fp);
#else
PyFile_DecUseCount(file);
#endif
return reinterpret_cast<PyObject*>(ret);
Expand Down

0 comments on commit 91acc36

Please sign in to comment.