mirror of
https://github.com/psycopg/psycopg2.git
synced 2025-01-31 17:34:08 +03:00
Don't define a CObject API in Python 3.2
The API is not available: a PyCapsule should be used. Nobody seems needing it for now.
This commit is contained in:
parent
b8c8cddc2d
commit
9deb16484d
|
@ -760,10 +760,12 @@ static struct PyModuleDef psycopgmodule = {
|
||||||
PyMODINIT_FUNC
|
PyMODINIT_FUNC
|
||||||
INIT_MODULE(_psycopg)(void)
|
INIT_MODULE(_psycopg)(void)
|
||||||
{
|
{
|
||||||
|
#if PY_VERSION_HEX < 0x03020000
|
||||||
static void *PSYCOPG_API[PSYCOPG_API_pointers];
|
static void *PSYCOPG_API[PSYCOPG_API_pointers];
|
||||||
|
PyObject *c_api_object;
|
||||||
|
#endif
|
||||||
|
|
||||||
PyObject *module = NULL, *dict;
|
PyObject *module = NULL, *dict;
|
||||||
PyObject *c_api_object;
|
|
||||||
|
|
||||||
#ifdef PSYCOPG_DEBUG
|
#ifdef PSYCOPG_DEBUG
|
||||||
if (getenv("PSYCOPG_DEBUG"))
|
if (getenv("PSYCOPG_DEBUG"))
|
||||||
|
@ -861,9 +863,12 @@ INIT_MODULE(_psycopg)(void)
|
||||||
/* PyBoxer_API[PyBoxer_Fake_NUM] = (void *)PyBoxer_Fake; */
|
/* PyBoxer_API[PyBoxer_Fake_NUM] = (void *)PyBoxer_Fake; */
|
||||||
|
|
||||||
/* Create a CObject containing the API pointer array's address */
|
/* Create a CObject containing the API pointer array's address */
|
||||||
|
/* If anybody asks for a PyCapsule we'll deal with it. */
|
||||||
|
#if PY_VERSION_HEX < 0x03020000
|
||||||
c_api_object = PyCObject_FromVoidPtr((void *)PSYCOPG_API, NULL);
|
c_api_object = PyCObject_FromVoidPtr((void *)PSYCOPG_API, NULL);
|
||||||
if (c_api_object != NULL)
|
if (c_api_object != NULL)
|
||||||
PyModule_AddObject(module, "_C_API", c_api_object);
|
PyModule_AddObject(module, "_C_API", c_api_object);
|
||||||
|
#endif
|
||||||
|
|
||||||
/* other mixed initializations of module-level variables */
|
/* other mixed initializations of module-level variables */
|
||||||
psycoEncodings = PyDict_New();
|
psycoEncodings = PyDict_New();
|
||||||
|
|
Loading…
Reference in New Issue
Block a user