Skip to content
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

PyPy from shapely.geos import causes "TypeError: unsupported operand type(s) for +: 'list' and 'tuple'" #866

Closed
cjmayo opened this issue Mar 14, 2020 · 5 comments
Assignees
Labels
bug
Milestone

Comments

@cjmayo
Copy link

@cjmayo cjmayo commented Mar 14, 2020

Expected behavior and actual behavior.

PyPy is able to import from shapely.geos.

Steps to reproduce the problem.

While running Travis tests on geoalchemy2.

__________________ ERROR collecting tests/test_comparator.py ___________________
tests/test_comparator.py:5: in <module>
    from geoalchemy2.types import Geometry
geoalchemy2/__init__.py:1: in <module>
    from .types import (  # NOQA
geoalchemy2/types.py:17: in <module>
    from .shape import to_shape
geoalchemy2/shape.py:10: in <module>
    import shapely.wkb
.tox/pypysqla11/site-packages/shapely/wkb.py:4: in <module>
    from shapely.geos import WKBReader, WKBWriter, lgeos
.tox/pypysqla11/site-packages/shapely/geos.py:224: in <module>
    new_func.argtypes = [c_void_p] + old_func.argtypes
E   TypeError: unsupported operand type(s) for +: 'list' and 'tuple'

https://travis-ci.org/github/geoalchemy/geoalchemy2/jobs/662462792#L760

I've tried PyPy and PyPy3.

Tests on Python 2.7, 3.{5,6,7,8} work fine.

Unfortunately I don't have PyPy installed locally to test further.

new_func.argtypes = [c_void_p] + old_func.argtypes

Can this be changed to
new_func.argtypes = [c_void_p] + list(old_func.argtypes)

Not that I know if that would work, or quite why it was needed.

Operating system

Linux Ubuntu Xenial (Travis)

Shapely version and provenance

1.70 installed from PyPI using pip.
https://files.pythonhosted.org/packages/44/ec/4eddbf9d17a917c51fb4ad159aa7137f506681e91ab559cf87d120e1d78d/Shapely-1.7.0.tar.gz

libgeos-3.7.1

@sgillies sgillies added the bug label Mar 14, 2020
@sgillies sgillies self-assigned this Mar 14, 2020
@sgillies sgillies added this to the 1.7.1 milestone Mar 14, 2020
@sgillies
Copy link
Member

@sgillies sgillies commented Mar 14, 2020

@cjmayo thanks for the report! I'll look into it.

@sgillies sgillies closed this in 9ca2224 Mar 16, 2020
@sgillies
Copy link
Member

@sgillies sgillies commented Mar 16, 2020

@cjmayo we haven't had PyPy in the CI build matrix due to past issues with it and a very small number of users, so I must rely on you for a confirmation.

@cjmayo
Copy link
Author

@cjmayo cjmayo commented Mar 16, 2020

Thanks for the quick update. I've tested geoalchemy2 with https://github.com/Toblerity/Shapely/archive/9ca22240d3272df9598c30878c6f8562e50f1ec8.tar.gz and it is passing all tests with PyPy and Python 2.7, 3.{5-8}.

@samitshah
Copy link

@samitshah samitshah commented Mar 18, 2020

Faced the same issue. Changing line 224 in geos.py as mentioned by @cjmayo works

@oppianmatt
Copy link

@oppianmatt oppianmatt commented Aug 20, 2020

any chance on publishing this to pypi please?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
4 participants
You can’t perform that action at this time.