Skip to content

Commit cc3289e

Browse files
authored
do not close file descriptors to fix #570 (#579)
1 parent c846fa1 commit cc3289e

File tree

2 files changed

+2
-4
lines changed

2 files changed

+2
-4
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
## Unreleased
44
### Added
55
### Fixed
6+
- revert change from #543 to fix #570 (closing file descriptors)
67
- use correct offset value when updating the objective function
78
### Changed
89
### Removed

src/pyscipopt/scip.pyx

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ cimport cython
1010
from cpython cimport Py_INCREF, Py_DECREF
1111
from cpython.pycapsule cimport PyCapsule_New, PyCapsule_IsValid, PyCapsule_GetPointer
1212
from libc.stdlib cimport malloc, free
13-
from libc.stdio cimport fdopen, fclose
13+
from libc.stdio cimport fdopen
1414

1515
from collections.abc import Iterable
1616
from itertools import repeat
@@ -4240,7 +4240,6 @@ cdef class Model:
42404240
with open(filename, "w") as f:
42414241
cfile = fdopen(f.fileno(), "w")
42424242
PY_SCIP_CALL(SCIPprintBestSol(self._scip, cfile, write_zeros))
4243-
fclose(cfile)
42444243

42454244
def writeBestTransSol(self, filename="transprob.sol", write_zeros=False):
42464245
"""Write the best feasible primal solution for the transformed problem to a file.
@@ -4268,7 +4267,6 @@ cdef class Model:
42684267
with open(filename, "w") as f:
42694268
cfile = fdopen(f.fileno(), "w")
42704269
PY_SCIP_CALL(SCIPprintSol(self._scip, solution.sol, cfile, write_zeros))
4271-
fclose(cfile)
42724270

42734271
def writeTransSol(self, Solution solution, filename="transprob.sol", write_zeros=False):
42744272
"""Write the given transformed primal solution to a file.
@@ -4628,7 +4626,6 @@ cdef class Model:
46284626
with open(filename, "w") as f:
46294627
cfile = fdopen(f.fileno(), "w")
46304628
PY_SCIP_CALL(SCIPprintStatistics(self._scip, cfile))
4631-
fclose(cfile)
46324629

46334630
def getNLPs(self):
46344631
"""gets total number of LPs solved so far"""

0 commit comments

Comments
 (0)