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

ctypes failure item 1 in _argtypes_ passes (python 3.7) #305

Closed
landam opened this issue Jan 28, 2020 · 7 comments
Closed

ctypes failure item 1 in _argtypes_ passes (python 3.7) #305

landam opened this issue Jan 28, 2020 · 7 comments
Labels
bug Something isn't working
Milestone

Comments

@landam
Copy link
Member

landam commented Jan 28, 2020

Describe the bug

Ctypes failure appears with Python 3.7. Not reproduceable with Python 3.6

Traceback (most recent call last):
  File "/usr/lib/python3.7/ctypes/__init__.py", line 97, in CFUNCTYPE
    return _c_functype_cache[(restype, argtypes, flags)]
KeyError: (<class 'ctypes.c_int'>, (<class 'grass.lib.ctypes_preamble.String'>,), 1)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/opt/src/grass/dist.x86_64-pc-linux-gnu/scripts/t.create", line 92, in <module>
    main()
  File "/opt/src/grass/dist.x86_64-pc-linux-gnu/scripts/t.create", line 74, in main
    import grass.temporal as tgis
  File "/opt/src/grass/dist.x86_64-pc-linux-gnu/etc/python/grass/temporal/__init__.py", line 3, in <module>
    from .core import *
  File "/opt/src/grass/dist.x86_64-pc-linux-gnu/etc/python/grass/temporal/core.py", line 39, in <module>
    from .c_libraries_interface import *
  File "/opt/src/grass/dist.x86_64-pc-linux-gnu/etc/python/grass/temporal/c_libraries_interface.py", line 20, in <module>
    import grass.lib.gis as libgis
  File "/opt/src/grass/dist.x86_64-pc-linux-gnu/etc/python/grass/lib/gis.py", line 552, in <module>
    ('checker', CFUNCTYPE(UNCHECKED(c_int), String)),
  File "/usr/lib/python3.7/ctypes/__init__.py", line 99, in CFUNCTYPE
    class CFunctionType(_CFuncPtr):
TypeError: item 1 in _argtypes_ passes a union by value, which is unsupported.

To Reproduce

./bin.x86_64-pc-linux-gnu/grass79 -c /tmp/test
t.create test tit=x desc=y

System description (please complete the following information):

  • Operating System: Linux
  • GRASS GIS version 7.9
  • Python 3.7.6
@landam landam added the bug Something isn't working label Jan 28, 2020
@landam landam added this to the 7.8.3 milestone Jan 28, 2020
@kikislater
Copy link
Contributor

Same as here : https://trac.osgeo.org/grass/ticket/4015

@neteler
Copy link
Member

neteler commented Jan 28, 2020

This is a bug in Python, not GRASS GIS.

Upstream bug report:
https://bugs.python.org/issue16575

There is an upstream PR, fixing this issue:
python/cpython#17960

... with this being the patch to be applied prior to compile Python:
https://github.com/python/cpython/commit/eb9ba2f66df2195a9c6295e73ab3d545a1445f05.patch

Broken Python versions:
Python 3.7.6 - 3.8.1

An upstream fix is (at time) scheduled for Python 3.8.2 in February 2020 but earlier versions down to 3.7.6 also need the fix.

@landam
Copy link
Member Author

landam commented Jan 28, 2020

Closing as duplicate, see ongoing discussion at https://trac.osgeo.org/grass/ticket/4015

@landam landam closed this as completed Jan 28, 2020
@cmbarton
Copy link
Contributor

cmbarton commented Jan 28, 2020 via email

@neteler
Copy link
Member

neteler commented Jan 29, 2020

Michael: no, this is unrelated. In Python things got broken and will be fixed there. However, we may consider to re-sync ctypesgen to the revived upstream project (https://github.com/davidjamesca/ctypesgen).

@NikosAlexandris
Copy link
Member

Silly work-around for the time being?

  • Get and install a Python version which does not suffer by https://bugs.python.org/issue16575 (for example get https://www.python.org/downloads/release/python-382/, then: untar, ./configure --prefix=SomeLocalDirectory, make and make install).
  • Create a virtual environment based on this Python version (as usual with /SomeLocalDirectory/bin/python -m venv NameYourVirtualEnvironment).
  • Activate it (and upgrade pip inside it to eventually install missing packages like six and numpy).
  • Launch a GRASS GIS session from within it: the t.* commands work!

@NikosAlexandris
Copy link
Member

Silly work-around for the time being?

  • Get and install a Python version which does not suffer by https://bugs.python.org/issue16575 (for example get https://www.python.org/downloads/release/python-382/, then: untar, ./configure --prefix=SomeLocalDirectory, make and make install).
  • Create a virtual environment based on this Python version (as usual with /SomeLocalDirectory/bin/python -m venv NameYourVirtualEnvironment).
  • Activate it (and upgrade pip inside it to eventually install missing packages like six and numpy).
  • Launch a GRASS GIS session from within it: the t.* commands work!

This however brakes other tools :-).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants