[C++-sig] [Py++] RuntimeError: Py++ is going to write different content to the same file (original) (raw)

Razvan Yorik razvan_76 at ymail.com
Fri Aug 7 11:27:49 CEST 2009


Hello, I have a problem wrapping the following header file using Py++. The class "Derived" defines a local typedef "Helper" which has different meanings for each template parameter "T".

Wrapped header: ---------- test.h ---------- #ifndef TEST_H #define TEST_H

template class Base{ public: };

template class Derived: public Base{ public: typedef Base Helper; };

#ifdef GCCXML void instantiate(){ sizeof(Base); sizeof(Base); sizeof(Derived); sizeof(Derived); } #endif

#endif ---------- end of test.h ----------

This leads to the error (full output log at the end of this email):

RuntimeError: Py++ is going to write different content to the same file(split/Helper.pypp.hpp). The following is a short list of possible explanations for this behaviour:

I tried to rename or exclude the "Helper" class from the wrapper, but the problem is, that it is not even in mb.classes():

print [c.name for c in mb.classes()] ['Derived', 'Derived', 'Base', 'Base']

Is there a possibility to

I hope someone can suggest a solution or a workaround. Thank you Razvan

Code generator: ---------- generate_code.py ---------- import os from pyplusplus import module_builder from pyplusplus.decl_wrappers import call_policies from pygccxml.declarations.matchers import access_type_matcher_t from pyplusplus import function_transformers as FT

files=['test.H']

mb = module_builder.module_builder_t( files=files, define_symbols=[], include_paths=[] ) mb.build_code_creator( module_name='pytest' ) mb.code_creator.user_defined_directories.append( os.path.abspath('.') ) mb.split_module("split") mb.write_module( os.path.join( os.path.abspath('.'), 'generated.cpp' ) ) ---------- end of generate_code.py ----------

---------- complete ouput ---------- $ python generate_code.py INFO Parsing source file "test.H" ... INFO gccxml cmd: /usr/local/bin/gccxml -I"." "test.H" -fxml="/tmp/tmpM2O_z-.xml" INFO GCCXML version - 0.9( 1.128 )

WARNING: Base [class]

warning W1047: There are two or more classes that use same alias("Helper"). Duplicated aliases causes few problems, but the main one is that some of the classes will not be exposed to Python.Other classes : Base [class]

WARNING: Base [class]

warning W1047: There are two or more classes that use same alias("Helper"). Duplicated aliases causes few problems, but the main one is that some of the classes will not be exposed to Python.Other classes : Base [class] Traceback (most recent call last): File "generate_code.py", line 20, in mb.split_module("split") File "/usr/lib/python2.5/site-packages/pyplusplus/module_builder/boost_python_builder.py", line 373, in split_module , encoding=self.encoding) File "/usr/lib/python2.5/site-packages/pyplusplus/file_writers/init.py", line 37, in write_multiple_files mfs.write() File "/usr/lib/python2.5/site-packages/pyplusplus/file_writers/multiple_files.py", line 406, in write self.split_classes() File "/usr/lib/python2.5/site-packages/pyplusplus/file_writers/multiple_files.py", line 307, in split_classes map( self.split_class, class_creators ) File "/usr/lib/python2.5/site-packages/pyplusplus/file_writers/multiple_files.py", line 294, in split_class self.split_class_impl( class_creator ) File "/usr/lib/python2.5/site-packages/pyplusplus/file_writers/multiple_files.py", line 268, in split_class_impl , self.create_function_code( function_name ) ) ) File "/usr/lib/python2.5/site-packages/pyplusplus/file_writers/multiple_files.py", line 58, in write_file raise RuntimeError( os.linesep.join(msg) ) RuntimeError: Py++ is going to write different content to the same file(split/Helper.pypp.hpp). The following is a short list of possible explanations for this behaviour:



More information about the Cplusplus-sig mailing list