From f132a1da5ddd201a9eb32feb8c694da12b6286b8 Mon Sep 17 00:00:00 2001 From: Ryan Pessa Date: Fri, 18 Jul 2014 10:17:17 -0500 Subject: [PATCH] remove try/except from grab/ungrab --- kivy/input/motionevent.py | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/kivy/input/motionevent.py b/kivy/input/motionevent.py index 1630cad1d..ff8d6f61e 100644 --- a/kivy/input/motionevent.py +++ b/kivy/input/motionevent.py @@ -322,11 +322,7 @@ class MotionEvent(MotionEventBase): raise Exception('Grab works only for Touch MotionEvents.') if self.grab_exclusive_class is not None: raise Exception('Cannot grab the touch, touch is exclusive') - try: - class_instance = weakref.ref(class_instance) - except TypeError: - # handle weakproxy objects which cannot be weakref'd - class_instance = weakref.ref(class_instance.__self__) + class_instance = weakref.ref(class_instance.__self__) if exclusive: self.grab_exclusive_class = class_instance self.grab_list.append(class_instance) @@ -334,11 +330,7 @@ class MotionEvent(MotionEventBase): def ungrab(self, class_instance): '''Ungrab a previously grabbed touch ''' - try: - class_instance = weakref.ref(class_instance) - except TypeError: - # handle weakproxy objects which cannot be weakref'd - class_instance = weakref.ref(class_instance.__self__) + class_instance = weakref.ref(class_instance.__self__) if self.grab_exclusive_class == class_instance: self.grab_exclusive_class = None if class_instance in self.grab_list: