diff --git a/Examples/test-suite/python/python_append_runme.py b/Examples/test-suite/python/python_append_runme.py index 2f6d94d9c..6675f3509 100644 --- a/Examples/test-suite/python/python_append_runme.py +++ b/Examples/test-suite/python/python_append_runme.py @@ -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") diff --git a/Examples/test-suite/python_append.i b/Examples/test-suite/python_append.i index f37a6c199..2a71b5784 100644 --- a/Examples/test-suite/python_append.i +++ b/Examples/test-suite/python_append.i @@ -12,6 +12,9 @@ def grabpath(): return funcpath def grabstaticpath(): return staticfuncpath +def clearstaticpath(): + global staticfuncpath + staticfuncpath = None %} %pythonappend Test::func %{ diff --git a/Source/Modules/python.cxx b/Source/Modules/python.cxx index 7526a80fa..1c8169a36 100644 --- a/Source/Modules/python.cxx +++ b/Source/Modules/python.cxx @@ -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) {