GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Py_GetConstant compatibility breaking numpy build · Issue #89 · python/pythoncapi-compat

Py_GetConstant compatibility breaking numpy build #89

New issue
Copy link
New issue
Copy link
Closed
Closed
Py_GetConstant compatibility breaking numpy build#89
Copy link

Description

@tacaswell
tacaswell
opened on Apr 4, 2024
Issue body actions

Which looks like a collaboration of python/cpython#116883 and #87

FAILED: numpy/_core/_multiarray_umath.cpython-313-x86_64-linux-gnu.so.p/meson-generated_scalartypes.c.o
ccache cc -Inumpy/_core/_multiarray_umath.cpython-313-x86_64-linux-gnu.so.p -Inumpy/_core -I../numpy/_core -Inumpy/_core/include -I../numpy/_core/include -I../numpy/_core/src/common -I../numpy/_core/src/multiarray -I../numpy/_core/src/npymath -I../numpy/_core/src/umath -I/opt/intel/oneapi/mkl/latest/include -I/home/tcaswell/.pybuild/py313/include/python3.13 -I/tmp/build-via-sdist-qfvwz43e/numpy-2.1.0.dev0/.mesonpy-jctwrujm/meson_cpu -fvisibility=hidden -fdiagnostics-color=always -DNDEBUG -Wall -Winvalid-pch -std=c11 -O3 -fno-strict-aliasing -msse -msse2 -msse3 -mssse3 -msse4.1 -mpopcnt -msse4.2 -mavx -mf16c -mfma -mavx2 -DNPY_HAVE_SSE2 -DNPY_HAVE_SSE -DNPY_HAVE_SSE3 -DNPY_HAVE_SSSE3 -DNPY_HAVE_SSE41 -DNPY_HAVE_POPCNT -DNPY_HAVE_SSE42 -DNPY_HAVE_AVX -DNPY_HAVE_F16C -DNPY_HAVE_FMA3 -DNPY_HAVE_AVX2 -Wall -O2 -pipe -fomit-frame-pointer -fno-strict-aliasing -Wmaybe-uninitialized -Wdeprecated-declarations -Wimplicit-function-declaration -march=native -DCYTHON_FAST_THREAD_STATE=0 -fPIC -DHAVE_CBLAS -DNPY_INTERNAL_BUILD -DHAVE_NPY_CONFIG_H -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE=1 -D_LARGEFILE64_SOURCE=1 -MD -MQ numpy/_core/_multiarray_umath.cpython-313-x86_64-linux-gnu.so.p/meson-generated_scalartypes.c.o -MF numpy/_core/_multiarray_umath.cpython-313-x86_64-linux-gnu.so.p/meson-generated_scalartypes.c.o.d -o numpy/_core/_multiarray_umath.cpython-313-x86_64-linux-gnu.so.p/meson-generated_scalartypes.c.o -c numpy/_core/_multiarray_umath.cpython-313-x86_64-linux-gnu.so.p/scalartypes.c
In file included from ../numpy/_core/src/common/npy_pycompat.h:5,
                 from ../numpy/_core/src/multiarray/scalartypes.c.src:16:
../numpy/_core/src/common/pythoncapi-compat/pythoncapi_compat.h:1227:25: error: static declaration of ‘Py_GetConstant’ follows non-static declaration
 1227 | static inline PyObject* Py_GetConstant(unsigned int constant_id)
      |                         ^~~~~~~~~~~~~~
In file included from /home/tcaswell/.pybuild/py313/include/python3.13/Python.h:58,
                 from ../numpy/_core/src/multiarray/scalartypes.c.src:3:
/home/tcaswell/.pybuild/py313/include/python3.13/object.h:1088:23: note: previous declaration of ‘Py_GetConstant’ with type ‘PyObject *(unsigned int)’ {aka ‘struct _object *(unsigned int)’}
 1088 | PyAPI_FUNC(PyObject*) Py_GetConstant(unsigned int constant_id);
      |                       ^~~~~~~~~~~~~~
