I have downloaded the Python 2.7.1 source code, after extraction issued this command:
D:\sources\Python-2.7.1>gcc -c -I.\Include -I.\PC -I.\Python .\Python\Python-ast.c
.\Python\Python-ast.c:464: error: initializer element is not constant
.\Python\Python-ast.c:464: error: (near initialization for 'AST_type.ob_type')
The code in question:
static PyTypeObject AST_type = {
PyVarObject_HEAD_INIT(&PyType_Type, 0) //this is line 464
"_ast.AST",
sizeof(PyObject),
0,
0, /* tp_dealloc */
0, /* tp_print */
0, /* tp_getattr */
0, /* tp_setattr */
0, /* tp_compare */
0, /* tp_repr */
0, /* tp_as_number */
0, /* tp_as_sequence */
0, /* tp_as_mapping */
0, /* tp_hash */
0, /* tp_call */
0, /* tp_str */
PyObject_GenericGetAttr, /* tp_getattro */
PyObject_GenericSetAttr, /* tp_setattro */
0, /* tp_as_buffer */
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */
0, /* tp_doc */
0, /* tp_traverse */
0, /* tp_clear */
0, /* tp_richcompare */
0, /* tp_weaklistoffset */
0, /* tp_iter */
0, /* tp_iternext */
ast_type_methods, /* tp_methods */
0, /* tp_members */
0, /* tp_getset */
0, /* tp_base */
0, /* tp_dict */
0, /* tp_descr_get */
0, /* tp_descr_set */
0, /* tp_dictoffset */
(initproc)ast_type_init, /* tp_init */
PyType_GenericAlloc, /* tp_alloc */
PyType_GenericNew, /* tp_new */
PyObject_Del, /* tp_free */
};
I am using TDM GCC:
gcc version 4.4.1 (TDM-1 mingw32)
The specified directories contain all the includes needed. Why is this happening? The code in Python-ast.c seems like standard C.
Thanks for the help