Skip to content
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

Merged
merged 3 commits into from
Oct 26, 2017

Conversation

dalthviz
Copy link
Member

Fixes #5036

@@ -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
Copy link
Member

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
Copy link
Member

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.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you mean like a synchronization issue?. A preview:

debug

Copy link
Member

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!

@@ -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:
Copy link
Member

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
Copy link
Member

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
Copy link
Member

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
Copy link
Member

@ccordoba12 ccordoba12 Oct 26, 2017

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

Copy link
Member

@ccordoba12 ccordoba12 left a 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!

@ccordoba12 ccordoba12 changed the title PR: Add validation to not publish pdb_state after publishing values of variables PR: Add validation to not publish pdb_state after gettings values of variables Oct 26, 2017
@ccordoba12 ccordoba12 merged commit 4d28de6 into spyder-ide:3.x Oct 26, 2017
ccordoba12 added a commit that referenced this pull request Oct 26, 2017
@ccordoba12 ccordoba12 changed the title PR: Add validation to not publish pdb_state after gettings values of variables PR: Add validation to not publish pdb_state after getting values of variables Oct 26, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants