|
Re: Circular cimports: msg#00020python.pyrex
Mike Wyatt wrote: > In C/C++, I believe this problem would be solved like this: > > ***matrix.h*** > #ifndef MATRIX_H > #define MATRIX_H The cause of the problem is different in Pyrex, though. It's already smart enough not to read the same .pxd file twice, so an ifdef wouldn't help. I think the problem is that it generates code to import all of the extension types referenced by a particular module before doing anything else, including creation of the type objects defined in that module. So with circular imports it ends up trying to import a type object that hasn't been created yet. Thinking about this in the shower yesterday, I decided that this can probably be fixed by only importing the types used as base classes of a type defined in the module first, then creating the types, and then doing any other imports. That will require a compiler change, however. In the meantime, the only workaround I can think of is to define all the mutually-referencing extension types in the same module (you can use the include statement to split it into multiple files if you want). -- Greg |
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | Re: Circular cimports: 00020, Lenard Lindstrom |
|---|---|
| Next by Date: | cimport across directories: 00020, Martin Albrecht |
| Previous by Thread: | Re: Circular cimportsi: 00020, Lenard Lindstrom |
| Next by Thread: | cimport across directories: 00020, Martin Albrecht |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | Mail Home | sitemap | FAQ | advertise |