aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/python/client
diff options
context:
space:
mode:
authorGravatar Skye Wanderman-Milne <skyewm@google.com>2018-04-02 14:40:37 -0700
committerGravatar TensorFlower Gardener <gardener@tensorflow.org>2018-04-02 14:42:57 -0700
commit817882c28fd6f0dbbbf35b6ac0764ccbd38430d0 (patch)
treea149aaef047c19a4687c6a8b43012451dc9d0614 /tensorflow/python/client
parente0488c7f4ee1d3d996c6e87076f4683a41883fd3 (diff)
ResourceHandleShapeAndType returns bytes, not unicode.
This could cause failures when enabling the C API with python3. PiperOrigin-RevId: 191350031
Diffstat (limited to 'tensorflow/python/client')
-rw-r--r--tensorflow/python/client/tf_session.i5
1 files changed, 5 insertions, 0 deletions
diff --git a/tensorflow/python/client/tf_session.i b/tensorflow/python/client/tf_session.i
index 5dcd0c192e..ee76e29c05 100644
--- a/tensorflow/python/client/tf_session.i
+++ b/tensorflow/python/client/tf_session.i
@@ -460,6 +460,11 @@ TF_ImportGraphDefResultsMissingUnusedInputMappings_wrapper{
$1 = PyLong_AsLongLong($input);
}
+// Override default py3 behavior of attempting to encode into Unicode.
+%typemap(out) std::string tensorflow::ResourceHandleShapeAndType {
+ $result = PyBytes_FromStringAndSize($1.data(), $1.size());
+}
+
// TODO(skyewm): SWIG emits a warning for the const char* in TF_WhileParams,
// skip for now
%ignore TF_WhileParams;