diff --git a/SWIG/Source/Modules/emit.cxx b/SWIG/Source/Modules/emit.cxx index 01930c58d..1fc968512 100644 --- a/SWIG/Source/Modules/emit.cxx +++ b/SWIG/Source/Modules/emit.cxx @@ -376,9 +376,6 @@ void emit_action(Node *n, Wrapper *f) { String* dirdecl = NewStringf("%s *darg = 0", dirname); Wrapper_add_local(f, "darg", dirdecl); Printf(f->code, "darg = dynamic_cast<%s *>(arg1);\n",dirname); - Printf(f->code, "if (!darg) SWIG_exception(SWIG_RuntimeError," - "\"accessing protected member %s in %s\");\n", - Getattr(n,"name"), symname); Replace(action, "arg1", "darg", DOH_REPLACE_FIRST); Delete(dirname); Delete(dirdecl); diff --git a/SWIG/Source/Modules/python.cxx b/SWIG/Source/Modules/python.cxx index 35fc89275..5c012b850 100644 --- a/SWIG/Source/Modules/python.cxx +++ b/SWIG/Source/Modules/python.cxx @@ -729,12 +729,9 @@ public: Wrapper_add_local(f, "director", "Swig::Director *director = 0"); Printf(f->code, "director = dynamic_cast(arg1);\n"); if (dirprot_mode() && is_protected(n)) { - Printf(f->code, "if (director && !(director->swig_get_inner(\"%s\"))) ", name); - Printf(f->code, - "SWIG_exception(SWIG_RuntimeError,\"accessing protected member %s\");\n", - name); + Printf(f->code, "if (!director || !(director->swig_get_inner(\"%s\"))) ", name); + Printf(f->code, "SWIG_exception(SWIG_RuntimeError,\"accessing protected member %s\");\n", name); } - Printf(f->code, "if (director && (director->swig_get_self()==obj0)) director->swig_set_up();\n"); } }