[pypy-issue] Issue #2626: invalid conversion from ‘const char*’ to ‘char* in cython based library (pypy/pypy)

Stuart Axon issues-reply at bitbucket.org
Thu Aug 10 10:25:48 EDT 2017


New issue 2626: invalid conversion from ‘const char*’ to ‘char* in cython based library
https://bitbucket.org/pypy/pypy/issues/2626/invalid-conversion-from-const-char-to-char

Stuart Axon:

Trying out pyimgui, a cython based binding to imgui, I found a couple of compile errors with pypy.

https://github.com/swistakm/pyimgui

This seems to be in unicode 16 decode functions and all complaining about "invalid conversion from ‘const char*’ to ‘char*"

```
 python setup.py install
Compiling imgui/core.pyx because it changed.
[1/1] Cythonizing imgui/core.pyx

running install
Checking .pth file support in /mnt/data/home/stu/.virtualenvs/tmp-faa2106f85151cc7/site-packages/
/mnt/data/home/stu/.virtualenvs/tmp-faa2106f85151cc7/bin/python -E -c pass
TEST PASSED: /mnt/data/home/stu/.virtualenvs/tmp-faa2106f85151cc7/site-packages/ appears to support .pth files
running bdist_egg
running egg_info
writing imgui.egg-info/PKG-INFO
writing dependency_links to imgui.egg-info/dependency_links.txt
writing requirements to imgui.egg-info/requires.txt
writing top-level names to imgui.egg-info/top_level.txt
reading manifest file 'imgui.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
writing manifest file 'imgui.egg-info/SOURCES.txt'
installing library code to build/bdist.linux-x86_64/egg
running install_lib
running build_py
creating build/lib.linux-x86_64-2.7
creating build/lib.linux-x86_64-2.7/imgui
copying imgui/__init__.py -> build/lib.linux-x86_64-2.7/imgui
creating build/lib.linux-x86_64-2.7/imgui/integrations
copying imgui/integrations/opengl.py -> build/lib.linux-x86_64-2.7/imgui/integrations
copying imgui/integrations/glfw.py -> build/lib.linux-x86_64-2.7/imgui/integrations
copying imgui/integrations/__init__.py -> build/lib.linux-x86_64-2.7/imgui/integrations
copying imgui/integrations/sdl2.py -> build/lib.linux-x86_64-2.7/imgui/integrations
copying imgui/integrations/cocos2d.py -> build/lib.linux-x86_64-2.7/imgui/integrations
copying imgui/integrations/pygame.py -> build/lib.linux-x86_64-2.7/imgui/integrations
copying imgui/cimgui.pxd -> build/lib.linux-x86_64-2.7/imgui
copying imgui/core.cpp -> build/lib.linux-x86_64-2.7/imgui
copying imgui/core.h -> build/lib.linux-x86_64-2.7/imgui
copying imgui/core.pyx -> build/lib.linux-x86_64-2.7/imgui
copying imgui/enums.pxd -> build/lib.linux-x86_64-2.7/imgui
running build_ext
building 'imgui.core' extension
creating build/temp.linux-x86_64-2.7
creating build/temp.linux-x86_64-2.7/imgui
creating build/temp.linux-x86_64-2.7/imgui-cpp
creating build/temp.linux-x86_64-2.7/config-cpp
cc -pthread -DNDEBUG -O2 -fPIC -DPYIMGUI_CUSTOM_EXCEPTION -Iimgui-cpp -Iimgui -Iconfig-cpp -I/mnt/data/home/stu/.virtualenvs/tmp-faa2106f85151cc7/include -c imgui/core.cpp -o build/temp.linux-x86_64-2.7/imgui/core.o -includeconfig-cpp/py_imconfig.h
imgui/core.cpp: In function ‘PyObject* __Pyx_PyUnicode_DecodeUTF16(const char*, Py_ssize_t, const char*)’:
imgui/core.cpp:1409:61: error: invalid conversion from ‘const char*’ to ‘char*’ [-fpermissive]
     return PyUnicode_DecodeUTF16(s, size, errors, &byteorder);
                                                             ^
In file included from /mnt/data/home/stu/.virtualenvs/tmp-faa2106f85151cc7/include/Python.h:141:0,
                 from ./config-cpp/py_imconfig.h:14,
                 from <command-line>:0:
/mnt/data/home/stu/.virtualenvs/tmp-faa2106f85151cc7/include/pypy_decl.h:886:31: note:   initializing argument 1 of ‘PyObject* PyPyUnicode_DecodeUTF16(char*, long int, const char*, int*)’
 #define PyUnicode_DecodeUTF16 PyPyUnicode_DecodeUTF16
                               ^
/mnt/data/home/stu/.virtualenvs/tmp-faa2106f85151cc7/include/pypy_decl.h:887:24: note: in expansion of macro ‘PyUnicode_DecodeUTF16’
 PyAPI_FUNC(PyObject *) PyUnicode_DecodeUTF16(char *arg0, Signed arg1, const char *arg2, int *arg3);
                        ^~~~~~~~~~~~~~~~~~~~~
imgui/core.cpp: In function ‘PyObject* __Pyx_PyUnicode_DecodeUTF16LE(const char*, Py_ssize_t, const char*)’:
imgui/core.cpp:1413:61: error: invalid conversion from ‘const char*’ to ‘char*’ [-fpermissive]
     return PyUnicode_DecodeUTF16(s, size, errors, &byteorder);
                                                             ^
In file included from /mnt/data/home/stu/.virtualenvs/tmp-faa2106f85151cc7/include/Python.h:141:0,
                 from ./config-cpp/py_imconfig.h:14,
                 from <command-line>:0:
/mnt/data/home/stu/.virtualenvs/tmp-faa2106f85151cc7/include/pypy_decl.h:886:31: note:   initializing argument 1 of ‘PyObject* PyPyUnicode_DecodeUTF16(char*, long int, const char*, int*)’
 #define PyUnicode_DecodeUTF16 PyPyUnicode_DecodeUTF16
                               ^
/mnt/data/home/stu/.virtualenvs/tmp-faa2106f85151cc7/include/pypy_decl.h:887:24: note: in expansion of macro ‘PyUnicode_DecodeUTF16’
 PyAPI_FUNC(PyObject *) PyUnicode_DecodeUTF16(char *arg0, Signed arg1, const char *arg2, int *arg3);
                        ^~~~~~~~~~~~~~~~~~~~~
imgui/core.cpp: In function ‘PyObject* __Pyx_PyUnicode_DecodeUTF16BE(const char*, Py_ssize_t, const char*)’:
imgui/core.cpp:1417:61: error: invalid conversion from ‘const char*’ to ‘char*’ [-fpermissive]
     return PyUnicode_DecodeUTF16(s, size, errors, &byteorder);
                                                             ^
In file included from /mnt/data/home/stu/.virtualenvs/tmp-faa2106f85151cc7/include/Python.h:141:0,
                 from ./config-cpp/py_imconfig.h:14,
                 from <command-line>:0:
/mnt/data/home/stu/.virtualenvs/tmp-faa2106f85151cc7/include/pypy_decl.h:886:31: note:   initializing argument 1 of ‘PyObject* PyPyUnicode_DecodeUTF16(char*, long int, const char*, int*)’
 #define PyUnicode_DecodeUTF16 PyPyUnicode_DecodeUTF16
                               ^
/mnt/data/home/stu/.virtualenvs/tmp-faa2106f85151cc7/include/pypy_decl.h:887:24: note: in expansion of macro ‘PyUnicode_DecodeUTF16’
 PyAPI_FUNC(PyObject *) PyUnicode_DecodeUTF16(char *arg0, Signed arg1, const char *arg2, int *arg3);
                        ^~~~~~~~~~~~~~~~~~~~~
error: command 'cc' failed with exit status 1

```




More information about the pypy-issue mailing list