-
Notifications
You must be signed in to change notification settings - Fork 274
Open
Description
Describe the bug
I have a test that started segfaulting with v6 (SCIP 10), but the issue only occurs when running with pytest. The test writes the problem in LP format.
To Reproduce
I had to spend a bit of time to come up with the smallest example, so here we go.
Create a file repro_test.py with these contents:
from pyscipopt import Model
def test_abs():
model = Model()
x = model.addVar()
model.addCons(abs(x) >= 1)
model.setObjective(x, "minimize")
model.writeProblem("abs_example.lp") # segfaults
if __name__ == "__main__":
test_abs()Then run pytest on it (here using uvx to have a fresh environment):
uvx --with pyscipopt==6.0.0 --with pytest pytest repro_test.pyThis causes a segmentation fault:
repro_test.py Fatal Python error: Segmentation fault
Current thread 0x000079f2a721f740 [python] (most recent call first):
File "~/dev/cvxpy-translation/repro_test.py", line 10 in test_abs
With a debug build of SCIP (scipopt/scip@9e13056), I see:
python: ~/dev/scip/src/scip/expr.c:4267: SCIPexprAreQuadraticExprsVariables: Assertion `expr->quaddata != NULL' failed.
Fatal Python error: Aborted
Expected behavior
The code should work without segfaulting. It does work when any of these change:
- Without calling
writeProblem - Without
abs - Running
pythoninstead ofpyteston the file - Using PySCIPOpt 5.7.1
This is probably caused by pytest modifying the environment in some way. The version of pytest I use does not change the outcome though, only the version of SCIP seems to matter.
System
- OS: Ubuntu
- Version: 6.0.0
- SCIP version: 10.0.0
- How did you install
pyscipopt?PyPIand from source
Metadata
Metadata
Assignees
Labels
No labels