Upgrade linux protobuf
This commit is contained in:
1 parent
79f2f356d5
commit
0f3130fb47
689 files changed
+141922
-132057
No files matched your search
@@ -69,59 +69,40 @@ static const char* kImplVersionName = "api_version";
|
||||
|
||||
static const char* kModuleName = "_api_implementation";
|
||||
static const char kModuleDocstring[] =
|
||||
"_api_implementation is a module that exposes compile-time constants that\n"
|
||||
"determine the default API implementation to use for Python proto2.\n"
|
||||
"\n"
|
||||
"It complements api_implementation.py by setting defaults using compile-time\n"
|
||||
"constants defined in C, such that one can set defaults at compilation\n"
|
||||
"(e.g. with blaze flag --copt=-DPYTHON_PROTO2_CPP_IMPL_V2).";
|
||||
"_api_implementation is a module that exposes compile-time constants that\n"
|
||||
"determine the default API implementation to use for Python proto2.\n"
|
||||
"\n"
|
||||
"It complements api_implementation.py by setting defaults using "
|
||||
"compile-time\n"
|
||||
"constants defined in C, such that one can set defaults at compilation\n"
|
||||
"(e.g. with blaze flag --copt=-DPYTHON_PROTO2_CPP_IMPL_V2).";
|
||||
|
||||
#if PY_MAJOR_VERSION >= 3
|
||||
static struct PyModuleDef _module = {
|
||||
PyModuleDef_HEAD_INIT,
|
||||
kModuleName,
|
||||
kModuleDocstring,
|
||||
-1,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL
|
||||
};
|
||||
#define INITFUNC PyInit__api_implementation
|
||||
#define INITFUNC_ERRORVAL NULL
|
||||
#else
|
||||
#define INITFUNC init_api_implementation
|
||||
#define INITFUNC_ERRORVAL
|
||||
#endif
|
||||
static struct PyModuleDef _module = {PyModuleDef_HEAD_INIT,
|
||||
kModuleName,
|
||||
kModuleDocstring,
|
||||
-1,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL};
|
||||
|
||||
extern "C" {
|
||||
PyMODINIT_FUNC INITFUNC() {
|
||||
#if PY_MAJOR_VERSION >= 3
|
||||
PyObject *module = PyModule_Create(&_module);
|
||||
#else
|
||||
PyObject *module = Py_InitModule3(
|
||||
const_cast<char*>(kModuleName),
|
||||
NULL,
|
||||
const_cast<char*>(kModuleDocstring));
|
||||
#endif
|
||||
if (module == NULL) {
|
||||
return INITFUNC_ERRORVAL;
|
||||
}
|
||||
|
||||
// Adds the module variable "api_version".
|
||||
if (PyModule_AddIntConstant(
|
||||
module,
|
||||
const_cast<char*>(kImplVersionName),
|
||||
kImplVersion))
|
||||
#if PY_MAJOR_VERSION < 3
|
||||
return;
|
||||
#else
|
||||
{ Py_DECREF(module); return NULL; }
|
||||
|
||||
return module;
|
||||
#endif
|
||||
PyMODINIT_FUNC PyInit__api_implementation() {
|
||||
PyObject* module = PyModule_Create(&_module);
|
||||
if (module == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// Adds the module variable "api_version".
|
||||
if (PyModule_AddIntConstant(module, const_cast<char*>(kImplVersionName),
|
||||
kImplVersion)) {
|
||||
Py_DECREF(module);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return module;
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace python
|
||||
|
||||
Reference in new issue
Block a user