Skip to content

Commit 87c68e3

Browse files
committed
Crash in dev mode only on accepted generation
1 parent 6ef8767 commit 87c68e3

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

syncode/grammar_mask/grammar_constrainer.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -205,13 +205,13 @@ def _parse_partial_code(self, idx: int, partial_code: str, remainder_bytes: byte
205205

206206
self._update_valid_state(partial_code, idx, res)
207207
except Exception as e:
208-
if self.dev_mode == True:
208+
if self.dev_mode == True and accepted_generation:
209209
raise e
210210
elif self.parse_failed == False and accepted_generation:
211211
self.parse_failed = True
212-
print("-"*50)
213-
print(f"Parsing failed! Falling back to unconstrained decoding.\nException: {e}\nPartial code: {partial_code}\nParsed lexical tokens: {self.inc_parser.parsed_lexer_tokens}")
214-
print("-"*50)
212+
logger.info("-"*50)
213+
logger.info(f"Parsing failed! Falling back to unconstrained decoding.\nException: {e}\nPartial code: {partial_code}\nParsed lexical tokens: {self.inc_parser.parsed_lexer_tokens}")
214+
logger.info("-"*50)
215215
skip = True
216216
return res, skip
217217

0 commit comments

Comments
 (0)