[Pyrex] Bug in pyrex: difference in docstring contents prevents diagnosis of undeclared name and produces bad C code

Parzival Herzog parzp at shaw.ca
Sat Oct 16 04:22:10 CEST 2004


On October 15, 2004 12:40, Parzival Herzog wrote:
> I was using pyrex
>
> [parz at lobsang src]$ pyrexc --version
> Pyrex version 0.9.3
<<big snip>>
> yet pysweph.pyx is erroneously accepted by pyrexc, and the generated code
> produces gcc diagnostics:
>
> ------------------
> [parz at lobsang src]$ pyrex pysweph.pyx
> pysweph.c:116: error: redefinition of `struct __pyx_obj_7pysweph_body'
> pysweph.c:134: error: redefinition of `struct __pyx_obj_7pysweph_houses'
> pysweph.c:157: error: redefinition of `struct
> __pyx_obj_7pysweph__houseiterator'
> pysweph.c:163: error: redefinition of `__pyx_ptype_7pysweph_body'
> pysweph.c:91: error: `__pyx_ptype_7pysweph_body' previously defined here
> pysweph.c:164: error: redefinition of `__pyx_ptype_7pysweph_houses'
> pysweph.c:92: error: `__pyx_ptype_7pysweph_houses' previously defined here
> pysweph.c:165: error: redefinition of `__pyx_ptype_7pysweph__houseiterator'
> pysweph.c:93: error: `__pyx_ptype_7pysweph__houseiterator' previously
> defined here
> ----------------
>
> while pyswephY.pyx is correctly rejected by pyrexc:
>
> -------------------
> [parz at lobsang src]$ pyrex pyswephY.pyx
> /home/parz/x-src/swe-1.66.0/src/pyswephY.pyx:102:15: Syntax error in C
> variable declaration
> -------------------

I've discovered that the problem has nothing to do with the file contents, its 
the _name_ that makes the difference! After writing my original post, I 
trashed the failing version, renamed pyswephX.pyx to pysweph.pyx, and
assumed that I could go on developing. Lo and behold, the exact problem 
re-surfaced again. I imagined I had made made some mixup in my trashings and 
renamings, and got very confused when I found that now my trashed file 
compiled, while my rebuilt file failed...

Anyhow, it then occurred to me that maybe cimporting pysweph (meaning
file pysweph.pxd,) in module pysweph.pyx could be a problem, and it was,
as I found when I renamed the cimported module.

So, I would still say this is a bug, and a nasty one at that. If the cimport 
is in error, pyrexc should say so, not produce bad code!

-- 
Parzival Herzog





More information about the Pyrex mailing list