[capi-sig] Subtyping builtins in C

Campbell Barton cbarton at metavr.com
Sun Sep 9 05:33:32 CEST 2007


found the problem from re-reading pythons source.
  they have to be zero because some compilers complain,

The values need to be assigned in the module initializer before 
PyType_Ready is called,

xxsubtype.c uses a macro DEFERRED_ADDRESS so the value is documented but 
not compiled in.


Campbell Barton wrote:
> 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
> 



More information about the capi-sig mailing list