-
Notifications
You must be signed in to change notification settings - Fork 701
Allow observing of monkey patched methods #2022
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
Merged
papr
merged 6 commits into
pupil-labs:develop
from
ckbaumann:observe_monkey_patched_methods
Oct 13, 2020
Merged
Allow observing of monkey patched methods #2022
papr
merged 6 commits into
pupil-labs:develop
from
ckbaumann:observe_monkey_patched_methods
Oct 13, 2020
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Contributor
|
@ckbaumann Starting the Head Pose Tracker in Capture using the Traceback (most recent call last):
File "/Users/papr/work/pupil/pupil_src/launchables/world.py", line 648, in world
g_pool.plugins = Plugin_List(g_pool, loaded_plugins)
File "/Users/papr/work/pupil/pupil_src/shared_modules/plugin.py", line 383, in __init__
self.add(plugin, args)
File "/Users/papr/work/pupil/pupil_src/shared_modules/plugin.py", line 398, in add
plugin_instance = new_plugin_cls(self.g_pool, **args)
File "/Users/papr/work/pupil/pupil_src/shared_modules/head_pose_tracker/online_head_pose_tracker.py", line 53, in __init__
self._setup_renderers()
File "/Users/papr/work/pupil/pupil_src/shared_modules/head_pose_tracker/online_head_pose_tracker.py", line 76, in _setup_renderers
self._detection_renderer = plugin_ui.DetectionRenderer(
File "/Users/papr/work/pupil/pupil_src/shared_modules/head_pose_tracker/ui/detection_renderer.py", line 41, in __init__
plugin.add_observer("gl_display", self._on_gl_display)
File "/Users/papr/work/pupil/pupil_src/shared_modules/observable.py", line 75, in add_observer
add_observer(self, method_name, observer)
File "/Users/papr/work/pupil/pupil_src/shared_modules/observable.py", line 135, in add_observer
_install_protection_descriptor_if_not_exists(wrapper)
File "/Users/papr/work/pupil/pupil_src/shared_modules/observable.py", line 172, in _install_protection_descriptor_if_not_exists
wrapped_method = wrapper.get_wrapped_bound_method()
File "/Users/papr/work/pupil/pupil_src/shared_modules/observable.py", line 297, in get_wrapped_bound_method
return self._wrapped_method_ref.deref_method()
File "/Users/papr/work/pupil/pupil_src/shared_modules/observable.py", line 421, in deref_method
raise _ReferenceNoLongerValidError
observable._ReferenceNoLongerValidError |
Contributor
|
@ckbaumann For reference, this is how we patch the |
papr
approved these changes
Oct 9, 2020
Contributor
papr
left a comment
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.
@ckbaumann Works as expected now! Thanks for working on the fix!
bbc4c8b to
7c8b8fe
Compare
Contributor
Author
7c8b8fe to
7e74cf3
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR allows to observe monkey patched methods (you replace or modify method attributes of a class instance s.t. methods are called that were not in the original class definition).
Additionally, the error when trying to add private methods as observers was made a little more explicit.