You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2018/10/26 09:56:47 UTC
[GitHub] srkukarni closed pull request #2848: Make IdentitySerde handle
bytes as well
srkukarni closed pull request #2848: Make IdentitySerde handle bytes as well
URL: https://github.com/apache/pulsar/pull/2848
This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:
As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):
diff --git a/pulsar-client-cpp/python/pulsar/functions/serde.py b/pulsar-client-cpp/python/pulsar/functions/serde.py
index ee6366cf63..968c1c9bc3 100644
--- a/pulsar-client-cpp/python/pulsar/functions/serde.py
+++ b/pulsar-client-cpp/python/pulsar/functions/serde.py
@@ -75,7 +75,9 @@ def __init__(self):
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 @@ def deserialize(self, input_bytes):
return typ(input_bytes.decode('utf-8'))
except:
pass
- raise TypeError
+ return input_bytes
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services