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/11/10 12:18:32 UTC
[pulsar] branch master updated: [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 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 aa59f75 [Issue #12485][Python Client] cannot use any values that evaluates to False (#12489)
aa59f75 is described below
commit aa59f753590ce9e6c0a7cddd1b19a89e5ef539ee
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)
---
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'):