%callback and Python class access for C++ static member functions fixes

Fix access to C++ static member functions using Python class
staticmethod syntax, such as Klass.memberfunction instead of
Klass_memberfunction, when using -fastproxy and -builtin in
combination with %callback.

The docstring containing the callback pointers were not being patched
during module initialisation.
This commit is contained in:
William S Fulton 2022-01-14 20:23:43 +00:00
commit 3aa302c08f
4 changed files with 38 additions and 15 deletions

View file

@ -1,10 +1,14 @@
import _callback
from callback import *
# callbacks are implemented by modifying docstrings, useful for debugging:
# print("A_bar doc: {}".format(A_bar.__doc__))
# print("A.bar doc: {}".format(A.bar.__doc__))
if foo(2) != 2:
raise RuntimeError
if A_bar(2) != 4:
if A.bar(2) != 4:
raise RuntimeError
if foobar(3, _callback.foo) != foo(3):
@ -13,13 +17,12 @@ if foobar(3, _callback.foo) != foo(3):
if foobar(3, foo) != foo(3):
raise RuntimeError
# Needs some more work for -builtin
# if foobar(3, A.bar) != A.bar(3):
# raise RuntimeError
if foobar(3, A_bar) != A_bar(3):
raise RuntimeError
if foobar(3, A.bar) != A.bar(3):
raise RuntimeError
if foobar(3, foof) != foof(3):
raise RuntimeError