[Python-Dev] initializing ob_type (was: CVS: python/dist/src/Modules _cursesmodule.c,2.46,2.47)

Greg Stein gstein@lyra.org
Fri, 19 Jan 2001 00:38:54 -0800


On Thu, Jan 18, 2001 at 04:28:10PM -0800, Guido van Rossum wrote:
>...
>   PyTypeObject PyCursesWindow_Type = {
> ! 	PyObject_HEAD_INIT(NULL)
>   	0,			/*ob_size*/
>   	"curses window",	/*tp_name*/
>...
> --- 2432,2443 ----
>   /* Initialization function for the module */
>   
> ! DL_EXPORT(void)
>   init_curses(void)
>   {
>   	PyObject *m, *d, *v, *c_api_object;
>   	static void *PyCurses_API[PyCurses_API_pointers];
> + 
> + 	/* Initialize object type */
> + 	PyCursesWindow_Type.ob_type = &PyType_Type;
>   
>   	/* Initialize the C API pointer array */


I've never truly understood this. Is it because Windows cannot initialize
(at load-time) a pointer to a data structure that is located in a different
DLL?

It is a bit painful to keep moving inits from load-time to run-time.

Cheers,
-g

-- 
Greg Stein, http://www.lyra.org/