Hello community, here is the log from the commit of package python-PyBindGen for openSUSE:Leap:15.2 checked in at 2020-02-19 18:48:56 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Leap:15.2/python-PyBindGen (Old) and /work/SRC/openSUSE:Leap:15.2/.python-PyBindGen.new.26092 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-PyBindGen" Wed Feb 19 18:48:56 2020 rev:3 rq:776329 version:0.20.1 Changes: -------- --- /work/SRC/openSUSE:Leap:15.2/python-PyBindGen/python-PyBindGen.changes 2020-01-15 15:46:10.695348562 +0100 +++ /work/SRC/openSUSE:Leap:15.2/.python-PyBindGen.new.26092/python-PyBindGen.changes 2020-02-19 18:48:57.195046659 +0100 @@ -1,0 +2,9 @@ +Wed Nov 27 15:14:50 UTC 2019 - Stefan BrĂ¼ns <stefan.bru...@rwth-aachen.de> + +- Update to 0.20.1 + * fix for method returning const reference to a class, closes #21 +- Update to 0.20.0 + * Merge pull request #18 from dan-eicher/master + Ordered dicts and custom_names + +------------------------------------------------------------------- Old: ---- PyBindGen-0.19.0.tar.gz New: ---- PyBindGen-0.20.1.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-PyBindGen.spec ++++++ --- /var/tmp/diff_new_pack.ESg42g/_old 2020-02-19 18:48:57.531047016 +0100 +++ /var/tmp/diff_new_pack.ESg42g/_new 2020-02-19 18:48:57.535047021 +0100 @@ -1,7 +1,7 @@ # # spec file for package python-PyBindGen # -# Copyright (c) 2018 SUSE LINUX Products GmbH, Nuernberg, Germany. +# Copyright (c) 2019 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -12,23 +12,24 @@ # license that conforms to the Open Source Definition (Version 1.9) # published by the Open Source Initiative. -# Please submit bugfixes or comments via http://bugs.opensuse.org/ +# Please submit bugfixes or comments via https://bugs.opensuse.org/ # + %{?!python_module:%define python_module() python-%{**} python3-%{**}} Name: python-PyBindGen -Version: 0.19.0 +Version: 0.20.1 Release: 0 Summary: Python Bindings Generator -License: LGPL-2.1 +License: LGPL-2.1-only Group: Development/Libraries/Python -Url: https://github.com/gjcarneiro/pybindgen +URL: https://github.com/gjcarneiro/pybindgen Source0: https://pypi.io/packages/source/P/PyBindGen/PyBindGen-%{version}.tar.gz +BuildRequires: %{python_module setuptools_scm} +BuildRequires: %{python_module setuptools} BuildRequires: fdupes BuildRequires: python-rpm-macros -BuildRequires: %{python_module setuptools} -BuildRequires: %{python_module setuptools_scm} BuildArch: noarch %python_subpackages ++++++ PyBindGen-0.19.0.tar.gz -> PyBindGen-0.20.1.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/PyBindGen-0.19.0/.travis.yml new/PyBindGen-0.20.1/.travis.yml --- old/PyBindGen-0.19.0/.travis.yml 2016-05-04 01:22:52.000000000 +0200 +++ new/PyBindGen-0.20.1/.travis.yml 2019-10-10 17:24:15.000000000 +0200 @@ -2,9 +2,9 @@ python: - 2.7 - - 3.3 - 3.4 - 3.5 + - 3.6 sudo: false diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/PyBindGen-0.19.0/PKG-INFO new/PyBindGen-0.20.1/PKG-INFO --- old/PyBindGen-0.19.0/PKG-INFO 2018-05-27 16:42:28.000000000 +0200 +++ new/PyBindGen-0.20.1/PKG-INFO 2019-10-10 17:25:00.000000000 +0200 @@ -1,12 +1,11 @@ Metadata-Version: 1.1 Name: PyBindGen -Version: 0.19.0 +Version: 0.20.1 Summary: Python Bindings Generator Home-page: https://launchpad.net/pybindgen Author: Gustavo Carneiro Author-email: gjcarne...@gmail.com License: UNKNOWN -Description-Content-Type: UNKNOWN Description: About ===== PyBindGen is (surprise!) a python bindings generator. The main features are: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/PyBindGen-0.19.0/PyBindGen.egg-info/PKG-INFO new/PyBindGen-0.20.1/PyBindGen.egg-info/PKG-INFO --- old/PyBindGen-0.19.0/PyBindGen.egg-info/PKG-INFO 2018-05-27 16:42:28.000000000 +0200 +++ new/PyBindGen-0.20.1/PyBindGen.egg-info/PKG-INFO 2019-10-10 17:25:00.000000000 +0200 @@ -1,12 +1,11 @@ Metadata-Version: 1.1 Name: PyBindGen -Version: 0.19.0 +Version: 0.20.1 Summary: Python Bindings Generator Home-page: https://launchpad.net/pybindgen Author: Gustavo Carneiro Author-email: gjcarne...@gmail.com License: UNKNOWN -Description-Content-Type: UNKNOWN Description: About ===== PyBindGen is (surprise!) a python bindings generator. The main features are: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/PyBindGen-0.19.0/pybindgen/cppattribute.py new/PyBindGen-0.20.1/pybindgen/cppattribute.py --- old/PyBindGen-0.19.0/pybindgen/cppattribute.py 2015-10-11 15:57:30.000000000 +0200 +++ new/PyBindGen-0.20.1/pybindgen/cppattribute.py 2019-10-10 17:24:15.000000000 +0200 @@ -3,6 +3,7 @@ """ import sys +import collections PY3 = (sys.version_info[0] >= 3) if PY3: @@ -354,7 +355,7 @@ def empty(self): return len(self.attributes) == 0 - def add_attribute(self, name, getter, setter): + def add_attribute(self, name, getter, setter, custom_name=None): """ Add a new attribute :param name: attribute name @@ -363,7 +364,7 @@ """ assert getter is None or isinstance(getter, PyGetter) assert setter is None or isinstance(setter, PySetter) - self.attributes.append((name, getter, setter)) + self.attributes.append((name, getter, setter, custom_name)) def generate(self, code_sink): """ @@ -373,8 +374,8 @@ if not self.attributes: return '0' - getsets = {} # attrname -> (getter, setter) - for name, getter, setter in self.attributes: + getsets = collections.OrderedDict() # attrname -> (getter, setter) + for name, getter, setter, custom_name in self.attributes: getter_name = 'NULL' if getter is not None: @@ -396,14 +397,14 @@ else: setter_name = setter.c_function_name assert name not in getsets - getsets[name] = (getter_name, setter_name) + getsets[name] = (getter_name, setter_name, custom_name) code_sink.writeln("static PyGetSetDef %s[] = {" % self.cname) code_sink.indent() - for name, (getter_c_name, setter_c_name) in getsets.items(): + for name, (getter_c_name, setter_c_name, custom_name) in getsets.items(): code_sink.writeln('{') code_sink.indent() - code_sink.writeln('(char*) "%s", /* attribute name */' % name) + code_sink.writeln('(char*) "%s", /* attribute name */' % (custom_name or name)) ## getter code_sink.writeln( diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/PyBindGen-0.19.0/pybindgen/cppclass.py new/PyBindGen-0.20.1/pybindgen/cppclass.py --- old/PyBindGen-0.19.0/pybindgen/cppclass.py 2017-05-21 12:48:45.000000000 +0200 +++ new/PyBindGen-0.20.1/pybindgen/cppclass.py 2019-10-10 17:24:15.000000000 +0200 @@ -282,7 +282,7 @@ for existing in self.virtual_methods: if method.matches_signature(existing): return # don't re-add already existing method - + if isinstance(method, CppDummyMethod): if method.is_pure_virtual: self.cannot_be_constructed = True @@ -303,8 +303,8 @@ proxy = CppVirtualMethodProxy(method) proxy.main_wrapper = method # XXX: need to explain this self.add_virtual_proxy(proxy) - - + + def add_virtual_parent_caller(self, parent_caller): """Add a new CppVirtualMethodParentCaller object to this helper class""" assert isinstance(parent_caller, CppVirtualMethodParentCaller) @@ -409,7 +409,7 @@ code_sink.writeln("Py_CLEAR(m_pyself);") code_sink.unindent() code_sink.writeln("}\n") - + if not self.class_.import_from_module: ## write the parent callers (_name) for parent_caller in self.virtual_parent_callers.values(): @@ -495,7 +495,7 @@ else: parent_caller_name = name method_defs.append(parent_caller.get_py_method_def(parent_caller_name)) - + ## write the virtual proxies for virtual_proxy in self.virtual_proxies: #virtual_proxy.class_ = self.class_ @@ -513,7 +513,7 @@ for dummy, custom_body in self.custom_methods: if custom_body: code_sink.writeln(custom_body) - + return method_defs @@ -576,7 +576,7 @@ inherits from the parent class. Only root classes can have a memory policy defined. :type memory_policy: L{MemoryPolicy} - + :param foreign_cpp_namespace: if set, the class is assumed to belong to the given C++ namespace, regardless of the C++ namespace of the python module it will be added to. For @@ -622,7 +622,7 @@ self.is_singleton = is_singleton self.foreign_cpp_namespace = foreign_cpp_namespace self.full_name = None # full name with C++ namespaces attached and template parameters - self.methods = {} # name => OverloadedMethod + self.methods = collections.OrderedDict() # name => OverloadedMethod self._dummy_methods = [] # methods that have parameter/retval binding problems self.nonpublic_methods = [] self.constructors = [] # (name, wrapper) pairs @@ -817,7 +817,7 @@ The binary operator is assumed to operate with both operands of the type of the class, either by reference or by value. - + :param operator: string indicating the name of the operator to support, e.g. '==' """ @@ -1018,7 +1018,7 @@ self._have_pure_virtual_methods = True return self._have_pure_virtual_methods - + have_pure_virtual_methods = property(get_have_pure_virtual_methods) @@ -1039,7 +1039,7 @@ if not isinstance(hook, collections.Callable): raise TypeError("hook function must be callable") self.helper_class_hooks.append(hook) - + def _get_all_helper_class_hooks(self): """ Returns a list of all helper class hook functions, including @@ -1113,7 +1113,7 @@ raise CodeGenerationError("%s cannot be constructed (class has pure virtual methods)" % self.full_name) else: return self.full_name - + def implicitly_converts_to(self, other): """ @@ -1151,7 +1151,7 @@ # return classes def _update_names(self): - + prefix = settings.name_prefix.capitalize() if self.outer_class is None: @@ -1177,7 +1177,7 @@ def mangle(name): return mangle_name(name) - + def flatten(name): "make a name like::This look LikeThis" return ''.join([make_upper(mangle(s)) for s in name.split('::')]) @@ -1216,12 +1216,12 @@ try: param_type_matcher.register(alias, self.ThisClassParameter) except ValueError: pass - + self.ThisClassRefParameter.CTYPES.append(alias+'&') try: param_type_matcher.register(alias+'&', self.ThisClassRefParameter) except ValueError: pass - + self.ThisClassReturn.CTYPES.append(alias) try: return_type_matcher.register(alias, self.ThisClassReturn) @@ -1245,7 +1245,7 @@ return_type_matcher.register(alias+'&', self.ThisClassRefReturn) except ValueError: pass - + def get_module(self): """Get the Module object this class belongs to""" return self._module @@ -1285,7 +1285,7 @@ self.helper_class = CppHelperClass(self) self.module.add_include('<typeinfo>') return self.helper_class - + def get_type_narrowing_root(self): """Find the root CppClass along the subtree of all parent classes that have automatic_type_narrowing=True Note: multiple inheritance @@ -1409,7 +1409,7 @@ } ''') - + if self.import_from_module: code_sink.writeln("\nextern pybindgen::TypeMap *_%s;\n" % self.typeid_map_name) @@ -1440,7 +1440,7 @@ method.force_parse = method.PARSE_TUPLE_AND_KEYWORDS else: raise TypeError - + method.class_ = self if method.visibility == 'protected' and not method.is_virtual: @@ -1499,7 +1499,7 @@ new_method = parent_method.clone() new_method.class_ = self overload.add(new_method) - + else: self.nonpublic_methods.append(method) if method.is_virtual: @@ -1707,7 +1707,7 @@ setter.stack_where_defined = traceback.extract_stack() self.static_attributes.add_attribute(name, getter, setter) - def add_custom_instance_attribute(self, name, value_type, getter, is_const=False, setter=None, + def add_custom_instance_attribute(self, name, value_type, getter, is_const=False, setter=None, custom_name=None, getter_template_parameters=[], setter_template_parameters=[]): """ @@ -1742,10 +1742,10 @@ setter_wrapper = CppCustomInstanceAttributeSetter(value_type, self, name, setter=setter, template_parameters = setter_template_parameters) setter_wrapper.stack_where_defined = traceback.extract_stack() - self.instance_attributes.add_attribute(name, getter_wrapper, setter_wrapper) + self.instance_attributes.add_attribute(name, getter_wrapper, setter_wrapper, custom_name) def add_instance_attribute(self, name, value_type, is_const=False, - getter=None, setter=None): + getter=None, setter=None, custom_name=None): """ :param value_type: a ReturnValue object :param name: attribute name (i.e. the name of the class member variable) @@ -1774,7 +1774,7 @@ else: setter_wrapper = CppInstanceAttributeSetter(value_type, self, name, setter=setter) setter_wrapper.stack_where_defined = traceback.extract_stack() - self.instance_attributes.add_attribute(name, getter_wrapper, setter_wrapper) + self.instance_attributes.add_attribute(name, getter_wrapper, setter_wrapper, custom_name) def _inherit_helper_class_parent_virtuals(self): @@ -1883,7 +1883,7 @@ error_retcode = "MOD_ERROR" else: error_retcode = "NULL" - + # TODO: skip this step if the requested typestructure is never used if ' named ' in self.import_from_module: module_name, type_name = self.import_from_module.split(" named ") @@ -1914,7 +1914,7 @@ " _%s = reinterpret_cast<pybindgen::TypeMap*> (PyCObject_AsVoidPtr (_cobj));\n" " Py_DECREF(_cobj);\n" "}" - % (self.typeid_map_name, self.typeid_map_name)) + % (self.typeid_map_name, self.typeid_map_name)) if self.parent is None: self.wrapper_registry.generate_import(code_sink, module.after_init, "module") @@ -2009,14 +2009,14 @@ if self.has_output_stream_operator: self._generate_str(code_sink) - + #self._generate_tp_hash(code_sink) #self._generate_tp_compare(code_sink) #if self.slots.get("tp_hash", "NULL") == "NULL": # self.slots["tp_hash"] = self._generate_tp_hash(code_sink) - if self.slots.get("tp_richcompare", "NULL") == "NULL": + if self.slots.get("tp_richcompare", "NULL") == "NULL" and self.binary_comparison_operators: self.slots["tp_richcompare"] = self._generate_tp_richcompare(code_sink) if self.binary_numeric_operators or self.inplace_numeric_operators: @@ -2079,10 +2079,10 @@ code_sink.writeln("{") code_sink.indent() - + code_sink.writeln("%s left;" % left_name) code_sink.writeln("%s right;" % right_name) - + code_sink.writeln("if (%s(py_left, &left) && %s(py_right, &right)) {" % (left_converter, right_converter)) code_sink.indent() code_sink.writeln("%s result = (left %s right);" % (retval_name, op_symbol)) @@ -2093,7 +2093,7 @@ code_sink.unindent() code_sink.writeln("}") - + code_sink.writeln("Py_INCREF(Py_NotImplemented);") code_sink.writeln("return Py_NotImplemented;") code_sink.unindent() @@ -2117,9 +2117,9 @@ code_sink.writeln("{") code_sink.indent() - + code_sink.writeln("%s self;" % left_name) - + code_sink.writeln("if (%s(py_self, &self)) {" % (left_converter)) code_sink.indent() code_sink.writeln("%s result = %s(self);" % (retval_name, op_symbol)) @@ -2130,7 +2130,7 @@ code_sink.unindent() code_sink.writeln("}") - + code_sink.writeln("Py_INCREF(Py_NotImplemented);") code_sink.writeln("return Py_NotImplemented;") code_sink.unindent() @@ -2140,7 +2140,7 @@ try_wrap_operator('-', 'nb_subtract') try_wrap_operator('*', 'nb_multiply') try_wrap_operator('/', 'nb_divide') - + try_wrap_operator('+=', 'nb_inplace_add') try_wrap_operator('-=', 'nb_inplace_subtract') try_wrap_operator('*=', 'nb_inplace_multiply') @@ -2150,7 +2150,7 @@ pynumbermethods.generate(code_sink) return '&' + number_methods_var_name - + def _generate_sequence_methods(self, code_sink): sequence_methods_var_name = "%s__py_sequence_methods" % (self.mangled_full_name,) @@ -2182,7 +2182,7 @@ pysequencemethods.generate(code_sink) return '&' + sequence_methods_var_name - + def have_sequence_methods(self): """Determine if this object has sequence methods registered.""" for x in self.valid_sequence_methods: @@ -2203,7 +2203,7 @@ else: self.slots.setdefault("tp_dictoffset", "0") if self.binary_numeric_operators: - tp_flags.add("Py_TPFLAGS_CHECKTYPES") + tp_flags.add("Py_TPFLAGS_CHECKTYPES") self.slots.setdefault("tp_flags", '|'.join(tp_flags)) if docstring is None: @@ -2269,7 +2269,7 @@ ## tp_init to prevent this type from inheriting a ## tp_init that will allocate an instance of the ## parent class instead of this class. - code_sink.writeln() + code_sink.writeln() wrapper = CppNoConstructor(self.cannot_be_constructed) wrapper.generate(code_sink, self) constructor = wrapper.wrapper_actual_name @@ -2536,7 +2536,7 @@ } ''' % (tp_compare_function_name, self.pystruct, self.pystruct)) - + def _generate_destructor(self, code_sink, have_constructor): """Generate a tp_dealloc function and register it in the type""" @@ -2567,7 +2567,7 @@ code_block.write_code('Py_TYPE(self)->tp_free((PyObject*)self);') code_block.write_cleanup() - + code_block.declarations.get_code_sink().flush_to(code_sink) code_block.sink.flush_to(code_sink) @@ -2580,7 +2580,7 @@ def _generate_tp_richcompare(self, code_sink): tp_richcompare_function_name = "_wrap_%s__tp_richcompare" % (self.pystruct,) - code_sink.writeln("static PyObject*\n%s (%s *PYBINDGEN_UNUSED(self), %s *other, int opid)" + code_sink.writeln("static PyObject*\n%s (%s *self, %s *other, int opid)" % (tp_richcompare_function_name, self.pystruct, self.pystruct)) code_sink.writeln("{") code_sink.indent() @@ -2608,7 +2608,7 @@ code_sink.writeln("Py_INCREF(Py_NotImplemented);\n" "return Py_NotImplemented;") code_sink.unindent() - + wrap_operator('<', 'Py_LT') wrap_operator('<=', 'Py_LE') wrap_operator('==', 'Py_EQ') @@ -2634,7 +2634,7 @@ module.after_init.write_code( 'PyModule_AddObject(m, (char *) \"%s\", (PyObject *) &%s);' % ( alias, self.pytypestruct)) - + def write_allocate_pystruct(self, code_block, lvalue, wrapper_type=None): """ Generates code to allocate a python wrapper structure, using @@ -2654,7 +2654,7 @@ "%s->inst_dict = NULL;" % (lvalue,)) if self.memory_policy is not None: code_block.write_code(self.memory_policy.get_pystruct_init_code(self, lvalue)) - + # from pybindgen.cppclass_typehandlers import CppClassParameter, CppClassRefParameter, \ # CppClassReturnValue, CppClassRefReturnValue, CppClassPtrParameter, CppClassPtrReturnValue, CppClassParameterBase, \ @@ -2805,7 +2805,7 @@ code_block.unindent() code_block.write_code("}") else: - code_block.write_code("}") + code_block.write_code("}") else: # since there is a helper class, check if this C++ object is an instance of that class # http://stackoverflow.com/questions/579887/how-expensive-is-rtti/1468564#1468564 @@ -2876,7 +2876,7 @@ code_block.unindent() code_block.write_code("}") else: - code_block.write_code("}") + code_block.write_code("}") code_block.unindent() code_block.write_code("}") # closes: if (typeid(*(%s)) == typeid(%s)) { ... } else { ... @@ -2926,7 +2926,7 @@ CTYPES = [] cpp_class = None #cppclass.CppClass('dummy') # CppClass instance DIRECTIONS = [Parameter.DIRECTION_IN] - + def convert_python_to_c(self, wrapper): "parses python args to get C++ value" #assert isinstance(wrapper, ForwardWrapperBase) @@ -3044,7 +3044,7 @@ super(CppClassRefParameter, self).__init__( ctype, name, direction, is_const, default_value) self.default_value_type = default_value_type - + def convert_python_to_c(self, wrapper): "parses python args to get C++ value" #assert isinstance(wrapper, ForwardWrapperBase) @@ -3303,9 +3303,12 @@ def get_c_error_return(self): # only used in reverse wrappers """See ReturnValue.get_c_error_return""" - if self.type_traits.type_is_reference: - raise NotSupportedError - return "return %s();" % (self.cpp_class.full_name,) + if ( + self.type_traits.type_is_reference + and not self.type_traits.target_is_const + ): + raise NotSupportedError("non-const reference return not supported") + return "{static %s __err; return __err;}" % (self.cpp_class.full_name,) def convert_c_to_python(self, wrapper): """see ReturnValue.convert_c_to_python""" @@ -3341,8 +3344,11 @@ def convert_python_to_c(self, wrapper): """see ReturnValue.convert_python_to_c""" - if self.type_traits.type_is_reference: - raise NotSupportedError + if ( + self.type_traits.type_is_reference + and not self.type_traits.target_is_const + ): + raise NotSupportedError("non-const reference return not supported") name = wrapper.declarations.declare_variable( self.cpp_class.pystruct+'*', "tmp_%s" % self.cpp_class.name) wrapper.parse_params.add_parameter( @@ -3353,7 +3359,7 @@ else: wrapper.after_call.write_code('%s = *%s->obj;' % (self.value, name)) - + class CppClassPtrParameter(CppClassParameterBase): "Class* handlers" CTYPES = [] @@ -3463,7 +3469,7 @@ value = self.transformation.transform(self, wrapper.declarations, wrapper.before_call, value_ptr) wrapper.call_params.append(value) - + if self.transfer_ownership: if not isinstance(self.cpp_class.memory_policy, ReferenceCountingPolicy): # if we transfer ownership, in the end we no longer own the object, so clear our pointer @@ -3659,7 +3665,7 @@ wrapper.before_call.unindent() wrapper.before_call.write_code("}") # closes if (typeid(*(%s)) == typeid(%s))\n{ wrapper.build_params.add_parameter("N", [py_name]) - + class CppClassPtrReturnValue(CppClassReturnValueBase): @@ -3698,7 +3704,7 @@ to an object that may have been deallocated in the mean time. Calling methods on such an object would lead to a memory error. - + :param return_internal_reference: like reference_existing_object, but additionally adds custodian/ward to bind the lifetime of the 'self' object @@ -3743,7 +3749,7 @@ ## Value transformations value = self.transformation.untransform( self, wrapper.declarations, wrapper.after_call, self.value) - + # if value is NULL, return None wrapper.after_call.write_code("if (!(%s)) {\n" " Py_INCREF(Py_None);\n" @@ -3763,7 +3769,7 @@ # return the value wrapper.build_params.add_parameter("N", [py_name], prepend=True) - + def convert_python_to_c(self, wrapper): """See ReturnValue.convert_python_to_c""" @@ -3863,7 +3869,7 @@ "if (%(ward)s && !PySequence_Contains(%(wards)s, %(ward)s))\n" " PyList_Append(%(wards)s, %(ward)s);" % dict(wards=wards, ward=ward)) code_block.add_cleanup_code("Py_DECREF(%s);" % wards) - + def _get_custodian_or_ward(wrapper, num): if num == -1: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/PyBindGen-0.19.0/pybindgen/module.py new/PyBindGen-0.20.1/pybindgen/module.py --- old/PyBindGen-0.19.0/pybindgen/module.py 2015-10-11 15:57:30.000000000 +0200 +++ new/PyBindGen-0.20.1/pybindgen/module.py 2019-10-10 17:24:15.000000000 +0200 @@ -56,7 +56,7 @@ from pybindgen import utils import warnings import traceback - +import collections class MultiSectionFactory(object): """ @@ -248,7 +248,7 @@ self.cpp_namespace_prefix = '::'.join(path) self.declarations = DeclarationsScope() - self.functions = {} # name => OverloadedFunction + self.functions = collections.OrderedDict() # name => OverloadedFunction self.classes = [] self.containers = [] self.exceptions = [] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/PyBindGen-0.19.0/pybindgen/settings.py new/PyBindGen-0.20.1/pybindgen/settings.py --- old/PyBindGen-0.19.0/pybindgen/settings.py 2015-10-11 15:57:30.000000000 +0200 +++ new/PyBindGen-0.20.1/pybindgen/settings.py 2019-10-10 17:24:15.000000000 +0200 @@ -56,7 +56,7 @@ python wrapper exists for each C/C++ object. """ -deprecated_virtuals = None +deprecated_virtuals = False """ Prior to PyBindGen version 0.14, the code generated to handle C++ virtual methods required Python user code to define a _foo method in diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/PyBindGen-0.19.0/pybindgen/version.py new/PyBindGen-0.20.1/pybindgen/version.py --- old/PyBindGen-0.19.0/pybindgen/version.py 2018-05-27 16:42:28.000000000 +0200 +++ new/PyBindGen-0.20.1/pybindgen/version.py 2019-10-10 17:25:00.000000000 +0200 @@ -1,4 +1,4 @@ # coding: utf-8 # file generated by setuptools_scm # don't change, don't track in version control -version = '0.19.0' +version = '0.20.1' diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/PyBindGen-0.19.0/tests/foo.h new/PyBindGen-0.20.1/tests/foo.h --- old/PyBindGen-0.19.0/tests/foo.h 2018-05-27 13:53:07.000000000 +0200 +++ new/PyBindGen-0.20.1/tests/foo.h 2019-10-10 17:24:15.000000000 +0200 @@ -1342,4 +1342,32 @@ int test_args_kwargs(const char *args, const char *kwargs); + +struct RAStruct +{ + int a; +}; + + +class ReturnConstRef +{ +public: + virtual const RAStruct & ReturnMyAStruct (void) = 0; + virtual ~ReturnConstRef() {} +}; + + +class RAReturnConstRef : public ReturnConstRef +{ +public: + RAReturnConstRef(int value) { m_astruct.a = value; } + RAReturnConstRef() { m_astruct.a = 0; } + const RAStruct & ReturnMyAStruct (void) { return m_astruct; } + virtual ~RAReturnConstRef() {} + +private: + RAStruct m_astruct; +}; + + #endif /* !FOO_H_ */ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/PyBindGen-0.19.0/tests/foomodulegen.py new/PyBindGen-0.20.1/tests/foomodulegen.py --- old/PyBindGen-0.19.0/tests/foomodulegen.py 2015-10-11 15:57:31.000000000 +0200 +++ new/PyBindGen-0.20.1/tests/foomodulegen.py 2019-10-10 17:24:15.000000000 +0200 @@ -612,6 +612,30 @@ mod.add_function("test_args_kwargs", "int", [param("const char *", "args"), param("const char *", "kwargs")]) + # https://github.com/gjcarneiro/pybindgen/issues/21 + cls = mod.add_class('RAStruct') + cls.add_constructor([]) + cls.add_constructor([param('RAStruct const &', 'arg0')]) + cls.add_instance_attribute('a', 'int', is_const=False) + + cls = mod.add_class('ReturnConstRef', allow_subclassing=True) + cls.add_constructor([]) + cls.add_constructor([param('ReturnConstRef const &', 'arg0')]) + cls.add_method('ReturnMyAStruct', + 'RAStruct const &', + [], + is_pure_virtual=True, is_virtual=True) + + cls = mod.add_class('RAReturnConstRef', parent=mod['ReturnConstRef']) + cls.add_constructor([]) + cls.add_constructor([param('int', 'value')]) + cls.add_constructor([param('RAReturnConstRef const &', 'arg0')]) + cls.add_method('ReturnMyAStruct', + 'RAStruct const &', + [], + is_virtual=True) + + #### --- error handler --- class MyErrorHandler(pybindgen.settings.ErrorHandler): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/PyBindGen-0.19.0/tests/footest.py new/PyBindGen-0.20.1/tests/footest.py --- old/PyBindGen-0.19.0/tests/footest.py 2018-05-27 13:53:07.000000000 +0200 +++ new/PyBindGen-0.20.1/tests/footest.py 2019-10-10 17:24:15.000000000 +0200 @@ -1512,6 +1512,10 @@ while gc.collect(): pass + def test_issue21_const_return(self): + x = foo.RAReturnConstRef(123) + value = x.ReturnMyAStruct() + self.assertEqual(value.a, 123) if __name__ == '__main__': diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/PyBindGen-0.19.0/tox.ini new/PyBindGen-0.20.1/tox.ini --- old/PyBindGen-0.19.0/tox.ini 2016-05-04 01:05:44.000000000 +0200 +++ new/PyBindGen-0.20.1/tox.ini 2019-10-10 17:24:15.000000000 +0200 @@ -1,5 +1,5 @@ [tox] -envlist = py27,py33,py34 +envlist = py27,py34,py35,py36 [testenv] deps=