From 4b7e5fdffe1d90decd7f867d2f26d3097fc48643 Mon Sep 17 00:00:00 2001 From: Mark Rose Date: Wed, 23 Apr 2003 23:11:53 +0000 Subject: [PATCH] Director fixes for operator method names and destructors. git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@4702 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- CHANGES.current | 7 +++++++ Source/Modules/python.cxx | 9 ++++++--- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/CHANGES.current b/CHANGES.current index 543e2c357..0e8d64f85 100644 --- a/CHANGES.current +++ b/CHANGES.current @@ -1,5 +1,12 @@ Version 1.3.20 (In progress) ============================ +04/23/2003: mrose (Mark Rose) + Fixed symname error in director calls to Python methods + that extend C++ operators. + + Stopped director destructor wrappers from calling __set_up, + which was leaving the director flag in an inconsistent state. + 04/23/2003: beazley Fixed problem with namespace resolution and nested namespaces. Reported by Alfred Lorber (and Marcelo Matus). diff --git a/Source/Modules/python.cxx b/Source/Modules/python.cxx index c3d322ded..f6e51fa5b 100644 --- a/Source/Modules/python.cxx +++ b/Source/Modules/python.cxx @@ -656,6 +656,7 @@ public: /* member of a director class? */ String *nodeType = Getattr(n, "nodeType"); int constructor = (!Cmp(nodeType, "constructor")); + int destructor = (!Cmp(nodeType, "destructor")); String *storage = Getattr(n,"storage"); int isVirtual = (Cmp(storage,"virtual") == 0); @@ -869,7 +870,7 @@ public: if (directorsEnabled()) { if (!is_smart_pointer()) { - if (/*directorbase &&*/ !constructor && isVirtual) { + if (/*directorbase &&*/ !constructor && !destructor && isVirtual) { Wrapper_add_local(f, "director", "__DIRECTOR__ *director = 0"); Printf(f->code, "director = dynamic_cast<__DIRECTOR__*>(arg1);\n"); Printf(f->code, "if (director && (director->__get_self()==obj0)) director->__set_up();\n"); @@ -1467,11 +1468,13 @@ public: /* wrap complex arguments to PyObjects */ Printv(w->code, wrap_args, NIL); + String *pyname = Getattr(n,"sym:name"); + /* pass the method call on to the Python object */ if (Len(parse_args) > 0) { - Printf(w->code, "result = PyObject_CallMethod(__get_self(), \"%s\", \"%s\" %s);\n", name, parse_args, arglist); + Printf(w->code, "result = PyObject_CallMethod(__get_self(), \"%s\", \"%s\" %s);\n", pyname, parse_args, arglist); } else { - Printf(w->code, "result = PyObject_CallMethod(__get_self(), \"%s\", NULL);\n", name); + Printf(w->code, "result = PyObject_CallMethod(__get_self(), \"%s\", NULL);\n", pyname); } /* exception handling */