python / python/mypy

Mypy 1.19.0 can't be installed on pypy

Offen
#20,329 3 Kommentare 2 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

bug topic-usability
Vorherrschende Sprache
Python
Sterne
20.6k
Forks
3.3k
PR-Merge-Kennzahlen
PR-Kennzahlen ausstehend

Beschreibung

Bug Report

If mypy 1.19.0 is installed in PyPy 7.3.20 with Python (3.11.13) the wheel for librt can't be build because of several compiler errors.

Build output
     building 'librt.internal' extension
      creating build/temp.linux-x86_64-pypy311
      gcc-11 -DNDEBUG -O2 -fPIC -I. -I/home/runner/work/gcovr/gcovr/.nox/mypy/include -I/opt/hostedtoolcache/PyPy/3.11.13/x64/include/pypy3.11 -c exc_ops.c -o build/temp.linux-x86_64-pypy311/exc_ops.o -O3
      In file included from CPy.h:12,
                       from exc_ops.c:8:
      pythonsupport.h:38:1: warning: data definition has no type or storage class
         38 | _Py_IDENTIFIER(__mro_entries__);
            | ^~~~~~~~~~~~~~
      pythonsupport.h:38:1: warning: type defaults to ‘int’ in declaration of ‘_Py_IDENTIFIER’ [-Wimplicit-int]
      pythonsupport.h:38:1: warning: parameter names (without types) in function declaration
      pythonsupport.h: In function ‘update_bases’:
      pythonsupport.h:60:50: error: ‘PyId___mro_entries__’ undeclared (first use in this function)
         60 |         if (PyObject_GetOptionalAttrString(base, PyId___mro_entries__.string, &meth) < 0) {
            |                                                  ^~~~~~~~~~~~~~~~~~~~
      pythonsupport.h:60:50: note: each undeclared identifier is reported only once for each function it appears in
      pythonsupport.h: At top level:
      pythonsupport.h:113:1: warning: data definition has no type or storage class
        113 | _Py_IDENTIFIER(__init_subclass__);
            | ^~~~~~~~~~~~~~
      pythonsupport.h:113:1: warning: type defaults to ‘int’ in declaration of ‘_Py_IDENTIFIER’ [-Wimplicit-int]
      pythonsupport.h:113:1: warning: parameter names (without types) in function declaration
      pythonsupport.h: In function ‘init_subclass’:
      pythonsupport.h:125:12: warning: implicit declaration of function ‘_PyObject_GetAttrId’; did you mean ‘PyObject_GetAttr’? [-Wimplicit-function-declaration]
        125 |     func = _PyObject_GetAttrId(super, &PyId___init_subclass__);
            |            ^~~~~~~~~~~~~~~~~~~
            |            PyObject_GetAttr
      pythonsupport.h:125:40: error: ‘PyId___init_subclass__’ undeclared (first use in this function)
        125 |     func = _PyObject_GetAttrId(super, &PyId___init_subclass__);
            |                                        ^~~~~~~~~~~~~~~~~~~~~~
      In file included from pythonsupport.h:14,
                       from CPy.h:12,
                       from exc_ops.c:8:
      pythonsupport.h: In function ‘CPyLong_AsSsize_tAndOverflow’:
      mypyc_util.h:169:34: error: ‘PyLongObject’ has no member named ‘ob_digit’
        169 | #define CPY_LONG_DIGIT(o, n) ((o)->ob_digit[n])
            |                                  ^~
      pythonsupport.h:203:15: note: in expansion of macro ‘CPY_LONG_DIGIT’
        203 |         res = CPY_LONG_DIGIT(v, 0);
            |               ^~~~~~~~~~~~~~
      In file included from CPy.h:12,
                       from exc_ops.c:8:
      pythonsupport.h:207:17: error: ‘sdigit’ undeclared (first use in this function); did you mean ‘isdigit’?
        207 |         res = -(sdigit)CPY_LONG_DIGIT(v, 0);
            |                 ^~~~~~
            |                 isdigit
      In file included from pythonsupport.h:14,
                       from CPy.h:12,
                       from exc_ops.c:8:
      mypyc_util.h:169:34: error: ‘PyLongObject’ has no member named ‘ob_digit’
        169 | #define CPY_LONG_DIGIT(o, n) ((o)->ob_digit[n])
            |                                  ^~
      pythonsupport.h:207:24: note: in expansion of macro ‘CPY_LONG_DIGIT’
        207 |         res = -(sdigit)CPY_LONG_DIGIT(v, 0);
            |                        ^~~~~~~~~~~~~~
      In file included from CPy.h:12,
                       from exc_ops.c:8:
      pythonsupport.h: In function ‘list_resize’:
      pythonsupport.h:226:32: error: ‘PyListObject’ has no member named ‘allocated’
        226 |     Py_ssize_t allocated = self->allocated;
            |                                ^~
      pythonsupport.h:256:44: error: ‘PyListObject’ has no member named ‘ob_item’
        256 |     items = (PyObject **)PyMem_Realloc(self->ob_item, num_allocated_bytes);
            |                                            ^~
      pythonsupport.h:261:9: error: ‘PyListObject’ has no member named ‘ob_item’
        261 |     self->ob_item = items;
            |         ^~
      pythonsupport.h:263:9: error: ‘PyListObject’ has no member named ‘allocated’
        263 |     self->allocated = new_allocated;
            |         ^~
      pythonsupport.h: In function ‘list_pop_impl’:
      pythonsupport.h:285:13: error: ‘PyListObject’ has no member named ‘ob_item’
        285 |     v = self->ob_item[index];
            |             ^~
      pythonsupport.h: In function ‘list_count’:
      pythonsupport.h:310:48: error: ‘PyListObject’ has no member named ‘ob_item’
        310 |         int cmp = PyObject_RichCompareBool(self->ob_item[i], value, Py_EQ);
            |                                                ^~
      pythonsupport.h: At top level:
      pythonsupport.h:382:35: error: unknown type name ‘_Py_Identifier’
        382 | _CPyObject_HasAttrId(PyObject *v, _Py_Identifier *name) {
            |                                   ^~~~~~~~~~~~~~
      In file included from pythonsupport.h:14,
                       from CPy.h:12,
                       from exc_ops.c:8:
      CPy.h: In function ‘CPyLong_AsInt64’:
      mypyc_util.h:169:34: error: ‘PyLongObject’ has no member named ‘ob_digit’
        169 | #define CPY_LONG_DIGIT(o, n) ((o)->ob_digit[n])
            |                                  ^~
      CPy.h:337:20: note: in expansion of macro ‘CPY_LONG_DIGIT’
        337 |             return CPY_LONG_DIGIT(lobj, 0);
            |                    ^~~~~~~~~~~~~~
      In file included from exc_ops.c:8:
      CPy.h: In function ‘CPyLong_AsInt32’:
      CPy.h:359:40: error: ‘PyObject’ {aka ‘struct _object’} has no member named ‘ob_size’
        359 |         Py_ssize_t size = lobj->ob_base.ob_size;
            |                                        ^
      In file included from pythonsupport.h:14,
                       from CPy.h:12,
                       from exc_ops.c:8:
      mypyc_util.h:169:34: error: ‘PyLongObject’ has no member named ‘ob_digit’
        169 | #define CPY_LONG_DIGIT(o, n) ((o)->ob_digit[n])
            |                                  ^~
      CPy.h:362:20: note: in expansion of macro ‘CPY_LONG_DIGIT’
        362 |             return CPY_LONG_DIGIT(lobj, 0);
            |                    ^~~~~~~~~~~~~~
      In file included from exc_ops.c:8:
      CPy.h: In function ‘CPyLong_AsInt16’:
      CPy.h:387:40: error: ‘PyObject’ {aka ‘struct _object’} has no member named ‘ob_size’
        387 |         Py_ssize_t size = lobj->ob_base.ob_size;
            |                                        ^
      CPy.h:390:13: error: unknown type name ‘digit’
        390 |             digit x = lobj->ob_digit[0];
            |             ^~~~~
      CPy.h:390:27: error: ‘PyLongObject’ has no member named ‘ob_digit’
        390 |             digit x = lobj->ob_digit[0];
            |                           ^~
      CPy.h: In function ‘CPyLong_AsUInt8’:
      CPy.h:417:40: error: ‘PyObject’ {aka ‘struct _object’} has no member named ‘ob_size’
        417 |         Py_ssize_t size = lobj->ob_base.ob_size;
            |                                        ^
      CPy.h:420:13: error: unknown type name ‘digit’
        420 |             digit x = lobj->ob_digit[0];
            |             ^~~~~
      CPy.h:420:27: error: ‘PyLongObject’ has no member named ‘ob_digit’
        420 |             digit x = lobj->ob_digit[0];
            |                           ^~
      CPy.h: At top level:
      CPy.h:939:35: error: unknown type name ‘_Py_Identifier’
        939 |                                   _Py_Identifier *method);
            |                                   ^~~~~~~~~~~~~~
      CPy.h: In function ‘CPyObject_GenericGetAttr’:
      CPy.h:955:12: warning: implicit declaration of function ‘_PyObject_GenericGetAttrWithDict’; did you mean ‘CPyObject_GenericGetAttr’? [-Wimplicit-function-declaration]
        955 |     return _PyObject_GenericGetAttrWithDict(self, name, NULL, 1);
            |            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
            |            CPyObject_GenericGetAttr
      CPy.h:955:12: warning: returning ‘int’ from a function with return type ‘PyObject *’ {aka ‘struct _object *’} makes pointer from integer without a cast [-Wint-conversion]
        955 |     return _PyObject_GenericGetAttrWithDict(self, name, NULL, 1);
            |            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      CPy.h: In function ‘CPyObject_GenericSetAttr’:
      CPy.h:958:12: warning: implicit declaration of function ‘_PyObject_GenericSetAttrWithDict’; did you mean ‘CPyObject_GenericSetAttr’? [-Wimplicit-function-declaration]
        958 |     return _PyObject_GenericSetAttrWithDict(self, name, value, NULL);
            |            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
            |            CPyObject_GenericSetAttr
      In file included from /opt/hostedtoolcache/PyPy/3.11.13/x64/include/pypy3.11/Python.h:34,
                       from pythoncapi_compat.h:21,
                       from exc_ops.c:1:
      exc_ops.c: In function ‘CPy_ExceptionMatches’:
      CPy.h:838:43: error: ‘PyThreadState’ {aka ‘struct _ts’} has no member named ‘exc_info’
        838 | #define CPy_ExcState() PyThreadState_GET()->exc_info
            |                                           ^~
      /opt/hostedtoolcache/PyPy/3.11.13/x64/include/pypy3.11/pyport.h:24:38: note: in definition of macro ‘_Py_CAST’
         24 | #define _Py_CAST(type, expr) ((type)(expr))
            |                                      ^~~~
      /opt/hostedtoolcache/PyPy/3.11.13/x64/include/pypy3.11/object.h:133:31: note: in expansion of macro ‘_PyObject_CAST’
        133 | #  define Py_TYPE(ob) Py_TYPE(_PyObject_CAST(ob))
            |                               ^~~~~~~~~~~~~~
      exc_ops.c:86:52: note: in expansion of macro ‘Py_TYPE’
         86 |     return PyErr_GivenExceptionMatches((PyObject *)Py_TYPE(CPy_ExcState()->exc_value), type);
            |                                                    ^~~~~~~
      exc_ops.c:86:60: note: in expansion of macro ‘CPy_ExcState’
         86 |     return PyErr_GivenExceptionMatches((PyObject *)Py_TYPE(CPy_ExcState()->exc_value), type);
            |                                                            ^~~~~~~~~~~~
      In file included from exc_ops.c:8:
      exc_ops.c: In function ‘CPy_GetExcValue’:
      CPy.h:838:43: error: ‘PyThreadState’ {aka ‘struct _ts’} has no member named ‘exc_info’
        838 | #define CPy_ExcState() PyThreadState_GET()->exc_info
            |                                           ^~
      exc_ops.c:90:21: note: in expansion of macro ‘CPy_ExcState’
         90 |     PyObject *exc = CPy_ExcState()->exc_value;
            |                     ^~~~~~~~~~~~
      exc_ops.c: At top level:
      exc_ops.c:204:10: fatal error: internal/pycore_frame.h: No such file or directory
        204 | #include "internal/pycore_frame.h"
            |          ^~~~~~~~~~~~~~~~~~~~~~~~~
      compilation terminated.
      error: command '/usr/bin/gcc-11' failed with exit code 1
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for librt
Failed to build librt
error: failed-wheel-build-for-install

× Failed to build installable wheels for some pyproject.toml based projects
╰─> librt

To Reproduce

Install pypy3.11-7.3.20 with pyenv and run python3 -m pip install mypy==1.19.0.

Expected Behavior

Mypy is installed successful.

Actual Behavior

Installation fails with error mentioned above.

Your Environment

  • Docker image with Ubuntu 22.04
  • Mypy version used: 1.19.0
  • Python version used: pypy3.11-7.3.20

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Rechercherichtung

Mit PyPy 7.3.20 und python3 -m pip install mypy==1.19.0 reproduzieren und anschließend den fehlschlagenden C-extension-Build untersuchen, der CPy.h, pythonsupport.h, mypyc_util.h und exc_ops.c einbezieht. Zuerst das fehlende internal/pycore_frame.h und die gemeldeten PyPy-API-Inkompatibilitäten überprüfen. Die Aufgabe ist erledigt, wenn mypy 1.19.0 auf den angegebenen PyPy- und Python-Versionen erfolgreich installiert wird.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
c, python
Bereich
tooling
Issue-Typ
Bug
Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
35/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.