[capi-sig] Subtyping builtins in C

Campbell Barton cbarton at metavr.com
Sun Sep 9 05:11:31 CEST 2007


Hi, this compiles fine on linux but on windows with MSVC8 it gives an 
error on this line.

	&PyFloat_Type,		/* tp_base */
saying that it cant initialize because &PyFloat_Type is not a constant.

Has anyone else had this problem or know a workaround?

Heres teh pytype,
source file is here
http://projects.blender.org/plugins/scmsvn/viewcvs.php/branches/pyapi_devel/source/blender/python/api2_2x/bpy_float.c?root=bf-blender&view=markup
http://projects.blender.org/plugins/scmsvn/viewcvs.php/branches/pyapi_devel/source/blender/python/api2_2x/bpy_float.h?root=bf-blender&view=markup

PyTypeObject BPyFloat_Type = {
	PyObject_HEAD_INIT(NULL)
	0,
	"BPyFloat",
	sizeof(BPyFloatObject),
	0,
	(destructor)BPyFloat_dealloc,	/* 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 */
	0,					/* tp_getattro */
	0,					/* 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 */
	BPyFloat_methods,	/* tp_methods */
	0,					/* tp_members */
	BPyFloat_getset,	/* tp_getset */
	&PyFloat_Type,		/* tp_base */
	0,					/* tp_dict */
	0,					/* tp_descr_get */
	0,					/* tp_descr_set */
	0,					/* tp_dictoffset */
	(initproc)BPyFloat_init, /* tp_init */
	0,					/* tp_alloc */
	0,					/* tp_new */
};


More information about the capi-sig mailing list