Author: cito
Date: Sat Nov 21 14:48:11 2015
New Revision: 578

Log:
Finalize defined types during the initialization

Modified:
   trunk/module/pgmodule.c

Modified: trunk/module/pgmodule.c
==============================================================================
--- trunk/module/pgmodule.c     Sat Nov 21 14:22:07 2015        (r577)
+++ trunk/module/pgmodule.c     Sat Nov 21 14:48:11 2015        (r578)
@@ -4222,17 +4222,26 @@
 
        mod = PyModule_Create(&moduleDef);
 
-#if !IS_PY3
-       /* TODO: Check whether this is still necessary, and also needed in Py 
3. */
        /* Initialize here because some Windows platforms get confused 
otherwise */
+#if IS_PY3
+       connType.tp_base = noticeType.tp_base =
+               queryType.tp_base = sourceType.tp_base = &PyBaseObject_Type;
+#ifdef LARGE_OBJECTS
+       largeType.tp_base = &PyBaseObject_Type;
+#endif
+#else
        connType.ob_type = noticeType.ob_type =
                queryType.ob_type = sourceType.ob_type = &PyType_Type;
-
 #ifdef LARGE_OBJECTS
        largeType.ob_type = &PyType_Type;
 #endif
 #endif
 
+       if (PyType_Ready(&connType) ||
+               PyType_Ready(&noticeType) ||
+               PyType_Ready(&queryType) ||
+               PyType_Ready(&sourceType)) return NULL;
+
        dict = PyModule_GetDict(mod);
 
        /* Exceptions as defined by DB-API 2.0 */
_______________________________________________
PyGreSQL mailing list
[email protected]
https://mail.vex.net/mailman/listinfo.cgi/pygresql

Reply via email to