Changeset 578


Ignore:
Timestamp:
Nov 21, 2015, 2:48:11 PM (4 years ago)
Author:
cito
Message:

Finalize defined types during the initialization

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/module/pgmodule.c

    r577 r578  
    42234223        mod = PyModule_Create(&moduleDef);
    42244224
    4225 #if !IS_PY3
    4226         /* TODO: Check whether this is still necessary, and also needed in Py 3. */
    42274225        /* Initialize here because some Windows platforms get confused otherwise */
     4226#if IS_PY3
     4227        connType.tp_base = noticeType.tp_base =
     4228                queryType.tp_base = sourceType.tp_base = &PyBaseObject_Type;
     4229#ifdef LARGE_OBJECTS
     4230        largeType.tp_base = &PyBaseObject_Type;
     4231#endif
     4232#else
    42284233        connType.ob_type = noticeType.ob_type =
    42294234                queryType.ob_type = sourceType.ob_type = &PyType_Type;
    4230 
    42314235#ifdef LARGE_OBJECTS
    42324236        largeType.ob_type = &PyType_Type;
    42334237#endif
    42344238#endif
     4239
     4240        if (PyType_Ready(&connType) ||
     4241                PyType_Ready(&noticeType) ||
     4242                PyType_Ready(&queryType) ||
     4243                PyType_Ready(&sourceType)) return NULL;
    42354244
    42364245        dict = PyModule_GetDict(mod);
Note: See TracChangeset for help on using the changeset viewer.