From 01277d700ca44e695d584838dc42c98e035ad514 Mon Sep 17 00:00:00 2001 From: Thomas Reitmayr Date: Tue, 9 Jun 2020 21:58:47 +0200 Subject: Unwrap director classes only when returning a pointer or reference to an object This involves properly counting the number of references and pointers in the return type of a function and only generate unwrapping code if this number is 1. For template instances some post-processing code is added to fix the 'decl' and 'type' attributes of functions if changed in an unfavorable way during template expansion. This commit fixes swig#1811. --- Source/Modules/python.cxx | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'Source/Modules/python.cxx') diff --git a/Source/Modules/python.cxx b/Source/Modules/python.cxx index c8c45df35..336f6c219 100644 --- a/Source/Modules/python.cxx +++ b/Source/Modules/python.cxx @@ -3118,9 +3118,7 @@ public: #if 1 int unwrap = 0; String *decl = Getattr(n, "decl"); - int is_pointer = SwigType_ispointer_return(decl); - int is_reference = SwigType_isreference_return(decl); - if (is_pointer || is_reference) { + if (SwigType_refptr_count_return(decl) == 1) { String *type = Getattr(n, "type"); //Node *classNode = Swig_methodclass(n); //Node *module = Getattr(classNode, "module"); -- cgit v1.2.1