Bug 2075463 - autowrap fails to build with Python 3.11: error: cannot convert PyObject {aka _object} to PyTracebackObject {aka _traceback} in assignment
Summary: autowrap fails to build with Python 3.11: error: cannot convert PyObject {aka...
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: autowrap
Version: rawhide
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Antonio T. sagitter
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks: PYTHON3.11
TreeView+ depends on / blocked
 
Reported: 2022-04-14 09:47 UTC by Tomáš Hrnčiar
Modified: 2022-06-22 11:49 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2022-06-22 11:49:14 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Tomáš Hrnčiar 2022-04-14 09:47:07 UTC
autowrap fails to build with Python 3.11.0a7.


=================================== FAILURES ===================================
_______________________________ test_number_conv _______________________________

    def test_number_conv():
    
        target = os.path.join(test_files, "number_conv.pyx")
    
        include_dirs = autowrap.parse_and_generate_code(["number_conv.pxd"],
                                                        root=test_files, target=target, debug=True)
    
>       mod = autowrap.Utils.compile_and_import("number_conv", [target, ], include_dirs)

/builddir/build/BUILD/autowrap-0.22.7/autowrap-release-0.22.7/tests/test_code_generator.py:77: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

name = 'number_conv', source_files = ['number_conv.pyx']
include_dirs = ['/builddir/build/BUILD/autowrap-0.22.7/autowrap-release-0.22.7/autowrap/data_files/boost', '/builddir/build/BUILD/aut...0.22.7/autowrap/data_files/autowrap', '/builddir/build/BUILD/autowrap-0.22.7/autowrap-release-0.22.7/tests/test_files']
kws = {}, debug = None
shutil = <module 'shutil' from '/usr/lib64/python3.11/shutil.py'>
tempfile = <module 'tempfile' from '/usr/lib64/python3.11/tempfile.py'>
subprocess = <module 'subprocess' from '/usr/lib64/python3.11/subprocess.py'>
sys = <module 'sys' (built-in)>, tempdir = '/tmp/tmper6bwrkh'
source_file = '/builddir/build/BUILD/autowrap-0.22.7/autowrap-release-0.22.7/tests/test_files/number_conv.pyx'

    def compile_and_import(name, source_files, include_dirs=None, **kws):
    
        if include_dirs is None:
            include_dirs = []
    
        debug = kws.get("debug")
        import os.path
        import shutil
        import tempfile
        import subprocess
        import sys
    
        tempdir = tempfile.mkdtemp()
        if debug:
            print("\n")
            print("tempdir=", tempdir)
            print("\n")
        for source_file in source_files:
            if source_file[-4:] != ".pyx" and source_file[-4:] != ".cpp":
                raise NameError("Expected pyx and/or cpp files as source files for compilation.")
            shutil.copy(source_file, tempdir)
            stub = source_file[:-4]+".pyi"
            if os.path.exists(stub):
                shutil.copy(stub, os.path.join(tempdir, name+".pyi"))
    
        compile_args = []
        link_args = []
    
        if sys.platform == "darwin":
            compile_args += ["-stdlib=libc++","-std=c++11"]
            link_args += ["-stdlib=libc++"]
    
        if sys.platform == "linux" or sys.platform == "linux2":
            compile_args += ["-std=c++11"]
    
        if sys.platform != "win32":
            compile_args += ["-Wno-unused-but-set-variable"]
    
        include_dirs = [os.path.abspath(d) for d in include_dirs]
        source_files = [os.path.basename(f) for f in source_files]
        setup_code = template % locals()
        if debug:
            print("\n")
            print("-" * 70)
            print(setup_code)
            print("-" * 70)
            print("\n")
    
        now = os.getcwd()
        os.chdir(tempdir)
        with open("setup.py", "w") as fp:
            fp.write(setup_code)
    
        # module folder needs to have a py.typed file to recognize type stubs
        open("py.typed", 'a').close()
    
        import sys
        sys.path.insert(0, tempdir)
        if debug:
            print("\n")
            print("-" * 70)
            import pprint
            pprint.pprint(sys.path)
            print("-" * 70)
            print("\n")
    
>       assert subprocess.Popen("%s setup.py build_ext --force --inplace" % sys.executable, shell=True).wait() == 0
E       AssertionError

/builddir/build/BUILD/autowrap-0.22.7/autowrap-release-0.22.7/autowrap/Utils.py:131: AssertionError
----------------------------- Captured stdout call -----------------------------
Autowrap will start to parse and generate code. Will parse 1 files
Done parsing the files, will generate the code...
PXD (will not be written):
#Generated with autowrap 0.22.7 and Cython (Parser) 0.29.28
#cython: c_string_encoding=ascii
#cython: embedsignature=False
from  enum             import Enum as _PyEnum
from  libcpp.string   cimport string as libcpp_string
from  libcpp.string   cimport string as libcpp_utf8_string
from  libcpp.string   cimport string as libcpp_utf8_output_string
from  libcpp.set      cimport set as libcpp_set
from  libcpp.vector   cimport vector as libcpp_vector
from  libcpp.pair     cimport pair as libcpp_pair
from  libcpp.map      cimport map  as libcpp_map
from  libcpp          cimport bool
from  libc.string     cimport const_char
from  cython.operator cimport dereference as deref, preincrement as inc, address as address
from  AutowrapRefHolder      cimport AutowrapRefHolder
from  AutowrapPtrHolder      cimport AutowrapPtrHolder
from  AutowrapConstPtrHolder cimport AutowrapConstPtrHolder
from  smart_ptr       cimport shared_ptr
from number_conv cimport add_max_float as _add_max_float_number_conv
from number_conv cimport pass_full_precision as _pass_full_precision_number_conv
from number_conv cimport pass_full_precision_vec as _pass_full_precision_vec_number_conv

cdef extern from "autowrap_tools.hpp":
    char * _cast_const_away(char *) 

PYX:
#Generated with autowrap 0.22.7 and Cython (Parser) 0.29.28
#cython: c_string_encoding=ascii
#cython: embedsignature=False
from  enum             import Enum as _PyEnum
from  libcpp.string   cimport string as libcpp_string
from  libcpp.string   cimport string as libcpp_utf8_string
from  libcpp.string   cimport string as libcpp_utf8_output_string
from  libcpp.set      cimport set as libcpp_set
from  libcpp.vector   cimport vector as libcpp_vector
from  libcpp.pair     cimport pair as libcpp_pair
from  libcpp.map      cimport map  as libcpp_map
from  libcpp          cimport bool
from  libc.string     cimport const_char
from  cython.operator cimport dereference as deref, preincrement as inc, address as address
from  AutowrapRefHolder      cimport AutowrapRefHolder
from  AutowrapPtrHolder      cimport AutowrapPtrHolder
from  AutowrapConstPtrHolder cimport AutowrapConstPtrHolder
from  smart_ptr       cimport shared_ptr
from number_conv cimport add_max_float as _add_max_float_number_conv
from number_conv cimport pass_full_precision as _pass_full_precision_number_conv
from number_conv cimport pass_full_precision_vec as _pass_full_precision_vec_number_conv

cdef extern from "autowrap_tools.hpp":
    char * _cast_const_away(char *)
def add_max_float(double in_0 ):
    """Cython signature: double add_max_float(double)"""
    assert isinstance(in_0, float), 'arg in_0 wrong type'

    cdef double _r = _add_max_float_number_conv((<double>in_0))
    py_result = <double>_r
    return py_result

def pass_full_precision(double in_0 ):
    """Cython signature: double pass_full_precision(double)"""
    assert isinstance(in_0, float), 'arg in_0 wrong type'

    cdef double _r = _pass_full_precision_number_conv((<double>in_0))
    py_result = <double>_r
    return py_result

def pass_full_precision_vec(list in_0 ):
    """Cython signature: libcpp_vector[double] pass_full_precision_vec(libcpp_vector[double] &)"""
    assert isinstance(in_0, list) and all(isinstance(elemt_rec, float) for elemt_rec in in_0), 'arg in_0 wrong type'
    cdef libcpp_vector[double] v0 = in_0
    _r = _pass_full_precision_vec_number_conv(v0)
    in_0[:] = v0
    cdef list py_result = _r
    return py_result 

Autowrap has wrapped 0 classes, 3 methods and 0 enums
running build_ext
cythoning number_conv.pyx to number_conv.cpp
building 'number_conv' extension
creating build
creating build/temp.linux-x86_64-3.11
gcc -Wsign-compare -DDYNAMIC_ANNOTATIONS_ENABLED=1 -DNDEBUG -O2 -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -O2 -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -O2 -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -I/usr/include/boost -fPIC -I/builddir/build/BUILD/autowrap-0.22.7/autowrap-release-0.22.7/autowrap/data_files/boost -I/builddir/build/BUILD/autowrap-0.22.7/autowrap-release-0.22.7/autowrap/data_files -I/builddir/build/BUILD/autowrap-0.22.7/autowrap-release-0.22.7/autowrap/data_files/autowrap -I/builddir/build/BUILD/autowrap-0.22.7/autowrap-release-0.22.7/tests/test_files -I/usr/include/python3.11 -c number_conv.cpp -o build/temp.linux-x86_64-3.11/number_conv.o -std=c++11 -Wno-unused-but-set-variable
----------------------------- Captured stderr call -----------------------------
WARNING: '.' not a valid package name; please use only .-separated package names in setup.py
warning: number_conv.pyx:25:0: Overriding cdef method with def method.
warning: number_conv.pyx:33:0: Overriding cdef method with def method.
warning: number_conv.pyx:41:0: Overriding cdef method with def method.
number_conv.cpp: In function ‘PyObject* __Pyx_Coroutine_SendEx(__pyx_CoroutineObject*, PyObject*, int)’:
number_conv.cpp:5064:42: error: cannot convert ‘PyObject*’ {aka ‘_object*’} to ‘PyTracebackObject*’ {aka ‘_traceback*’} in assignment
 5064 |         tb = __Pyx__ExceptionGetTraceback(exc_state->exc_value);
      |              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
      |                                          |
      |                                          PyObject* {aka _object*}
error: command '/usr/bin/gcc' failed with exit code 1
------------------------------ Captured log call -------------------------------
Level 25 autowrap:DeclResolver.py:238 parsing progress 0 out of 1
INFO     autowrap:DeclResolver.py:292 start resolving decls
INFO     autowrap:DeclResolver.py:587 resolve function decl: 'CppMethodOrFunctionDecl: double add_max_float (['double '])'
INFO     autowrap:DeclResolver.py:587 resolve function decl: 'CppMethodOrFunctionDecl: double pass_full_precision (['double '])'
INFO     autowrap:DeclResolver.py:587 resolve function decl: 'CppMethodOrFunctionDecl: libcpp_vector[double] pass_full_precision_vec (['libcpp_vector[double] & '])'
________________________________ test_templated ________________________________

    def test_templated():
    
        target = os.path.join(test_files, "templated_wrapper.pyx")
    
        decls, instance_map = autowrap.parse(["templated.pxd"], root=test_files)
    
        co = autowrap.Code.Code()
        co.add("""def special(self):
                 |    return "hi" """)
    
        methods = dict(T=co)
    
        include_dirs = autowrap.generate_code(decls, instance_map, target=target,
                                              debug=True, manual_code=methods)
    
        cpp_source = os.path.join(test_files, "templated.cpp")
        cpp_sources = []
    
>       twrapped = autowrap.Utils.compile_and_import("twrapped",
                                                     [target] + cpp_sources,
                                                     include_dirs)

/builddir/build/BUILD/autowrap-0.22.7/autowrap-release-0.22.7/tests/test_code_generator.py:149: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

name = 'twrapped', source_files = ['templated_wrapper.pyx']
include_dirs = ['/builddir/build/BUILD/autowrap-0.22.7/autowrap-release-0.22.7/autowrap/data_files/boost', '/builddir/build/BUILD/aut...0.22.7/autowrap/data_files/autowrap', '/builddir/build/BUILD/autowrap-0.22.7/autowrap-release-0.22.7/tests/test_files']
kws = {}, debug = None
shutil = <module 'shutil' from '/usr/lib64/python3.11/shutil.py'>
tempfile = <module 'tempfile' from '/usr/lib64/python3.11/tempfile.py'>
subprocess = <module 'subprocess' from '/usr/lib64/python3.11/subprocess.py'>
sys = <module 'sys' (built-in)>, tempdir = '/tmp/tmpilge8fzz'
source_file = '/builddir/build/BUILD/autowrap-0.22.7/autowrap-release-0.22.7/tests/test_files/templated_wrapper.pyx'

    def compile_and_import(name, source_files, include_dirs=None, **kws):
    
        if include_dirs is None:
            include_dirs = []
    
        debug = kws.get("debug")
        import os.path
        import shutil
        import tempfile
        import subprocess
        import sys
    
        tempdir = tempfile.mkdtemp()
        if debug:
            print("\n")
            print("tempdir=", tempdir)
            print("\n")
        for source_file in source_files:
            if source_file[-4:] != ".pyx" and source_file[-4:] != ".cpp":
                raise NameError("Expected pyx and/or cpp files as source files for compilation.")
            shutil.copy(source_file, tempdir)
            stub = source_file[:-4]+".pyi"
            if os.path.exists(stub):
                shutil.copy(stub, os.path.join(tempdir, name+".pyi"))
    
        compile_args = []
        link_args = []
    
        if sys.platform == "darwin":
            compile_args += ["-stdlib=libc++","-std=c++11"]
            link_args += ["-stdlib=libc++"]
    
        if sys.platform == "linux" or sys.platform == "linux2":
            compile_args += ["-std=c++11"]
    
        if sys.platform != "win32":
            compile_args += ["-Wno-unused-but-set-variable"]
    
        include_dirs = [os.path.abspath(d) for d in include_dirs]
        source_files = [os.path.basename(f) for f in source_files]
        setup_code = template % locals()
        if debug:
            print("\n")
            print("-" * 70)
            print(setup_code)
            print("-" * 70)
            print("\n")
    
        now = os.getcwd()
        os.chdir(tempdir)
        with open("setup.py", "w") as fp:
            fp.write(setup_code)
    
        # module folder needs to have a py.typed file to recognize type stubs
        open("py.typed", 'a').close()
    
        import sys
        sys.path.insert(0, tempdir)
        if debug:
            print("\n")
            print("-" * 70)
            import pprint
            pprint.pprint(sys.path)
            print("-" * 70)
            print("\n")
    
>       assert subprocess.Popen("%s setup.py build_ext --force --inplace" % sys.executable, shell=True).wait() == 0
E       AssertionError

/builddir/build/BUILD/autowrap-0.22.7/autowrap-release-0.22.7/autowrap/Utils.py:131: AssertionError
----------------------------- Captured stdout call -----------------------------
PXD (will not be written):
#Generated with autowrap 0.22.7 and Cython (Parser) 0.29.28
#cython: c_string_encoding=ascii
#cython: embedsignature=False
from  enum             import Enum as _PyEnum
from  libcpp.string   cimport string as libcpp_string
from  libcpp.string   cimport string as libcpp_utf8_string
from  libcpp.string   cimport string as libcpp_utf8_output_string
from  libcpp.set      cimport set as libcpp_set
from  libcpp.vector   cimport vector as libcpp_vector
from  libcpp.pair     cimport pair as libcpp_pair
from  libcpp.map      cimport map  as libcpp_map
from  libcpp          cimport bool
from  libc.string     cimport const_char
from  cython.operator cimport dereference as deref, preincrement as inc, address as address
from  AutowrapRefHolder      cimport AutowrapRefHolder
from  AutowrapPtrHolder      cimport AutowrapPtrHolder
from  AutowrapConstPtrHolder cimport AutowrapConstPtrHolder
from  smart_ptr       cimport shared_ptr
from templated cimport computeEight as _computeEight_templated
from templated cimport computeEight as _computeEight_templated
from templated cimport T as _T
from templated cimport T2 as _T2
from templated cimport Templated as _Templated
from templated cimport Templated as _Templated
from templated cimport Y as _Y

cdef extern from "autowrap_tools.hpp":
    char * _cast_const_away(char *) 
 
 
 
 
 

PYX:
#Generated with autowrap 0.22.7 and Cython (Parser) 0.29.28
#cython: c_string_encoding=ascii
#cython: embedsignature=False
from  enum             import Enum as _PyEnum
from  libcpp.string   cimport string as libcpp_string
from  libcpp.string   cimport string as libcpp_utf8_string
from  libcpp.string   cimport string as libcpp_utf8_output_string
from  libcpp.set      cimport set as libcpp_set
from  libcpp.vector   cimport vector as libcpp_vector
from  libcpp.pair     cimport pair as libcpp_pair
from  libcpp.map      cimport map  as libcpp_map
from  libcpp          cimport bool
from  libc.string     cimport const_char
from  cython.operator cimport dereference as deref, preincrement as inc, address as address
from  AutowrapRefHolder      cimport AutowrapRefHolder
from  AutowrapPtrHolder      cimport AutowrapPtrHolder
from  AutowrapConstPtrHolder cimport AutowrapConstPtrHolder
from  smart_ptr       cimport shared_ptr
from templated cimport computeEight as _computeEight_templated
from templated cimport computeEight as _computeEight_templated
from templated cimport T as _T
from templated cimport T2 as _T2
from templated cimport Templated as _Templated
from templated cimport Templated as _Templated
from templated cimport Y as _Y

cdef extern from "autowrap_tools.hpp":
    char * _cast_const_away(char *)
def __static_Templated_other_computeEight():
    """Cython signature: int computeEight()"""
    cdef int _r = _computeEight_templated()
    py_result = <int>_r
    return py_result

def __static_Templated_computeEight():
    """Cython signature: int computeEight()"""
    cdef int _r = _computeEight_templated()
    py_result = <int>_r
    return py_result 

cdef class T:
    """
    Cython implementation of _T
    """

    cdef shared_ptr[_T] inst

    def __dealloc__(self):
         self.inst.reset()

    
    def _init_0(self):
        """Cython signature: void T()"""
        self.inst = shared_ptr[_T](new _T())
    
    def _init_1(self,  in_0 ):
        """Cython signature: void T(int)"""
        assert isinstance(in_0, (int, long)), 'arg in_0 wrong type'
    
        self.inst = shared_ptr[_T](new _T((<int>in_0)))
    
    def __init__(self, *args , **kwargs):
        """
          - Cython signature: void T()
          - Cython signature: void T(int)
"""
        if not args:
             self._init_0(*args)
        elif (len(args)==1) and (isinstance(args[0], (int, long))):
             self._init_1(*args)
        else:
               raise Exception('can not handle type of %s' % (args,))
    
    def get(self):
        """Cython signature: int get()"""
        cdef int _r = self.inst.get().get()
        py_result = <int>_r
        return py_result
    def special(self):
        return "hi" 

cdef class T2:
    """
    Cython implementation of _T2
    """

    cdef shared_ptr[_T2] inst

    def __dealloc__(self):
         self.inst.reset()

    
    def _init_0(self):
        """Cython signature: void T2()"""
        self.inst = shared_ptr[_T2](new _T2())
    
    def _init_1(self,  in_0 ):
        """Cython signature: void T2(int)"""
        assert isinstance(in_0, (int, long)), 'arg in_0 wrong type'
    
        self.inst = shared_ptr[_T2](new _T2((<int>in_0)))
    
    def __init__(self, *args , **kwargs):
        """
          - Cython signature: void T2()
          - Cython signature: void T2(int)
"""
        if not args:
             self._init_0(*args)
        elif (len(args)==1) and (isinstance(args[0], (int, long))):
             self._init_1(*args)
        else:
               raise Exception('can not handle type of %s' % (args,))
    
    def get(self):
        """Cython signature: int get()"""
        cdef int _r = self.inst.get().get()
        py_result = <int>_r
        return py_result 

cdef class Templated:
    """
    Cython implementation of _Templated[_T]
    """

    cdef shared_ptr[_Templated[_T]] inst

    def __dealloc__(self):
         self.inst.reset()

    
    property _x:
        def __set__(self, T _x):
        
            self.inst.get()._x = (deref(_x.inst.get()))
        
    
        def __get__(self):
            cdef _T * _r = new _T(self.inst.get()._x)
            cdef T py_result = T.__new__(T)
            py_result.inst = shared_ptr[_T](_r)
            return py_result
    
    property f_att:
        def __set__(self, float f):
        
            self.inst.get().f = (<float>f)
        
    
        def __get__(self):
            cdef float _r = self.inst.get().f
            py_result = <float>_r
            return py_result
    
    property xi:
        def __set__(self, list xi):
            cdef libcpp_vector[_T] * v0 = new libcpp_vector[_T]()
            cdef T item0
            for item0 in xi:
                v0.push_back(deref(item0.inst.get()))
            self.inst.get().xi = deref(v0)
            del v0
    
        def __get__(self):
            _r = self.inst.get().xi
            py_result = []
            cdef libcpp_vector[_T].iterator it__r = _r.begin()
            cdef T item_py_result
            while it__r != _r.end():
               item_py_result = T.__new__(T)
               item_py_result.inst = shared_ptr[_T](new _T(deref(it__r)))
               py_result.append(item_py_result)
               inc(it__r)
            return py_result
    
    def __init__(self, T in_0 ):
        """Cython signature: void Templated(T)"""
        assert isinstance(in_0, T), 'arg in_0 wrong type'
    
        self.inst = shared_ptr[_Templated[_T]](new _Templated[_T]((deref(in_0.inst.get()))))
    
    def get(self):
        """Cython signature: T get()"""
        cdef _T * _r = new _T(self.inst.get().get())
        cdef T py_result = T.__new__(T)
        py_result.inst = shared_ptr[_T](_r)
        return py_result
    
    def getF(self):
        """Cython signature: float getF()"""
        cdef float _r = self.inst.get().getF()
        py_result = <float>_r
        return py_result
    
    def summup(self, list v ):
        """Cython signature: int summup(libcpp_vector[Templated] & v)"""
        assert isinstance(v, list) and all(isinstance(elemt_rec, Templated) for elemt_rec in v), 'arg v wrong type'
        cdef libcpp_vector[_Templated[_T]] * v0 = new libcpp_vector[_Templated[_T]]()
        cdef Templated item0
        for item0 in v:
            v0.push_back(deref(item0.inst.get()))
        cdef int _r = self.inst.get().summup(deref(v0))
        cdef libcpp_vector[_Templated[_T]].iterator it_v = v0.begin()
        replace_0 = []
        while it_v != v0.end():
            item0 = Templated.__new__(Templated)
            item0.inst = shared_ptr[_Templated[_T]](new _Templated[_T](deref(it_v)))
            replace_0.append(item0)
            inc(it_v)
        v[:] = replace_0
        del v0
        py_result = <int>_r
        return py_result
    
    def reverse(self, list v ):
        """Cython signature: libcpp_vector[Templated] reverse(libcpp_vector[Templated] & v)"""
        assert isinstance(v, list) and all(isinstance(elemt_rec, Templated) for elemt_rec in v), 'arg v wrong type'
        cdef libcpp_vector[_Templated[_T]] * v0 = new libcpp_vector[_Templated[_T]]()
        cdef Templated item0
        for item0 in v:
            v0.push_back(deref(item0.inst.get()))
        _r = self.inst.get().reverse(deref(v0))
        cdef libcpp_vector[_Templated[_T]].iterator it_v = v0.begin()
        replace_0 = []
        while it_v != v0.end():
            item0 = Templated.__new__(Templated)
            item0.inst = shared_ptr[_Templated[_T]](new _Templated[_T](deref(it_v)))
            replace_0.append(item0)
            inc(it_v)
        v[:] = replace_0
        del v0
        py_result = []
        cdef libcpp_vector[_Templated[_T]].iterator it__r = _r.begin()
        cdef Templated item_py_result
        while it__r != _r.end():
           item_py_result = Templated.__new__(Templated)
           item_py_result.inst = shared_ptr[_Templated[_T]](new _Templated[_T](deref(it__r)))
           py_result.append(item_py_result)
           inc(it__r)
        return py_result
    
    def getTwice(self, Templated in_0 ):
        """Cython signature: int getTwice(Templated)"""
        assert isinstance(in_0, Templated), 'arg in_0 wrong type'
    
        cdef int _r = self.inst.get().getTwice((deref(in_0.inst.get())))
        py_result = <int>_r
        return py_result
    
    def passs(self, Templated v ):
        """Cython signature: Templated passs(Templated v)"""
        assert isinstance(v, Templated), 'arg v wrong type'
    
        cdef _Templated[_T] * _r = new _Templated[_T](self.inst.get().passs((deref(v.inst.get()))))
        cdef Templated py_result = Templated.__new__(Templated)
        py_result.inst = shared_ptr[_Templated[_T]](_r)
        return py_result
    
    @staticmethod
    def computeSeven():
        """Cython signature: int computeSeven()"""
        cdef int _r = _Templated[_T].computeSeven()
        py_result = <int>_r
        return py_result
    
    def __richcmp__(self, other, op):
        if op not in (2,):
           op_str = {0: '<', 2: '==', 4: '>', 1: '<=', 3: '!=', 5: '>='}[op]
           raise Exception("comparions operator %s not implemented" % op_str)
        if not isinstance(other, Templated):
            return False
        cdef Templated other_casted = other
        cdef Templated self_casted = self
        if op==2:
            return deref(self_casted.inst.get()) == deref(other_casted.inst.get())
    computeEight = __static_Templated_computeEight 

cdef class Templated_other:
    """
    Cython implementation of _Templated[_T2]
    """

    cdef shared_ptr[_Templated[_T2]] inst

    def __dealloc__(self):
         self.inst.reset()

    
    property _x:
        def __set__(self, T2 _x):
        
            self.inst.get()._x = (deref(_x.inst.get()))
        
    
        def __get__(self):
            cdef _T2 * _r = new _T2(self.inst.get()._x)
            cdef T2 py_result = T2.__new__(T2)
            py_result.inst = shared_ptr[_T2](_r)
            return py_result
    
    property f_att:
        def __set__(self, float f):
        
            self.inst.get().f = (<float>f)
        
    
        def __get__(self):
            cdef float _r = self.inst.get().f
            py_result = <float>_r
            return py_result
    
    property xi:
        def __set__(self, list xi):
            cdef libcpp_vector[_T2] * v0 = new libcpp_vector[_T2]()
            cdef T2 item0
            for item0 in xi:
                v0.push_back(deref(item0.inst.get()))
            self.inst.get().xi = deref(v0)
            del v0
    
        def __get__(self):
            _r = self.inst.get().xi
            py_result = []
            cdef libcpp_vector[_T2].iterator it__r = _r.begin()
            cdef T2 item_py_result
            while it__r != _r.end():
               item_py_result = T2.__new__(T2)
               item_py_result.inst = shared_ptr[_T2](new _T2(deref(it__r)))
               py_result.append(item_py_result)
               inc(it__r)
            return py_result
    
    def __init__(self, T2 in_0 ):
        """Cython signature: void Templated_other(T2)"""
        assert isinstance(in_0, T2), 'arg in_0 wrong type'
    
        self.inst = shared_ptr[_Templated[_T2]](new _Templated[_T2]((deref(in_0.inst.get()))))
    
    def get(self):
        """Cython signature: T2 get()"""
        cdef _T2 * _r = new _T2(self.inst.get().get())
        cdef T2 py_result = T2.__new__(T2)
        py_result.inst = shared_ptr[_T2](_r)
        return py_result
    
    def getF(self):
        """Cython signature: float getF()"""
        cdef float _r = self.inst.get().getF()
        py_result = <float>_r
        return py_result
    
    def summup(self, list v ):
        """Cython signature: int summup(libcpp_vector[Templated_other] & v)"""
        assert isinstance(v, list) and all(isinstance(elemt_rec, Templated_other) for elemt_rec in v), 'arg v wrong type'
        cdef libcpp_vector[_Templated[_T2]] * v0 = new libcpp_vector[_Templated[_T2]]()
        cdef Templated_other item0
        for item0 in v:
            v0.push_back(deref(item0.inst.get()))
        cdef int _r = self.inst.get().summup(deref(v0))
        cdef libcpp_vector[_Templated[_T2]].iterator it_v = v0.begin()
        replace_0 = []
        while it_v != v0.end():
            item0 = Templated_other.__new__(Templated_other)
            item0.inst = shared_ptr[_Templated[_T2]](new _Templated[_T2](deref(it_v)))
            replace_0.append(item0)
            inc(it_v)
        v[:] = replace_0
        del v0
        py_result = <int>_r
        return py_result
    
    def reverse(self, list v ):
        """Cython signature: libcpp_vector[Templated_other] reverse(libcpp_vector[Templated_other] & v)"""
        assert isinstance(v, list) and all(isinstance(elemt_rec, Templated_other) for elemt_rec in v), 'arg v wrong type'
        cdef libcpp_vector[_Templated[_T2]] * v0 = new libcpp_vector[_Templated[_T2]]()
        cdef Templated_other item0
        for item0 in v:
            v0.push_back(deref(item0.inst.get()))
        _r = self.inst.get().reverse(deref(v0))
        cdef libcpp_vector[_Templated[_T2]].iterator it_v = v0.begin()
        replace_0 = []
        while it_v != v0.end():
            item0 = Templated_other.__new__(Templated_other)
            item0.inst = shared_ptr[_Templated[_T2]](new _Templated[_T2](deref(it_v)))
            replace_0.append(item0)
            inc(it_v)
        v[:] = replace_0
        del v0
        py_result = []
        cdef libcpp_vector[_Templated[_T2]].iterator it__r = _r.begin()
        cdef Templated_other item_py_result
        while it__r != _r.end():
           item_py_result = Templated_other.__new__(Templated_other)
           item_py_result.inst = shared_ptr[_Templated[_T2]](new _Templated[_T2](deref(it__r)))
           py_result.append(item_py_result)
           inc(it__r)
        return py_result
    
    def getTwice(self, Templated_other in_0 ):
        """Cython signature: int getTwice(Templated_other)"""
        assert isinstance(in_0, Templated_other), 'arg in_0 wrong type'
    
        cdef int _r = self.inst.get().getTwice((deref(in_0.inst.get())))
        py_result = <int>_r
        return py_result
    
    def passs(self, Templated_other v ):
        """Cython signature: Templated_other passs(Templated_other v)"""
        assert isinstance(v, Templated_other), 'arg v wrong type'
    
        cdef _Templated[_T2] * _r = new _Templated[_T2](self.inst.get().passs((deref(v.inst.get()))))
        cdef Templated_other py_result = Templated_other.__new__(Templated_other)
        py_result.inst = shared_ptr[_Templated[_T2]](_r)
        return py_result
    
    @staticmethod
    def computeSeven():
        """Cython signature: int computeSeven()"""
        cdef int _r = _Templated[_T2].computeSeven()
        py_result = <int>_r
        return py_result
    
    def __richcmp__(self, other, op):
        if op not in (2,):
           op_str = {0: '<', 2: '==', 4: '>', 1: '<=', 3: '!=', 5: '>='}[op]
           raise Exception("comparions operator %s not implemented" % op_str)
        if not isinstance(other, Templated_other):
            return False
        cdef Templated_other other_casted = other
        cdef Templated_other self_casted = self
        if op==2:
            return deref(self_casted.inst.get()) == deref(other_casted.inst.get())
    computeEight = __static_Templated_other_computeEight 

cdef class Y:
    """
    Cython implementation of _Y
    """

    cdef shared_ptr[_Y] inst

    def __dealloc__(self):
         self.inst.reset()

    
    def __init__(self):
        """Cython signature: void Y()"""
        self.inst = shared_ptr[_Y](new _Y())
    
    def passs(self, list v ):
        """Cython signature: libcpp_vector[Templated] passs(libcpp_vector[Templated] v)"""
        assert isinstance(v, list) and all(isinstance(elemt_rec, Templated) for elemt_rec in v), 'arg v wrong type'
        cdef libcpp_vector[_Templated[_T]] * v0 = new libcpp_vector[_Templated[_T]]()
        cdef Templated item0
        for item0 in v:
            v0.push_back(deref(item0.inst.get()))
        _r = self.inst.get().passs(deref(v0))
        del v0
        py_result = []
        cdef libcpp_vector[_Templated[_T]].iterator it__r = _r.begin()
        cdef Templated item_py_result
        while it__r != _r.end():
           item_py_result = Templated.__new__(Templated)
           item_py_result.inst = shared_ptr[_Templated[_T]](new _Templated[_T](deref(it__r)))
           py_result.append(item_py_result)
           inc(it__r)
        return py_result 
 

Autowrap has wrapped 5 classes, 26 methods and 0 enums
running build_ext
cythoning templated_wrapper.pyx to templated_wrapper.cpp
building 'twrapped' extension
creating build
creating build/temp.linux-x86_64-3.11
gcc -Wsign-compare -DDYNAMIC_ANNOTATIONS_ENABLED=1 -DNDEBUG -O2 -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -O2 -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -O2 -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -I/usr/include/boost -fPIC -I/builddir/build/BUILD/autowrap-0.22.7/autowrap-release-0.22.7/autowrap/data_files/boost -I/builddir/build/BUILD/autowrap-0.22.7/autowrap-release-0.22.7/autowrap/data_files -I/builddir/build/BUILD/autowrap-0.22.7/autowrap-release-0.22.7/autowrap/data_files/autowrap -I/builddir/build/BUILD/autowrap-0.22.7/autowrap-release-0.22.7/tests/test_files -I/usr/include/python3.11 -c templated_wrapper.cpp -o build/temp.linux-x86_64-3.11/templated_wrapper.o -std=c++11 -Wno-unused-but-set-variable
----------------------------- Captured stderr call -----------------------------
WARNING: '.' not a valid package name; please use only .-separated package names in setup.py
/usr/lib64/python3.11/site-packages/Cython/Compiler/Main.py:369: FutureWarning: Cython directive 'language_level' not set, using 2 for now (Py2). This will change in a later release! File: /tmp/tmpilge8fzz/templated_wrapper.pyx
  tree = Parsing.p_module(s, pxd, full_module_name)
templated_wrapper.cpp: In function ‘PyObject* __Pyx_Coroutine_SendEx(__pyx_CoroutineObject*, PyObject*, int)’:
templated_wrapper.cpp:14508:42: error: cannot convert ‘PyObject*’ {aka ‘_object*’} to ‘PyTracebackObject*’ {aka ‘_traceback*’} in assignment
14508 |         tb = __Pyx__ExceptionGetTraceback(exc_state->exc_value);
      |              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
      |                                          |
      |                                          PyObject* {aka _object*}
error: command '/usr/bin/gcc' failed with exit code 1
------------------------------ Captured log call -------------------------------
Level 25 autowrap:DeclResolver.py:238 parsing progress 0 out of 1
INFO     autowrap:DeclResolver.py:292 start resolving decls
INFO     autowrap:DeclResolver.py:398 resolve_inheritance for T
INFO     autowrap:DeclResolver.py:398 resolve_inheritance for T2
INFO     autowrap:DeclResolver.py:398 resolve_inheritance for Templated
INFO     autowrap:DeclResolver.py:398 resolve_inheritance for Y
INFO     autowrap:DeclResolver.py:587 resolve function decl: 'CppMethodOrFunctionDecl: int computeEight ([])'
INFO     autowrap:DeclResolver.py:587 resolve function decl: 'CppMethodOrFunctionDecl: int computeEight ([])'
INFO     autowrap:DeclResolver.py:526 resolve class decl T
INFO     autowrap:DeclResolver.py:568 resolve method decl: 'CppMethodOrFunctionDecl: void T ([])'
INFO     autowrap:DeclResolver.py:568 resolve method decl: 'CppMethodOrFunctionDecl: void T (['int '])'
INFO     autowrap:DeclResolver.py:578 resolve method decl: 'CppMethodOrFunctionDecl: int get ([])'
INFO     autowrap:DeclResolver.py:526 resolve class decl T2
INFO     autowrap:DeclResolver.py:568 resolve method decl: 'CppMethodOrFunctionDecl: void T2 ([])'
INFO     autowrap:DeclResolver.py:568 resolve method decl: 'CppMethodOrFunctionDecl: void T2 (['int '])'
INFO     autowrap:DeclResolver.py:578 resolve method decl: 'CppMethodOrFunctionDecl: int get ([])'
INFO     autowrap:DeclResolver.py:526 resolve class decl Templated
INFO     autowrap:DeclResolver.py:568 resolve method decl: 'CppMethodOrFunctionDecl: void Templated (['X '])'
INFO     autowrap:DeclResolver.py:578 resolve method decl: 'CppMethodOrFunctionDecl: X get ([])'
INFO     autowrap:DeclResolver.py:578 resolve method decl: 'CppMethodOrFunctionDecl: float getF ([])'
INFO     autowrap:DeclResolver.py:578 resolve method decl: 'CppMethodOrFunctionDecl: int summup (['libcpp_vector[Templated[X]] & v'])'
INFO     autowrap:DeclResolver.py:578 resolve method decl: 'CppMethodOrFunctionDecl: libcpp_vector[Templated[X]] reverse (['libcpp_vector[Templated[X]] & v'])'
INFO     autowrap:DeclResolver.py:578 resolve method decl: 'CppMethodOrFunctionDecl: int getTwice (['Templated[X] '])'
INFO     autowrap:DeclResolver.py:578 resolve method decl: 'CppMethodOrFunctionDecl: Templated[X] passs (['Templated[X] v'])'
INFO     autowrap:DeclResolver.py:578 resolve method decl: 'CppMethodOrFunctionDecl: bool operator== (['Templated[X] other'])'
INFO     autowrap:DeclResolver.py:578 resolve method decl: 'CppMethodOrFunctionDecl: int computeSeven ([])'
INFO     autowrap:DeclResolver.py:568 resolve method decl: 'CppMethodOrFunctionDecl: void Templated (['X '])'
INFO     autowrap:DeclResolver.py:578 resolve method decl: 'CppMethodOrFunctionDecl: X get ([])'
INFO     autowrap:DeclResolver.py:578 resolve method decl: 'CppMethodOrFunctionDecl: float getF ([])'
INFO     autowrap:DeclResolver.py:578 resolve method decl: 'CppMethodOrFunctionDecl: int summup (['libcpp_vector[Templated[X]] & v'])'
INFO     autowrap:DeclResolver.py:578 resolve method decl: 'CppMethodOrFunctionDecl: libcpp_vector[Templated[X]] reverse (['libcpp_vector[Templated[X]] & v'])'
INFO     autowrap:DeclResolver.py:578 resolve method decl: 'CppMethodOrFunctionDecl: int getTwice (['Templated[X] '])'
INFO     autowrap:DeclResolver.py:578 resolve method decl: 'CppMethodOrFunctionDecl: Templated[X] passs (['Templated[X] v'])'
INFO     autowrap:DeclResolver.py:578 resolve method decl: 'CppMethodOrFunctionDecl: bool operator== (['Templated[X] other'])'
INFO     autowrap:DeclResolver.py:578 resolve method decl: 'CppMethodOrFunctionDecl: int computeSeven ([])'
INFO     autowrap:DeclResolver.py:526 resolve class decl Y
INFO     autowrap:DeclResolver.py:568 resolve method decl: 'CppMethodOrFunctionDecl: void Y ([])'
INFO     autowrap:DeclResolver.py:578 resolve method decl: 'CppMethodOrFunctionDecl: libcpp_vector[Templated[T]] passs (['libcpp_vector[Templated[T]] v'])'
_______________________ test_automatic_string_conversion _______________________

    def test_automatic_string_conversion():
        target = os.path.join(test_files, "libcpp_utf8_string_test.pyx")
        include_dirs = autowrap.parse_and_generate_code(["libcpp_utf8_string_test.pxd"],
                                                        root=test_files, target=target,  debug=True)
    
>       wrapped = autowrap.Utils.compile_and_import("libcpp_utf8_string_wrapped", [target, ],
                                                    include_dirs)

/builddir/build/BUILD/autowrap-0.22.7/autowrap-release-0.22.7/tests/test_code_generator.py:239: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

name = 'libcpp_utf8_string_wrapped'
source_files = ['libcpp_utf8_string_test.pyx']
include_dirs = ['/builddir/build/BUILD/autowrap-0.22.7/autowrap-release-0.22.7/autowrap/data_files/boost', '/builddir/build/BUILD/aut...0.22.7/autowrap/data_files/autowrap', '/builddir/build/BUILD/autowrap-0.22.7/autowrap-release-0.22.7/tests/test_files']
kws = {}, debug = None
shutil = <module 'shutil' from '/usr/lib64/python3.11/shutil.py'>
tempfile = <module 'tempfile' from '/usr/lib64/python3.11/tempfile.py'>
subprocess = <module 'subprocess' from '/usr/lib64/python3.11/subprocess.py'>
sys = <module 'sys' (built-in)>, tempdir = '/tmp/tmp1z5m6ccn'
source_file = '/builddir/build/BUILD/autowrap-0.22.7/autowrap-release-0.22.7/tests/test_files/libcpp_utf8_string_test.pyx'

    def compile_and_import(name, source_files, include_dirs=None, **kws):
    
        if include_dirs is None:
            include_dirs = []
    
        debug = kws.get("debug")
        import os.path
        import shutil
        import tempfile
        import subprocess
        import sys
    
        tempdir = tempfile.mkdtemp()
        if debug:
            print("\n")
            print("tempdir=", tempdir)
            print("\n")
        for source_file in source_files:
            if source_file[-4:] != ".pyx" and source_file[-4:] != ".cpp":
                raise NameError("Expected pyx and/or cpp files as source files for compilation.")
            shutil.copy(source_file, tempdir)
            stub = source_file[:-4]+".pyi"
            if os.path.exists(stub):
                shutil.copy(stub, os.path.join(tempdir, name+".pyi"))
    
        compile_args = []
        link_args = []
    
        if sys.platform == "darwin":
            compile_args += ["-stdlib=libc++","-std=c++11"]
            link_args += ["-stdlib=libc++"]
    
        if sys.platform == "linux" or sys.platform == "linux2":
            compile_args += ["-std=c++11"]
    
        if sys.platform != "win32":
            compile_args += ["-Wno-unused-but-set-variable"]
    
        include_dirs = [os.path.abspath(d) for d in include_dirs]
        source_files = [os.path.basename(f) for f in source_files]
        setup_code = template % locals()
        if debug:
            print("\n")
            print("-" * 70)
            print(setup_code)
            print("-" * 70)
            print("\n")
    
        now = os.getcwd()
        os.chdir(tempdir)
        with open("setup.py", "w") as fp:
            fp.write(setup_code)
    
        # module folder needs to have a py.typed file to recognize type stubs
        open("py.typed", 'a').close()
    
        import sys
        sys.path.insert(0, tempdir)
        if debug:
            print("\n")
            print("-" * 70)
            import pprint
            pprint.pprint(sys.path)
            print("-" * 70)
            print("\n")
    
>       assert subprocess.Popen("%s setup.py build_ext --force --inplace" % sys.executable, shell=True).wait() == 0
E       AssertionError

/builddir/build/BUILD/autowrap-0.22.7/autowrap-release-0.22.7/autowrap/Utils.py:131: AssertionError
----------------------------- Captured stdout call -----------------------------
Autowrap will start to parse and generate code. Will parse 1 files
Done parsing the files, will generate the code...
PXD (will not be written):
#Generated with autowrap 0.22.7 and Cython (Parser) 0.29.28
#cython: c_string_encoding=ascii
#cython: embedsignature=False
from  enum             import Enum as _PyEnum
from  libcpp.string   cimport string as libcpp_string
from  libcpp.string   cimport string as libcpp_utf8_string
from  libcpp.string   cimport string as libcpp_utf8_output_string
from  libcpp.set      cimport set as libcpp_set
from  libcpp.vector   cimport vector as libcpp_vector
from  libcpp.pair     cimport pair as libcpp_pair
from  libcpp.map      cimport map  as libcpp_map
from  libcpp          cimport bool
from  libc.string     cimport const_char
from  cython.operator cimport dereference as deref, preincrement as inc, address as address
from  AutowrapRefHolder      cimport AutowrapRefHolder
from  AutowrapPtrHolder      cimport AutowrapPtrHolder
from  AutowrapConstPtrHolder cimport AutowrapConstPtrHolder
from  smart_ptr       cimport shared_ptr
from libcpp_utf8_string_test cimport Hello as _Hello

cdef extern from "autowrap_tools.hpp":
    char * _cast_const_away(char *) 
 

PYX:
#Generated with autowrap 0.22.7 and Cython (Parser) 0.29.28
#cython: c_string_encoding=ascii
#cython: embedsignature=False
from  enum             import Enum as _PyEnum
from  libcpp.string   cimport string as libcpp_string
from  libcpp.string   cimport string as libcpp_utf8_string
from  libcpp.string   cimport string as libcpp_utf8_output_string
from  libcpp.set      cimport set as libcpp_set
from  libcpp.vector   cimport vector as libcpp_vector
from  libcpp.pair     cimport pair as libcpp_pair
from  libcpp.map      cimport map  as libcpp_map
from  libcpp          cimport bool
from  libc.string     cimport const_char
from  cython.operator cimport dereference as deref, preincrement as inc, address as address
from  AutowrapRefHolder      cimport AutowrapRefHolder
from  AutowrapPtrHolder      cimport AutowrapPtrHolder
from  AutowrapConstPtrHolder cimport AutowrapConstPtrHolder
from  smart_ptr       cimport shared_ptr
from libcpp_utf8_string_test cimport Hello as _Hello

cdef extern from "autowrap_tools.hpp":
    char * _cast_const_away(char *) 

cdef class Hello:
    """
    Cython implementation of _Hello
    """

    cdef shared_ptr[_Hello] inst

    def __dealloc__(self):
         self.inst.reset()

    
    def __init__(self):
        """Cython signature: void Hello()"""
        self.inst = shared_ptr[_Hello](new _Hello())
    
    def get(self,  in_0 ):
        """Cython signature: libcpp_string get(libcpp_utf8_string)"""
        assert isinstance(in_0, (bytes, unicode)), 'arg in_0 wrong type'
        if isinstance(in_0, unicode):
            in_0 = in_0.encode('utf-8')
        cdef libcpp_string _r = self.inst.get().get((<libcpp_string>in_0))
        py_result = <libcpp_string>_r
        return py_result
    
    def get_more(self, dict in_0 ):
        """Cython signature: libcpp_string get_more(libcpp_map[libcpp_utf8_string,libcpp_utf8_string])"""
        assert isinstance(in_0, dict) and all(isinstance(k, (bytes, unicode)) for k in in_0.keys()) and all(isinstance(v, (bytes, unicode)) for v in in_0.values()), 'arg in_0 wrong type'
        cdef libcpp_map[libcpp_utf8_string, libcpp_utf8_string] * v0 = new libcpp_map[libcpp_utf8_string, libcpp_utf8_string]()
        for key, value in in_0.items():
            if isinstance(key, unicode):
                key = key.encode('utf-8')
            if isinstance(value, unicode):
                value = value.encode('utf-8')
            deref(v0)[ (<libcpp_string>key) ] = (<libcpp_string>value)
        
        
        cdef libcpp_string _r = self.inst.get().get_more(deref(v0))
        del v0
        py_result = <libcpp_string>_r
        return py_result 

Autowrap has wrapped 1 classes, 3 methods and 0 enums
running build_ext
cythoning libcpp_utf8_string_test.pyx to libcpp_utf8_string_test.cpp
building 'libcpp_utf8_string_wrapped' extension
creating build
creating build/temp.linux-x86_64-3.11
gcc -Wsign-compare -DDYNAMIC_ANNOTATIONS_ENABLED=1 -DNDEBUG -O2 -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -O2 -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -O2 -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -I/usr/include/boost -fPIC -I/builddir/build/BUILD/autowrap-0.22.7/autowrap-release-0.22.7/autowrap/data_files/boost -I/builddir/build/BUILD/autowrap-0.22.7/autowrap-release-0.22.7/autowrap/data_files -I/builddir/build/BUILD/autowrap-0.22.7/autowrap-release-0.22.7/autowrap/data_files/autowrap -I/builddir/build/BUILD/autowrap-0.22.7/autowrap-release-0.22.7/tests/test_files -I/usr/include/python3.11 -c libcpp_utf8_string_test.cpp -o build/temp.linux-x86_64-3.11/libcpp_utf8_string_test.o -std=c++11 -Wno-unused-but-set-variable
----------------------------- Captured stderr call -----------------------------
WARNING: '.' not a valid package name; please use only .-separated package names in setup.py
/usr/lib64/python3.11/site-packages/Cython/Compiler/Main.py:369: FutureWarning: Cython directive 'language_level' not set, using 2 for now (Py2). This will change in a later release! File: /tmp/tmp1z5m6ccn/libcpp_utf8_string_test.pyx
  tree = Parsing.p_module(s, pxd, full_module_name)
libcpp_utf8_string_test.cpp: In function ‘PyObject* __Pyx_Coroutine_SendEx(__pyx_CoroutineObject*, PyObject*, int)’:
libcpp_utf8_string_test.cpp:6267:42: error: cannot convert ‘PyObject*’ {aka ‘_object*’} to ‘PyTracebackObject*’ {aka ‘_traceback*’} in assignment
 6267 |         tb = __Pyx__ExceptionGetTraceback(exc_state->exc_value);
      |              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
      |                                          |
      |                                          PyObject* {aka _object*}
error: command '/usr/bin/gcc' failed with exit code 1
------------------------------ Captured log call -------------------------------
Level 25 autowrap:DeclResolver.py:238 parsing progress 0 out of 1
INFO     autowrap:DeclResolver.py:292 start resolving decls
INFO     autowrap:DeclResolver.py:398 resolve_inheritance for Hello
INFO     autowrap:DeclResolver.py:526 resolve class decl Hello
INFO     autowrap:DeclResolver.py:568 resolve method decl: 'CppMethodOrFunctionDecl: void Hello ([])'
INFO     autowrap:DeclResolver.py:578 resolve method decl: 'CppMethodOrFunctionDecl: libcpp_string get (['libcpp_utf8_string '])'
INFO     autowrap:DeclResolver.py:578 resolve method decl: 'CppMethodOrFunctionDecl: libcpp_string get_more (['libcpp_map[libcpp_utf8_string,libcpp_utf8_string] '])'
_________________________________ test_libcpp __________________________________

    def test_libcpp():
        target = os.path.join(test_files, "libcpp_test.pyx")
    
        include_dirs = autowrap.parse_and_generate_code(["libcpp_test.pxd"],
                                                        root=test_files, target=target,  debug=True)
    
>       libcpp = autowrap.Utils.compile_and_import("libcpp", [target, ], include_dirs)

/builddir/build/BUILD/autowrap-0.22.7/autowrap-release-0.22.7/tests/test_code_generator_libcpp.py:101: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

name = 'libcpp', source_files = ['libcpp_test.pyx']
include_dirs = ['/builddir/build/BUILD/autowrap-0.22.7/autowrap-release-0.22.7/autowrap/data_files/boost', '/builddir/build/BUILD/aut...0.22.7/autowrap/data_files/autowrap', '/builddir/build/BUILD/autowrap-0.22.7/autowrap-release-0.22.7/tests/test_files']
kws = {}, debug = None
shutil = <module 'shutil' from '/usr/lib64/python3.11/shutil.py'>
tempfile = <module 'tempfile' from '/usr/lib64/python3.11/tempfile.py'>
subprocess = <module 'subprocess' from '/usr/lib64/python3.11/subprocess.py'>
sys = <module 'sys' (built-in)>, tempdir = '/tmp/tmpd1sevans'
source_file = '/builddir/build/BUILD/autowrap-0.22.7/autowrap-release-0.22.7/tests/test_files/libcpp_test.pyx'

    def compile_and_import(name, source_files, include_dirs=None, **kws):
    
        if include_dirs is None:
            include_dirs = []
    
        debug = kws.get("debug")
        import os.path
        import shutil
        import tempfile
        import subprocess
        import sys
    
        tempdir = tempfile.mkdtemp()
        if debug:
            print("\n")
            print("tempdir=", tempdir)
            print("\n")
        for source_file in source_files:
            if source_file[-4:] != ".pyx" and source_file[-4:] != ".cpp":
                raise NameError("Expected pyx and/or cpp files as source files for compilation.")
            shutil.copy(source_file, tempdir)
            stub = source_file[:-4]+".pyi"
            if os.path.exists(stub):
                shutil.copy(stub, os.path.join(tempdir, name+".pyi"))
    
        compile_args = []
        link_args = []
    
        if sys.platform == "darwin":
            compile_args += ["-stdlib=libc++","-std=c++11"]
            link_args += ["-stdlib=libc++"]
    
        if sys.platform == "linux" or sys.platform == "linux2":
            compile_args += ["-std=c++11"]
    
        if sys.platform != "win32":
            compile_args += ["-Wno-unused-but-set-variable"]
    
        include_dirs = [os.path.abspath(d) for d in include_dirs]
        source_files = [os.path.basename(f) for f in source_files]
        setup_code = template % locals()
        if debug:
            print("\n")
            print("-" * 70)
            print(setup_code)
            print("-" * 70)
            print("\n")
    
        now = os.getcwd()
        os.chdir(tempdir)
        with open("setup.py", "w") as fp:
            fp.write(setup_code)
    
        # module folder needs to have a py.typed file to recognize type stubs
        open("py.typed", 'a').close()
    
        import sys
        sys.path.insert(0, tempdir)
        if debug:
            print("\n")
            print("-" * 70)
            import pprint
            pprint.pprint(sys.path)
            print("-" * 70)
            print("\n")
    
>       assert subprocess.Popen("%s setup.py build_ext --force --inplace" % sys.executable, shell=True).wait() == 0
E       AssertionError

/builddir/build/BUILD/autowrap-0.22.7/autowrap-release-0.22.7/autowrap/Utils.py:131: AssertionError
----------------------------- Captured stdout call -----------------------------
Autowrap will start to parse and generate code. Will parse 1 files
Done parsing the files, will generate the code...
PXD (will not be written):
#Generated with autowrap 0.22.7 and Cython (Parser) 0.29.28
#cython: c_string_encoding=ascii
#cython: embedsignature=False
from  enum             import Enum as _PyEnum
from  libcpp.string   cimport string as libcpp_string
from  libcpp.string   cimport string as libcpp_utf8_string
from  libcpp.string   cimport string as libcpp_utf8_output_string
from  libcpp.set      cimport set as libcpp_set
from  libcpp.vector   cimport vector as libcpp_vector
from  libcpp.pair     cimport pair as libcpp_pair
from  libcpp.map      cimport map  as libcpp_map
from  libcpp          cimport bool
from  libc.string     cimport const_char
from  cython.operator cimport dereference as deref, preincrement as inc, address as address
from  AutowrapRefHolder      cimport AutowrapRefHolder
from  AutowrapPtrHolder      cimport AutowrapPtrHolder
from  AutowrapConstPtrHolder cimport AutowrapConstPtrHolder
from  smart_ptr       cimport shared_ptr
from libcpp_test cimport EEE as _EEE
from libcpp_test cimport ABS_Impl1 as _ABS_Impl1
from libcpp_test cimport ABS_Impl2 as _ABS_Impl2
from libcpp_test cimport AbstractBaseClass as _AbstractBaseClass
from libcpp_test cimport Int as _Int
from libcpp_test cimport LibCppTest as _LibCppTest

The PyFrameObject structure members have been removed from the public C API.

While the documentation notes that the PyFrameObject fields are subject to change at any time, they have been stable for a long time and were used in several popular extensions.

In Python 3.11, the frame struct was reorganized to allow performance optimizations. Some fields were removed entirely, as they were details of the old implementation.

PyFrameObject fields:
    f_back: use PyFrame_GetBack().
    f_blockstack: removed.
    f_builtins: use PyFrame_GetBuiltins().
    f_code: use PyFrame_GetCode().
    f_gen: use PyFrame_GetGenerator().
    f_globals: use PyFrame_GetGlobals().
    f_iblock: removed.
    f_lasti: use PyFrame_GetLasti(). Code using f_lasti with PyCode_Addr2Line() should use PyFrame_GetLineNumber() instead; it may be faster.
    f_lineno: use PyFrame_GetLineNumber()
    f_locals: use PyFrame_GetLocals().
    f_stackdepth: removed.
    f_state: no public API (renamed to f_frame.f_state).
    f_trace: no public API.
    f_trace_lines: use PyObject_GetAttrString((PyObject*)frame, "f_trace_lines").
    f_trace_opcodes: use PyObject_GetAttrString((PyObject*)frame, "f_trace_opcodes").
    f_localsplus: no public API (renamed to f_frame.localsplus).
    f_valuestack: removed.

The Python frame object is now created lazily. A side effect is that the f_back member must not be accessed directly, since its value is now also computed lazily. The PyFrame_GetBack() function must be called instead.

Debuggers that accessed the f_locals directly must call PyFrame_GetLocals() instead. They no longer need to call PyFrame_FastToLocalsWithError() or PyFrame_LocalsToFast(), in fact they should not call those functions. The necessary updating of the frame is now managed by the virtual machine.
 

https://docs.python.org/3.11/whatsnew/3.11.html

For the build logs, see:
https://copr-be.cloud.fedoraproject.org/results/@python/python3.11/fedora-rawhide-x86_64/04220911-autowrap/

For all our attempts to build autowrap with Python 3.11, see:
https://copr.fedorainfracloud.org/coprs/g/python/python3.11/package/autowrap/

Testing and mass rebuild of packages is happening in copr. You can follow these instructions to test locally in mock if your package builds with Python 3.11:
https://copr.fedorainfracloud.org/coprs/g/python/python3.11/

Let us know here if you have any questions.

Python 3.11 is planned to be included in Fedora 37. To make that update smoother, we're building Fedora packages with all pre-releases of Python 3.11.
A build failure prevents us from testing all dependent packages (transitive [Build]Requires), so if this package is required a lot, it's important for us to get it fixed soon.
We'd appreciate help from the people who know this package best, but if you don't want to work on this now, let us know so we can try to work around it on our side.

Comment 1 Miro Hrončok 2022-06-22 11:49:14 UTC
Closing this in bulk as it built with Python 3.11. If this needs to remain open for a followup, feel free to reopen, I won't close in bulk again.


Note You need to log in before you can comment on or make changes to this bug.