-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PR: Add validation to not publish pdb_state after getting values of variables #5528
Conversation
@@ -65,6 +65,7 @@ def __init__(self, *args, **kwargs): | |||
self.namespace_view_settings = {} | |||
self._pdb_obj = None | |||
self._pdb_step = None | |||
self._publish_data = False |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's change this variable name to _do_publish_data
state = dict(namespace_view = self.get_namespace_view(), | ||
var_properties = self.get_var_properties(), | ||
step = self._pdb_step) | ||
publish_data({'__spy_pdb_state__': state}) | ||
self._publish_data = False |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What happens if you open several variables while debugging? I think then this approach wouldn't work all the time.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice, it's working as expected!
bb3eabd
to
4237853
Compare
@@ -212,11 +214,12 @@ def publish_pdb_state(self): | |||
Publish Variable Explorer state and Pdb step through | |||
publish_data. | |||
""" | |||
if self._pdb_obj: | |||
if self._pdb_obj and not self._do_publish_data: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's change the logic here because it's a bit confuse. This should be
if self._pdb_obj and self._do_publish_data:
to be clearer.
@@ -157,6 +158,7 @@ def get_value(self, name): | |||
# petitions to display a value | |||
value = None | |||
publish_data({'__spy_data__': value}) | |||
self._do_publish_data = True |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This needs to be False
, meaning we don't publish data when we're getting values.
state = dict(namespace_view = self.get_namespace_view(), | ||
var_properties = self.get_var_properties(), | ||
step = self._pdb_step) | ||
publish_data({'__spy_pdb_state__': state}) | ||
self._do_publish_data = False |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This needs to be True
now.
@@ -65,6 +65,7 @@ def __init__(self, *args, **kwargs): | |||
self.namespace_view_settings = {} | |||
self._pdb_obj = None | |||
self._pdb_step = None | |||
self._do_publish_data = False |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, but let's change this again to _do_publish_pdb_state
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me now, thanks @dalthviz!
Fixes #5036