New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when deserializing empty Date() #96

Closed
svenstaro opened this Issue Dec 13, 2014 · 2 comments

Comments

Projects
None yet
2 participants
@svenstaro
Contributor

svenstaro commented Dec 13, 2014

So when deserializing an empty (but non-required) DateTime, everything works fine. When deserializing an empty (but non-required) Date(), I get:

File "/home/svenstaro/prj/blah/blah.py", line 181, in patch result, errors = schema.load(request.json) File "/home/svenstaro/prj/blah/env/lib/python3.4/site-packages/marshmallow/schema.py", line 481, in load result, errors = self._do_load(data, many, postprocess=True) File "/home/svenstaro/prj/blah/env/lib/python3.4/site-packages/marshmallow/schema.py", line 589, in _do_load dict_class=self.dict_class File "/home/svenstaro/prj/blah/env/lib/python3.4/site-packages/marshmallow/fields.py", line 282, in deserialize strict=strict File "/home/svenstaro/prj/blah/env/lib/python3.4/site-packages/marshmallow/fields.py", line 107, in _call_and_store value = getter_func(data) File "/home/svenstaro/prj/blah/env/lib/python3.4/site-packages/marshmallow/fields.py", line 453, in deserialize return self._call_and_reraise(do_deserialization, UnmarshallingError) File "/home/svenstaro/prj/blah/env/lib/python3.4/site-packages/marshmallow/fields.py", line 403, in _call_and_reraise return func() File "/home/svenstaro/prj/blah/env/lib/python3.4/site-packages/marshmallow/fields.py", line 450, in do_deserialization output = self._deserialize(value) File "/home/svenstaro/prj/blah/env/lib/python3.4/site-packages/marshmallow/fields.py", line 960, in _deserialize return utils.from_iso_date(value) File "/home/svenstaro/prj/blah/env/lib/python3.4/site-packages/marshmallow/utils.py", line 262, in from_iso_date return parser.parse(datestring).date() File "/home/svenstaro/prj/blah/env/lib/python3.4/site-packages/dateutil/parser.py", line 743, in parse return DEFAULTPARSER.parse(timestr, **kwargs) File "/home/svenstaro/prj/blah/env/lib/python3.4/site-packages/dateutil/parser.py", line 300, in parse res = self._parse(timestr, **kwargs) File "/home/svenstaro/prj/blah/env/lib/python3.4/site-packages/dateutil/parser.py", line 358, in _parse l = _timelex.split(timestr) File "/home/svenstaro/prj/blah/env/lib/python3.4/site-packages/dateutil/parser.py", line 139, in split return list(cls(s)) File "/home/svenstaro/prj/blah/env/lib/python3.4/site-packages/dateutil/parser.py", line 130, in __next__ token = self.get_token() File "/home/svenstaro/prj/blah/env/lib/python3.4/site-packages/dateutil/parser.py", line 61, in get_token nextchar = self.instream.read(1) AttributeError: 'NoneType' object has no attribute 'read'

@sloria

This comment has been minimized.

Member

sloria commented Dec 13, 2014

Thanks for reporting. Will look into this when I have more time.

@sloria

This comment has been minimized.

Member

sloria commented Dec 15, 2014

Fixed as of 8b33b22

@sloria sloria closed this Dec 15, 2014

@sloria sloria added this to the 1.2.0 milestone Dec 15, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment