PROTOBUF_SYNC_PIPER
pull/10388/head^2
Mike Kruskal 2 years ago
parent a8df5b7b3e
commit 68c77bab53
  1. 3
      python/google/protobuf/proto_api.h
  2. 17
      python/google/protobuf/pyext/message.cc
  3. 2
      python/google/protobuf/pyext/message.h

@ -133,8 +133,7 @@ struct PyProto_API {
};
inline const char* PyProtoAPICapsuleName() {
static const char kCapsuleName[] =
"google3.net.google.protobuf.python.internal.cpp._message.proto_API";
static const char kCapsuleName[] = "google.protobuf.pyext._message.proto_API";
return kCapsuleName;
}

@ -88,6 +88,9 @@
: 0) \
: PyBytes_AsStringAndSize(ob, (charpp), (sizep)))
#define PROTOBUF_PYTHON_PUBLIC "google.protobuf"
#define PROTOBUF_PYTHON_INTERNAL "google.protobuf.internal"
namespace google {
namespace protobuf {
namespace python {
@ -246,8 +249,8 @@ static PyObject* New(PyTypeObject* type, PyObject* args, PyObject* kwargs) {
ScopedPyObjectPtr new_args;
if (WKT_classes == nullptr) {
ScopedPyObjectPtr well_known_types(PyImport_ImportModule(
"google3.net.google.protobuf.python.internal.well_known_types"));
ScopedPyObjectPtr well_known_types(
PyImport_ImportModule(PROTOBUF_PYTHON_INTERNAL ".well_known_types"));
GOOGLE_DCHECK(well_known_types != nullptr);
WKT_classes = PyObject_GetAttrString(well_known_types.get(), "WKTBASES");
@ -2372,7 +2375,7 @@ PyObject* DeepCopy(CMessage* self, PyObject* arg) {
PyObject* ToUnicode(CMessage* self) {
// Lazy import to prevent circular dependencies
ScopedPyObjectPtr text_format(
PyImport_ImportModule("google3.net.google.protobuf.python.public.text_format"));
PyImport_ImportModule(PROTOBUF_PYTHON_PUBLIC ".text_format"));
if (text_format == nullptr) {
return nullptr;
}
@ -3034,8 +3037,8 @@ bool InitProto2MessageModule(PyObject *m) {
PyModule_AddObject(m, "MethodDescriptor",
reinterpret_cast<PyObject*>(&PyMethodDescriptor_Type));
PyObject* enum_type_wrapper = PyImport_ImportModule(
"google3.net.google.protobuf.python.internal.enum_type_wrapper");
PyObject* enum_type_wrapper =
PyImport_ImportModule(PROTOBUF_PYTHON_INTERNAL ".enum_type_wrapper");
if (enum_type_wrapper == nullptr) {
return false;
}
@ -3043,8 +3046,8 @@ bool InitProto2MessageModule(PyObject *m) {
PyObject_GetAttrString(enum_type_wrapper, "EnumTypeWrapper");
Py_DECREF(enum_type_wrapper);
PyObject* message_module = PyImport_ImportModule(
"google3.net.google.protobuf.python.public.message");
PyObject* message_module =
PyImport_ImportModule(PROTOBUF_PYTHON_PUBLIC ".message");
if (message_module == nullptr) {
return false;
}

@ -329,7 +329,7 @@ PyObject* SetAllowOversizeProtos(PyObject* m, PyObject* arg);
return err; \
}
#define FULL_MODULE_NAME "google3.net.google.protobuf.python.internal.cpp._message"
#define FULL_MODULE_NAME "google.protobuf.pyext._message"
void FormatTypeError(PyObject* arg, const char* expected_types);
template<class T>

Loading…
Cancel
Save