Fix Windows build issues.
This commit is contained in:
parent
ecae1373aa
commit
27d5fe3331
@ -1792,6 +1792,8 @@ init_cbson(void)
|
||||
#endif
|
||||
{
|
||||
PyObject *m;
|
||||
PyObject *c_api_object;
|
||||
static void *_cbson_API[_cbson_API_POINTER_COUNT];
|
||||
|
||||
#if PY_MAJOR_VERSION >= 3
|
||||
m = PyModule_Create(&moduledef);
|
||||
@ -1815,7 +1817,6 @@ init_cbson(void)
|
||||
}
|
||||
|
||||
/* Export C API */
|
||||
static void *_cbson_API[_cbson_API_POINTER_COUNT];
|
||||
_cbson_API[_cbson_buffer_write_bytes_INDEX] = (void *) buffer_write_bytes;
|
||||
_cbson_API[_cbson_write_dict_INDEX] = (void *) write_dict;
|
||||
_cbson_API[_cbson_write_pair_INDEX] = (void *) write_pair;
|
||||
@ -1823,9 +1824,9 @@ init_cbson(void)
|
||||
|
||||
#if PY_VERSION_HEX >= 0x03010000
|
||||
/* PyCapsule is new in python 3.1 */
|
||||
PyObject *c_api_object = PyCapsule_New((void *) _cbson_API, "_cbson._C_API", NULL);
|
||||
c_api_object = PyCapsule_New((void *) _cbson_API, "_cbson._C_API", NULL);
|
||||
#else
|
||||
PyObject *c_api_object = PyCObject_FromVoidPtr((void *) _cbson_API, NULL);
|
||||
c_api_object = PyCObject_FromVoidPtr((void *) _cbson_API, NULL);
|
||||
#endif
|
||||
|
||||
if (c_api_object != NULL) {
|
||||
|
||||
@ -531,6 +531,8 @@ init_cmessage(void)
|
||||
#endif
|
||||
{
|
||||
PyObject *m;
|
||||
PyObject *c_api_object;
|
||||
struct module_state *state;
|
||||
|
||||
#if PY_MAJOR_VERSION >= 3
|
||||
m = PyModule_Create(&moduledef);
|
||||
@ -541,7 +543,7 @@ init_cmessage(void)
|
||||
INITERROR;
|
||||
}
|
||||
|
||||
struct module_state *state = GETSTATE(m);
|
||||
state = GETSTATE(m);
|
||||
|
||||
/* Store a reference to the _cbson module since it's needed to call some
|
||||
* of its functions
|
||||
@ -555,7 +557,7 @@ init_cmessage(void)
|
||||
/* Import C API of _cbson
|
||||
* The header file accesses _cbson_API to call the functions
|
||||
*/
|
||||
PyObject *c_api_object = PyObject_GetAttrString(state->_cbson, "_C_API");
|
||||
c_api_object = PyObject_GetAttrString(state->_cbson, "_C_API");
|
||||
if (c_api_object == NULL) {
|
||||
Py_DECREF(m);
|
||||
Py_DECREF(state->_cbson);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user