Menu

#1012 [python] duplicate package prefix

open
nobody
python (260)
5
2023-12-17
2009-05-07
No

When called with

swig -c++ -python foo.i

on the enclosed file, swig Version 1.3.35 produces code with the wrong types
Parser::Parser::Enumerator and Parser::Parser::Token:

SWIGINTERN PyObject *_wrap_Parser_pipe(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0;
Parser::Parser *arg1 = (Parser::Parser *) 0 ;
Parser::Parser::Enumerator< Parser::Parser::Token * > *arg2 = 0 ;
Parser::Enumerator< Parser::Token * > result;

Notice that the problem disappears if method pipe() were defined to return void.

Discussion

  • Giuseppe Attardi

     
  • Olly Betts

    Olly Betts - 2011-02-19
    • summary: duplicate package prefix --> [python] duplicate package prefix
     
  • Olly Betts

    Olly Betts - 2022-01-29

    This is still reproducible with git master:

      Parser::Parser *arg1 = (Parser::Parser *) 0 ;
      Parser::Parser::Enumerator< Parser::Parser::Token * > *arg2 = 0 ;
    
     
  • Olly Betts

    Olly Betts - 2023-12-17

    Reproducible with git master 29367b31c8202c5cbe72e05927d77004636d6af9.

    Running with -debug-module 1 then -debug-module 2 it seems this happens somewhere in between those two stages:

          +++ class - 0x7f9380f74810 ----------------------------------------
          | allows_typedef - "1"
          | firstChild   - 0x7f9380f74950
          | kind         - "class"
          | lastChild    - 0x7f9380f74d70
          | module       - 0x7f9380f73b30
          | name         - "Parser::Parser"
          | parentNode   - 0x7f9380f73c50
          | previousSibling - 0x7f9380f74670
          | sym:name     - "Parser"
          | sym:overname - "__SWIG_0"
          | sym:symtab   - 0x7f9380f73d30
          | symtab       - 0x7f9380f748d0
          | typepass:visit - "1"
          | typescope    - 0x7f9380f76370
    
                +++ access - 0x7f9380f74950 ----------------------------------------
                | kind         - "public"
                | nextSibling  - 0x7f9380f74d70
                | parentNode   - 0x7f9380f74810
                | 
                +++ cdecl - 0x7f9380f74d70 ----------------------------------------
                | access       - "public"
                | decl         - "f(r.Parser::Parser::Enumerator<(p.Parser::Parser::Token)>)."
                | ismember     - "1"
                | kind         - "function"
                | name         - "pipe"
                | parentNode   - 0x7f9380f74810
                | parms        - 'Parser::Parser::Enumerator< Parser::Parser::Token * > &x'
                | previousSibling - 0x7f9380f74950
                | sym:name     - "pipe"
                | sym:overname - "__SWIG_0"
                | sym:symtab   - 0x7f9380f748d0
                | type         - "Parser::Enumerator<(p.Parser::Token)>"
                | 
    
     

Log in to post a comment.