../numpy/_core/src/common/pythoncapi-compat/pythoncapi_compat.h:1280:25: error: static declaration of ‘Py_GetConstantBorrowed’ follows non-static declaration
 1280 | static inline PyObject* Py_GetConstantBorrowed(unsigned int constant_id)
      |                         ^~~~~~~~~~~~~~~~~~~~~~
/home/tcaswell/.pybuild/py313/include/python3.13/object.h:1089:23: note: previous declaration of ‘Py_GetConstantBorrowed’ with type ‘PyObject *(unsigned int)’ {aka ‘struct _object *(unsigned int)’}
 1089 | PyAPI_FUNC(PyObject*) Py_GetConstantBorrowed(unsigned int constant_id);
      |                       ^~~~~~~~~~~~~~~~~~~~~~
[209/412] C

but I have not any debugging other than to try building with 5a76d1be8ef371b75ca65166726923c249b5f615 (with c4bf58a14f162557038a1535ca22c52b49d81d7b cherry-picked on) for CPython (which worked) and pushing the numpy's submodule of this repo back one commit (which worked).

It does not appear that numpy otherwise uses these symbols, but I have not tracked down if this is a "numpy is using it wrong" problem or this project is confliting with cpython problem.

attn @rgommers

Activity

  1. vstinner commented on Apr 4, 2024

    @vstinner
    vstinner
    on Apr 4, 2024
    Member
    More actions

    Hi, which Python 3.13 version are you testing exactly? Are you testing a Python 3.13 release or the main development branch?

  2. tacaswell commented on Apr 4, 2024

    @tacaswell
    tacaswell
    on Apr 4, 2024
    Author
    More actions

    main branch

  3. vstinner commented on Apr 4, 2024

    @vstinner
    vstinner
    on Apr 4, 2024
    Member
    More actions

    Why are you testing the main branch instead of 3.13 alpha releases?

    pythoncapi-compat.h doesn't work well with the main branch (between alpha0 and beta1), while C API functions are being added. It's uneasy to check if a function is available or not, since Include/patchlevel.h macros are the same between 3.13.0a5 release and 3.13.0a5+ (current main branch), except of the PY_VERSION constant which is a string (cannot be used in the preprocessor).

  4. vstinner commented on Apr 4, 2024

    @vstinner
    vstinner
    on Apr 4, 2024
    Member
    More actions

    If you embed a copy of pythoncapi-compat.h, you can just remove Py_GetConstant() from your copy for now, until Python 3.13.0a6 is released (or until a solution is found in pythoncapi-compat.h).

    Py_GetConstant() is only needed in pythoncapi-compat.h if you plan to use Py_GetConstant() with Python 3.12 and older.

  5. vstinner
    added a commit that references this issue on Apr 4, 2024

    gh-89: Fix Py_GetConstant() for Python 3.13.0a5+

    68aad45
  6. vstinner commented on Apr 4, 2024

    @vstinner
    vstinner
    on Apr 4, 2024
    Member
    More actions

    Ok, I fixed the issue with the change commit 68aad45. Thanks for the bug report @tacaswell.

    These issues should not happen with regular 3.x.y minor and bugfix releases, only with alpha releases.

    I usually attempt to avoid them for people who are following closely the main branch.

    Reacted by Thomas A Caswell
  7. vstinner
    closed this as completedon Apr 4, 2024
  8. tacaswell commented on Apr 4, 2024

    @tacaswell
    tacaswell
    on Apr 4, 2024
    Author
    More actions

    Why are you testing the main branch instead of 3.13 alpha releases?

    Because everyone needs a hobby 🤣 https://github.com/tacaswell/build_the_world

    I can confirm that this fixes numpy.

    Reacted by Victor Stinner
    Reacted by Miro Hrončok
    Reacted by Victor Stinner and Erlend E. Aasland
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402503 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.