aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/python/client
diff options
context:
space:
mode:
authorGravatar Skye Wanderman-Milne <skyewm@google.com>2018-04-03 12:38:54 -0700
committerGravatar TensorFlower Gardener <gardener@tensorflow.org>2018-04-03 12:41:39 -0700
commitd5ebc299ece050d3349feadc20339d636a9d84a1 (patch)
tree02954f76e56d81a855ba415530d45e1d90ab6436 /tensorflow/python/client
parentfe2d7600bd6ecfcf3a083b7c01b2c114ba7c63ff (diff)
Use PyLong_AsLongLong instead of PyInt_AsLong to guarantee 64-bit output.
A C long is 32 bits on some platforms, which can cause the PyInt_AsLong call in PyInt64ListToVector to overflow. large_concat_op_test exposes this bug on such platforms. PiperOrigin-RevId: 191484167
Diffstat (limited to 'tensorflow/python/client')
-rw-r--r--tensorflow/python/client/tf_session.i2
1 files changed, 1 insertions, 1 deletions
diff --git a/tensorflow/python/client/tf_session.i b/tensorflow/python/client/tf_session.i
index 68768f2b4c..0c18d973a7 100644
--- a/tensorflow/python/client/tf_session.i
+++ b/tensorflow/python/client/tf_session.i
@@ -72,7 +72,7 @@ void PyInt64ListToVector(PyObject* py_int_seq, std::vector<int64_t>* vec) {
int size = PySequence_Fast_GET_SIZE(py_int_seq);
for (int i = 0; i < size; ++i) {
PyObject* item = PySequence_Fast_GET_ITEM(py_int_seq, i);
- vec->push_back(PyInt_AsLong(item));
+ vec->push_back(PyLong_AsLongLong(item));
}
}