You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by pe...@apache.org on 2021/12/21 03:02:32 UTC
[pulsar] 01/15: [Issue #12485][Python Client] cannot use any values that evaluates to False (#12489)
This is an automated email from the ASF dual-hosted git repository.
penghui pushed a commit to branch branch-2.9
in repository https://gitbox.apache.org/repos/asf/pulsar.git
commit 8fa7139ade8cefe2ec1fcd6873204546ed75d9df
Author: Travis Sturzl <tr...@gmail.com>
AuthorDate: Wed Nov 10 05:17:39 2021 -0700
[Issue #12485][Python Client] cannot use any values that evaluates to False (#12489)
(cherry picked from commit aa59f753590ce9e6c0a7cddd1b19a89e5ef539ee)
---
pulsar-client-cpp/python/pulsar/schema/definition.py | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/pulsar-client-cpp/python/pulsar/schema/definition.py b/pulsar-client-cpp/python/pulsar/schema/definition.py
index 9b6c861..a7a235b 100644
--- a/pulsar-client-cpp/python/pulsar/schema/definition.py
+++ b/pulsar-client-cpp/python/pulsar/schema/definition.py
@@ -184,7 +184,7 @@ class Record(with_metaclass(RecordMeta, object)):
return self.__class__
def validate_type(self, name, val):
- if not val and not self._required:
+ if val is None and not self._required:
return self.default()
if not isinstance(val, self.__class__):
@@ -219,7 +219,7 @@ class Field(object):
pass
def validate_type(self, name, val):
- if not val and not self._required:
+ if val is None and not self._required:
return self.default()
if type(val) != self.python_type():
@@ -350,7 +350,7 @@ class String(Field):
def validate_type(self, name, val):
t = type(val)
- if not val and not self._required:
+ if val is None and not self._required:
return self.default()
if not (t is str or t.__name__ == 'unicode'):