Support python(pre|ap)pend on static methods in classic mode
Adding a test that covers this case to the python_append test-suite Note: staticmethod function has been available since Python 2.2
This commit is contained in:
parent
d91064aa6a
commit
b45164e098
3 changed files with 11 additions and 3 deletions
|
|
@ -20,3 +20,10 @@ if grabpath() != os.path.dirname(mypath):
|
|||
|
||||
if grabstaticpath() != os.path.basename(mypath):
|
||||
raise RuntimeError("grabstaticpath failed")
|
||||
|
||||
clearstaticpath()
|
||||
if grabstaticpath() != None:
|
||||
raise RuntimeError("Resetting staticfuncpath failed")
|
||||
Test.static_func()
|
||||
if grabstaticpath() != os.path.basename(mypath):
|
||||
raise RuntimeError("grabstaticpath failed")
|
||||
|
|
|
|||
|
|
@ -12,6 +12,9 @@ def grabpath():
|
|||
return funcpath
|
||||
def grabstaticpath():
|
||||
return staticfuncpath
|
||||
def clearstaticpath():
|
||||
global staticfuncpath
|
||||
staticfuncpath = None
|
||||
%}
|
||||
|
||||
%pythonappend Test::func %{
|
||||
|
|
|
|||
|
|
@ -4710,7 +4710,7 @@ public:
|
|||
}
|
||||
|
||||
if (shadow) {
|
||||
if (!classic && !Getattr(n, "feature:python:callback") && have_addtofunc(n)) {
|
||||
if (!Getattr(n, "feature:python:callback") && have_addtofunc(n)) {
|
||||
int kw = (check_kwargs(n) && !Getattr(n, "sym:overloaded")) ? 1 : 0;
|
||||
String *parms = make_pyParmList(n, false, false, kw);
|
||||
String *callParms = make_pyParmList(n, false, true, kw);
|
||||
|
|
@ -4726,8 +4726,6 @@ public:
|
|||
} else {
|
||||
Printv(f_shadow, tab8, "return ", funcCall(Swig_name_member(NSPACE_TODO, class_name, symname), callParms), "\n\n", NIL);
|
||||
}
|
||||
if (!modern)
|
||||
Printv(f_shadow, tab4, "if _newclass:\n", tab4, NIL);
|
||||
Printv(f_shadow, tab4, symname, " = staticmethod(", symname, ")\n", NIL);
|
||||
|
||||
if (!modern) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue