[Python-3000] Persistent Error

Amaury Forgeot d'Arc amauryfa at gmail.com
Fri Jun 6 13:35:06 CEST 2008


Anand Balachandran Pillai wrote:
> Hi Amaury,
>
>  This is the entry for _warnings.
>
>   /* This lives in _warnings.c */
>    {"_warnings", _PyWarnings_Init},

Did you find this in Modules/config.c?

>  Btw, you said _warnings is not designed to be a .so module. So what type of
> module is _warnings ?

It's a built-in module.

A module is said "built-in" if its initialization function is linked
inside the main program.
When you "import _warnings", python looks inside the list defined in
config.c, and runs the _PyWarnings_Init function it found there.

An extension module resides in a .so, which name is also the name of the module.
Its initialization function must be of the form "init%s"
It's not the case for _warnings. You would have to rename
_PyWarnings_Init to init_warnings...

-- 
Amaury Forgeot d'Arc


More information about the Python-3000 mailing list