blinker icon indicating copy to clipboard operation
blinker copied to clipboard

Slightly safer version-based checking for bound method

Open vlasy opened this issue 9 years ago • 4 comments

Utilities file was discriminating between different attributes for bound method with hasattrfunction but Saferef file was doing it with version-based discrimination.

It can cause problems if hasattrand getting the attribute returned not-Noneobject - e.g. when you are inheriting from Eventsclass (which python-eve does) but you are actually using Python 3+. In that case, utilitieswill find im_selfattribute (Events create all the attributes non-starting with __on-the-fly) but safereffile looks at the version number and tries to get __self__attribute. Which may not be (in python-eve case it is not) defined.

This PR unifies the approach to version-based

vlasy avatar Sep 14 '16 07:09 vlasy

:+1: I just ran into this issue with Eve as well. Tested the PR out and everything seems to be working just fine.

mmellison avatar Sep 30 '16 15:09 mmellison

I had this problem in Eve as well. I am glad that it helped you :-)

vlasy avatar Oct 07 '16 20:10 vlasy

+1

wangsha avatar Mar 07 '19 07:03 wangsha

How does it look like with this PR? We just ran into the same problem with Eve. 😢

sukovanej avatar Aug 22 '19 19:08 sukovanej

This is no longer required.

pgjones avatar Jan 22 '23 14:01 pgjones