Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
P
protobuf
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
protobuf
Commits
e53be9bc
Commit
e53be9bc
authored
Sep 07, 2018
by
Josh Haberman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed Python extension compile.
parent
f1406418
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
7 deletions
+7
-7
message.cc
python/google/protobuf/pyext/message.cc
+6
-6
message_module.cc
python/google/protobuf/pyext/message_module.cc
+1
-1
No files found.
python/google/protobuf/pyext/message.cc
View file @
e53be9bc
...
...
@@ -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
;
}
...
...
python/google/protobuf/pyext/message_module.cc
View file @
e53be9bc
...
...
@@ -31,7 +31,7 @@
#include <Python.h>
#include <google/protobuf/pyext/message.h>
#include <google/protobuf/p
ython/p
roto_api.h>
#include <google/protobuf/proto_api.h>
#include <google/protobuf/message_lite.h>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment