Skip to content

Commit e1f608e

Browse files
committed
fix error trying to convert None to dict
1 parent cef1d2a commit e1f608e

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

datamodel/converters.pyx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,8 @@ cpdef object to_boolean(object obj):
253253
254254
Convert and returns any object value to boolean version.
255255
"""
256+
if obj is None:
257+
return False
256258
if isinstance(obj, bool):
257259
return obj
258260
if isinstance(obj, (bytes, bytearray)):
@@ -269,6 +271,8 @@ cpdef object to_boolean(object obj):
269271
return bool(obj)
270272

271273
cpdef object to_object(object obj):
274+
if obj is None:
275+
return None
272276
if isinstance(obj, (list, dict,tuple)):
273277
return obj
274278
elif callable(obj):

datamodel/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
__title__ = 'python-datamodel'
44
__description__ = ('simple library based on python +3.8 to use Dataclass-syntax'
55
'for interacting with Data')
6-
__version__ = '0.6.3'
6+
__version__ = '0.6.4'
77
__author__ = 'Jesus Lara'
88
__author_email__ = '[email protected]'
99
__license__ = 'BSD'

0 commit comments

Comments
 (0)