Skip to content

Commit

Permalink
for p2.7 only: fool inspect to think method/function proxies are pure…
Browse files Browse the repository at this point in the history
… python
  • Loading branch information
wlav committed Oct 26, 2017
1 parent 5ad8def commit e500ec0
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 1 deletion.
25 changes: 25 additions & 0 deletions python/cppyy/_cpython_cppyy.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,31 @@
_backend._cpp_backend = c


import sys
if sys.hexversion < 0x3000000:
# TODO: this reliese on MethodProxy cooking up a func_code object, which atm
# is simply not implemented for p3 :/

# convince inspect that PyROOT method proxies are possible drop-ins for python
# methods and classes for pydoc
import inspect

inspect._old_isfunction = inspect.isfunction
def isfunction(object):
if type(object) == _backend.MethodProxy and not object.im_class:
return True
return inspect._old_isfunction( object )
inspect.isfunction = isfunction

inspect._old_ismethod = inspect.ismethod
def ismethod(object):
if type(object) == _backend.MethodProxy:
return True
return inspect._old_ismethod(object)
inspect.ismethod = ismethod
del isfunction, ismethod


### template support ---------------------------------------------------------
class Template(object): # expected/used by CPyCppyyHelpers.cxx in CPyCppyy
def __init__(self, name):
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

setup(
name='cppyy',
version='0.8.1',
version='0.8.2',
description='Cling-based Python-C++ bindings',
long_description=long_description,

Expand Down

0 comments on commit e500ec0

Please sign in to comment.