Skip to content

--enable-pystats build fails on main #127518

Closed
@mdboom

Description

@mdboom

Bug report

Bug description:

Python/specialize.c: In function ‘store_subscr_fail_kind’:
Python/specialize.c:1821:50: error: ‘PyObject’ {aka ‘struct _object’} has no member named ‘tp_as_mapping’
 1821 |     PyMappingMethods *as_mapping = container_type->tp_as_mapping;
      |                                                  ^~
Python/specialize.c:1826:30: error: ‘container’ undeclared (first use in this function)
 1826 |     if (PyObject_CheckBuffer(container)) {
      |                              ^~~~~~~~~
Python/specialize.c:1826:30: note: each undeclared identifier is reported only once for each function it appears in
In file included from ./Include/Python.h:63,
                 from Python/specialize.c:1:
Python/specialize.c:1827:31: error: ‘sub’ undeclared (first use in this function); did you mean ‘Sub’?
 1827 |         if (PyLong_CheckExact(sub) && (!_PyLong_IsNonNegativeCompact((PyLongObject *)sub))) {
      |                               ^~~
./Include/pyport.h:37:38: note: in definition of macro ‘_Py_CAST’
   37 | #define _Py_CAST(type, expr) ((type)(expr))
      |                                      ^~~~
./Include/object.h:284:43: note: in expansion of macro ‘_PyObject_CAST’
  284 | #  define Py_IS_TYPE(ob, type) Py_IS_TYPE(_PyObject_CAST(ob), (type))
      |                                           ^~~~~~~~~~~~~~
./Include/longobject.h:14:31: note: in expansion of macro ‘Py_IS_TYPE’
   14 | #define PyLong_CheckExact(op) Py_IS_TYPE((op), &PyLong_Type)
      |                               ^~~~~~~~~~
Python/specialize.c:1827:13: note: in expansion of macro ‘PyLong_CheckExact’
 1827 |         if (PyLong_CheckExact(sub) && (!_PyLong_IsNonNegativeCompact((PyLongObject *)sub))) {
      |             ^~~~~~~~~~~~~~~~~
Python/specialize.c:1830:39: error: ‘PyObject’ {aka ‘struct _object’} has no member named ‘tp_name’
 1830 |         else if (strcmp(container_type->tp_name, "array.array") == 0) {
      |                                       ^~
Python/specialize.c:1865:43: error: passing argument 1 of ‘_PyType_Lookup’ from incompatible pointer type [-Wincompatible-pointer-types]
 1865 |     PyObject *descriptor = _PyType_Lookup(container_type, &_Py_ID(__setitem__));
      |                                           ^~~~~~~~~~~~~~
      |                                           |
      |                                           PyObject * {aka struct _object *}
In file included from ./Include/object.h:754,
                 from ./Include/Python.h:72:
./Include/cpython/object.h:281:39: note: expected ‘PyTypeObject *’ {aka ‘struct _typeobject *’} but argument is of type ‘PyObject *’ {aka ‘struct _object *’}
  281 | PyAPI_FUNC(PyObject *) _PyType_Lookup(PyTypeObject *, PyObject *);
      |                                       ^~~~~~~~~~~~~~
Python/specialize.c: In function ‘_Py_Specialize_StoreSubscr’:
Python/specialize.c:1918:62: error: passing argument 1 of ‘store_subscr_fail_kind’ from incompatible pointer type [-Wincompatible-pointer-types]
 1918 |     SPECIALIZATION_FAIL(STORE_SUBSCR, store_subscr_fail_kind(container_type));
      |                                                              ^~~~~~~~~~~~~~
      |                                                              |
      |                                                              PyTypeObject * {aka struct _typeobject *}
Python/specialize.c:430:70: note: in definition of macro ‘SPECIALIZATION_FAIL’
  430 |         _Py_stats->opcode_stats[opcode].specialization.failure_kinds[kind]++; \
      |                                                                      ^~~~
Python/specialize.c:1819:34: note: expected ‘PyObject *’ {aka ‘struct _object *’} but argument is of type ‘PyTypeObject *’ {aka ‘struct _typeobject *’}
 1819 | store_subscr_fail_kind(PyObject *container_type)
      |                        ~~~~~~~~~~^~~~~~~~~~~~~~

CPython versions tested on:

CPython main branch

Operating systems tested on:

Linux

Linked PRs

Metadata

Metadata

Assignees

Labels

buildThe build process and cross-buildperformancePerformance or resource usagetype-bugAn unexpected behavior, bug, or error

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions