52 #ifdef PYTHON_PROTO2_CPP_IMPL_V1
53 #error "PYTHON_PROTO2_CPP_IMPL_V1 is no longer supported."
55 #ifdef PYTHON_PROTO2_CPP_IMPL_V2
58 #ifdef PYTHON_PROTO2_PYTHON_IMPL
64 #endif // PYTHON_PROTO2_PYTHON_IMPL
65 #endif // PYTHON_PROTO2_CPP_IMPL_V2
66 #endif // PYTHON_PROTO2_CPP_IMPL_V1
72 "_api_implementation is a module that exposes compile-time constants that\n"
73 "determine the default API implementation to use for Python proto2.\n"
75 "It complements api_implementation.py by setting defaults using "
77 "constants defined in C, such that one can set defaults at compilation\n"
78 "(e.g. with blaze flag --copt=-DPYTHON_PROTO2_CPP_IMPL_V2).";
80 #if PY_MAJOR_VERSION >= 3
81 static struct PyModuleDef _module = {PyModuleDef_HEAD_INIT,
90 #define INITFUNC PyInit__api_implementation
91 #define INITFUNC_ERRORVAL NULL
93 #define INITFUNC init_api_implementation
94 #define INITFUNC_ERRORVAL
99 #if PY_MAJOR_VERSION >= 3
100 PyObject* module = PyModule_Create(&_module);
102 PyObject* module = Py_InitModule3(
const_cast<char*
>(
kModuleName),
NULL,
105 if (module ==
NULL) {
112 #if PY_MAJOR_VERSION < 3