diff options
Diffstat (limited to 'python/google')
-rw-r--r-- | python/google/protobuf/pyext/message_module.cc | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/python/google/protobuf/pyext/message_module.cc b/python/google/protobuf/pyext/message_module.cc index f5c8f295..8c933866 100644 --- a/python/google/protobuf/pyext/message_module.cc +++ b/python/google/protobuf/pyext/message_module.cc @@ -130,6 +130,15 @@ extern "C" { Py_DECREF(m); return INITFUNC_ERRORVAL; } + + // Adds the C++ API + if (PyObject* api = + PyCapsule_New(new ApiImplementation(), + google::protobuf::python::PyProtoAPICapsuleName(), NULL)) { + PyModule_AddObject(m, "proto_API", api); + } else { + return INITFUNC_ERRORVAL; + } #if PY_MAJOR_VERSION >= 3 return m; |