aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Thomas Colthurst <thomaswc@gmail.com>2018-07-03 16:52:27 -0400
committerGravatar Jie Luo <anandolee@gmail.com>2018-07-03 13:52:27 -0700
commit79700b56b99fa5c8c22ddef78e6c9557ff711379 (patch)
tree25aba7b51e40348dc25db56f8e1a32e25bcde6e8
parentc5228890381e39ffb98c8ba54a736bed382ac51d (diff)
Update message_module.cc (#4835)
* Update message_module.cc Add missing piece from pull request #4698: actually initialize the new API object. * Update message_module.cc
-rw-r--r--python/google/protobuf/pyext/message_module.cc9
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;