Преглед на файлове

Fixed Python extension compile.

Josh Haberman преди 7 години
родител
ревизия
e53be9bce4
променени са 2 файла, в които са добавени 7 реда и са изтрити 7 реда
  1. 6 6
      python/google/protobuf/pyext/message.cc
  2. 1 1
      python/google/protobuf/pyext/message_module.cc

+ 6 - 6
python/google/protobuf/pyext/message.cc

@@ -644,7 +644,7 @@ void OutOfRangeError(PyObject* arg) {
 
 template<class RangeType, class ValueType>
 bool VerifyIntegerCastAndRange(PyObject* arg, ValueType value) {
-  if (ABSL_PREDICT_FALSE(value == -1 && PyErr_Occurred())) {
+  if (PROTOBUF_PREDICT_FALSE(value == -1 && PyErr_Occurred())) {
     if (PyErr_ExceptionMatches(PyExc_OverflowError)) {
       // Replace it with the same ValueError as pure python protos instead of
       // the default one.
@@ -653,7 +653,7 @@ bool VerifyIntegerCastAndRange(PyObject* arg, ValueType value) {
     }  // Otherwise propagate existing error.
     return false;
     }
-    if (ABSL_PREDICT_FALSE(!IsValidNumericCast<RangeType>(value))) {
+    if (PROTOBUF_PREDICT_FALSE(!IsValidNumericCast<RangeType>(value))) {
       OutOfRangeError(arg);
       return false;
     }
@@ -680,7 +680,7 @@ bool CheckAndGetInteger(PyObject* arg, T* value) {
   // an integer and can be used as an ordinal number".
   // This definition includes everything that implements numbers.Integral
   // and shouldn't cast the net too wide.
-    if (ABSL_PREDICT_FALSE(!PyIndex_Check(arg))) {
+    if (PROTOBUF_PREDICT_FALSE(!PyIndex_Check(arg))) {
       FormatTypeError(arg, "int, long");
       return false;
     }
@@ -697,7 +697,7 @@ bool CheckAndGetInteger(PyObject* arg, T* value) {
       // Unlike PyLong_AsLongLong, PyLong_AsUnsignedLongLong is very
       // picky about the exact type.
       PyObject* casted = PyNumber_Long(arg);
-      if (ABSL_PREDICT_FALSE(casted == nullptr)) {
+      if (PROTOBUF_PREDICT_FALSE(casted == nullptr)) {
         // Propagate existing error.
         return false;
         }
@@ -722,7 +722,7 @@ bool CheckAndGetInteger(PyObject* arg, T* value) {
       // Valid subclasses of numbers.Integral should have a __long__() method
       // so fall back to that.
       PyObject* casted = PyNumber_Long(arg);
-      if (ABSL_PREDICT_FALSE(casted == nullptr)) {
+      if (PROTOBUF_PREDICT_FALSE(casted == nullptr)) {
         // Propagate existing error.
         return false;
         }
@@ -748,7 +748,7 @@ template bool CheckAndGetInteger<uint64>(PyObject*, uint64*);
 
 bool CheckAndGetDouble(PyObject* arg, double* value) {
   *value = PyFloat_AsDouble(arg);
-  if (ABSL_PREDICT_FALSE(*value == -1 && PyErr_Occurred())) {
+  if (PROTOBUF_PREDICT_FALSE(*value == -1 && PyErr_Occurred())) {
     FormatTypeError(arg, "int, long, float");
     return false;
     }

+ 1 - 1
python/google/protobuf/pyext/message_module.cc

@@ -31,7 +31,7 @@
 #include <Python.h>
 
 #include <google/protobuf/pyext/message.h>
-#include <google/protobuf/python/proto_api.h>
+#include <google/protobuf/proto_api.h>
 
 #include <google/protobuf/message_lite.h>