Skip to content

Commit

Permalink
Explicitly add nonzero methods for base latebind classes
Browse files Browse the repository at this point in the history
  • Loading branch information
mcfletch committed Dec 28, 2019
1 parent 21fd0d2 commit bf3fe7c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
4 changes: 3 additions & 1 deletion OpenGL/latebind.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@ def finalise( self ):
return final callable
"""

def __nonzero__(self):
"""Resolve our final call and check for empty/nonzero on it"""
return bool(self.getFinalCall())
def __call__( self, *args, **named ):
"""Call self._finalCall, calling finalise() first if not already called
Expand Down
5 changes: 5 additions & 0 deletions accelerate/src/latebind.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ cdef class LateBind:
def finalise( self ):
"""Finalise our target to our final callable object"""

def __nonzero__(self):
"""Resolve our final call and check for empty/nonzero on it"""
return bool(self.getFinalCall())
__bool__ = __nonzero__

def getFinalCall( self ):
"""Retrieve and/or bind and retrieve final call"""
if not self._finalCall:
Expand Down

0 comments on commit bf3fe7c

Please sign in to comment.