[Csv] non-portable initialisation of types in _csv.c
John Machin
sjmachin at lexicon.net
Thu Feb 13 23:33:22 CET 2003
On Thu, 13 Feb 2003 08:58:18 -0600, Skip Montanaro <skip at pobox.com> wrote:
>
> John> static PyTypeObject Dialect_Type = {
> John> /* aarrgghh PyObject_HEAD_INIT(&PyType_Type) */
> John> PyObject_HEAD_INIT(NULL)
> John> 0, /* ob_size */
>
> John,
>
> Thanks, is this a Windows thing? >
> What about the head initializer for the
> Reader_Type and Writer_Type types?
My understanding is this:
The offending code is strictly not correct C -- the initialiser is not a
constant; it's the address of a gadget not declared in the current source
file. However some compiler/linker combinations can nut it out. Some
compilers take advantage of this; some can't or won't; Windows compilers
seem to be in the can't or won't category.
> What about the head initializer for the
> Reader_Type and Writer_Type types?
Skip, what's sauce for the first goose is also sauce for the second and
subsequent geese. You seem to have sauced all 3 birds in rev 1.30.
I notice that it seems to work without the "FooType.ob_type =
&PyType_Type;" incantation in the module initialisation. Perhaps
PyType_Ready() fixes this up.
Cheers,
John
--
More information about the Csv
mailing list