marshmallow >= 3.1.0 not working in Python<3.5.3

Created on 17 Sep 2019  路  5Comments  路  Source: marshmallow-code/marshmallow

Hello!

I'm getting the following error when using marshmallow 3.1.0 or 3.1.1 with pytest:

============================================== test session starts ===============================================
platform linux -- Python 3.5.2, pytest-5.1.2, py-1.8.0, pluggy-0.13.0
rootdir: ***, inifile: setup.cfg
plugins: cov-2.7.1, asyncio-0.10.0
collected 31 items / 1 errors / 30 selected                                                                      

===================================================== ERRORS =====================================================
______________________________ ERROR collecting tests_async/test_event_executor.py _______________________________
*** imports inside my project ***
    from marshmallow import Schema, fields, decorators
../../.local/share/virtualenvs/gateway-WH935Ska/lib/python3.5/site-packages/marshmallow/__init__.py:1: in <module>
    from marshmallow.schema import Schema, SchemaOpts
../../.local/share/virtualenvs/gateway-WH935Ska/lib/python3.5/site-packages/marshmallow/schema.py:14: in <module>
    from marshmallow import base, fields as ma_fields, class_registry
../../.local/share/virtualenvs/gateway-WH935Ska/lib/python3.5/site-packages/marshmallow/fields.py:434: in <module>
    class Nested(Field):
../../.local/share/virtualenvs/gateway-WH935Ska/lib/python3.5/site-packages/marshmallow/fields.py:480: in Nested
    unknown: str = None,
../../miniconda3/envs/gateway3.5.2/lib/python3.5/typing.py:552: in __getitem__
    dict(self.__dict__), parameters, _root=True)
../../miniconda3/envs/gateway3.5.2/lib/python3.5/typing.py:512: in __new__
    for t2 in all_params - {t1} if not isinstance(t2, TypeVar)):
../../miniconda3/envs/gateway3.5.2/lib/python3.5/typing.py:512: in <genexpr>
    for t2 in all_params - {t1} if not isinstance(t2, TypeVar)):
../../miniconda3/envs/gateway3.5.2/lib/python3.5/typing.py:1077: in __subclasscheck__
    if super().__subclasscheck__(cls):
../../.local/share/virtualenvs/gateway-WH935Ska/lib/python3.5/abc.py:225: in __subclasscheck__
    for scls in cls.__subclasses__():
E   TypeError: descriptor '__subclasses__' of 'type' object needs an argument

The last working version was 3.0.5.

bug

Most helpful comment

I was able to reproduce this in the python:3.5.2 Docker image. I've verified https://github.com/marshmallow-code/marshmallow/pull/1410 fixes this and I'll release it shortly.

That said, I can't promise we'll continue to support old Python point versions. It will be very costly from a maintenance perspective. These old versions are unsupported and a number of bug fixes and security fixes have been released since 3.5.2.

All 5 comments

https://stackoverflow.com/a/56010650

Works on PY3.5.3 but not 3.5.2 (your version).

Since we support 3.5.x, we'd need to fix this typing related issue.

Thanks for reporting.

Thanks for a quick reply! Unfortunately, I'm unable to bump my Python version due to target platform constraints.

I was able to reproduce this in the python:3.5.2 Docker image. I've verified https://github.com/marshmallow-code/marshmallow/pull/1410 fixes this and I'll release it shortly.

That said, I can't promise we'll continue to support old Python point versions. It will be very costly from a maintenance perspective. These old versions are unsupported and a number of bug fixes and security fixes have been released since 3.5.2.

3.2.0 includes the fix.

Thanks for a quick reaction!

Was this page helpful?
0 / 5 - 0 ratings