Skip to content

Commit e9fa6e5

Browse files
committed
Fix the double inclusion of parsed DZN files
1 parent 2c98392 commit e9fa6e5

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

CHANGELOG.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ Fixed
2121
^^^^^
2222
- Catch lark ``ImportError`` before ``LarkError`` during ``Model.add_file()`` since
2323
``LarkError`` will not exist if the import failed.
24+
- Ensure a DZN file does not get included if its data is parsed.
2425

2526
0.3.3_ - 2020-08-17
2627
-------------------

src/minizinc/model.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -182,9 +182,9 @@ def add_file(self, file: ParPath, parse_data: bool = True) -> None:
182182
f"Could not parse {file}. Parameters included within this file "
183183
f"are not available in Python"
184184
)
185+
with self._lock:
186+
self._includes.append(file)
185187
except ImportError:
186-
pass
187-
finally:
188188
with self._lock:
189189
self._includes.append(file)
190190
elif file.suffix not in [".dzn", ".mzn", ".mzc"]:

0 commit comments

Comments
 (0)