This is an automated email from the ASF dual-hosted git repository. sanjeevrk pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/pulsar.git
The following commit(s) were added to refs/heads/master by this push: new b867907 Make IdentitySerde handle bytes as well (#2848) b867907 is described below commit b8679078dc6632795c4d81cff9caedd316444f17 Author: Sanjeev Kulkarni <sanjee...@gmail.com> AuthorDate: Fri Oct 26 02:56:45 2018 -0700 Make IdentitySerde handle bytes as well (#2848) * Make IdentitySerde handle bytes as well * Added more information about type of object passed --- pulsar-client-cpp/python/pulsar/functions/serde.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/pulsar-client-cpp/python/pulsar/functions/serde.py b/pulsar-client-cpp/python/pulsar/functions/serde.py index ee6366c..968c1c9 100644 --- a/pulsar-client-cpp/python/pulsar/functions/serde.py +++ b/pulsar-client-cpp/python/pulsar/functions/serde.py @@ -75,7 +75,9 @@ class IdentitySerDe(SerDe): def serialize(self, input): if type(input) in self._types: return str(input).encode('utf-8') - raise TypeError + if type(input) == bytes: + return input + raise TypeError("IdentitySerde cannot serialize object of type %s" % type(input)) def deserialize(self, input_bytes): for typ in self._types: @@ -83,4 +85,4 @@ class IdentitySerDe(SerDe): return typ(input_bytes.decode('utf-8')) except: pass - raise TypeError + return input_bytes