diff --git a/CHANGELOG.md b/CHANGELOG.md index e812aa3d0..37e01cb7b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ ## Unreleased ### Added ### Fixed +- revert change from #543 to fix #570 (closing file descriptors) - use correct offset value when updating the objective function ### Changed ### Removed diff --git a/src/pyscipopt/scip.pyx b/src/pyscipopt/scip.pyx index d60d0ce3b..7729bf320 100644 --- a/src/pyscipopt/scip.pyx +++ b/src/pyscipopt/scip.pyx @@ -10,7 +10,7 @@ cimport cython from cpython cimport Py_INCREF, Py_DECREF from cpython.pycapsule cimport PyCapsule_New, PyCapsule_IsValid, PyCapsule_GetPointer from libc.stdlib cimport malloc, free -from libc.stdio cimport fdopen, fclose +from libc.stdio cimport fdopen from collections.abc import Iterable from itertools import repeat @@ -4240,7 +4240,6 @@ cdef class Model: with open(filename, "w") as f: cfile = fdopen(f.fileno(), "w") PY_SCIP_CALL(SCIPprintBestSol(self._scip, cfile, write_zeros)) - fclose(cfile) def writeBestTransSol(self, filename="transprob.sol", write_zeros=False): """Write the best feasible primal solution for the transformed problem to a file. @@ -4268,7 +4267,6 @@ cdef class Model: with open(filename, "w") as f: cfile = fdopen(f.fileno(), "w") PY_SCIP_CALL(SCIPprintSol(self._scip, solution.sol, cfile, write_zeros)) - fclose(cfile) def writeTransSol(self, Solution solution, filename="transprob.sol", write_zeros=False): """Write the given transformed primal solution to a file. @@ -4628,7 +4626,6 @@ cdef class Model: with open(filename, "w") as f: cfile = fdopen(f.fileno(), "w") PY_SCIP_CALL(SCIPprintStatistics(self._scip, cfile)) - fclose(cfile) def getNLPs(self): """gets total number of LPs solved so far"""