Fix #1296 SyntaxError for breakpoints with empty condition

Treat breakpoints with `condition: ""` as non-conditional.
This commit is contained in:
Pavel Minaev 2019-04-04 15:42:35 -07:00 committed by Pavel Minaev
parent c9e5ab5b3f
commit 07fda2b10a
2 changed files with 3 additions and 3 deletions

View file

@ -59,10 +59,10 @@ class LineBreakpoint(object):
@property
def has_condition(self):
return self.condition is not None or self.hit_condition is not None
return bool(self.condition) or bool(self.hit_condition)
def handle_hit_condition(self, frame):
if self.hit_condition is None:
if not self.hit_condition:
return False
ret = False
with self._hit_condition_lock:

View file

@ -500,7 +500,7 @@ class PyDB(object):
if pybreakpoint.handle_hit_condition(new_frame):
return True
if condition is None:
if not condition:
return False
return eval(condition, new_frame.f_globals, new_frame.f_locals)