Skip to content

Compilation breaks on Python 3.11.0a7 in PyFrame_GetLasti #32

Description

@icemac

Using the latest version of pythoncapi_compat.h currently breaks on Python 3.11.0a7.
I have seen this on GHA for Ubuntu and MacOS and locally on MacOS:

src/zope/container/_compat.h:254:14: error: incomplete definition of type 'struct _frame'
    if (frame->f_lasti < 0) {
        ~~~~~^
/Users/runner/hostedtoolcache/Python/3.11.0-alpha.7/x64/include/python3.11/pytypedefs.h:22:16: note: forward declaration of 'struct _frame'
typedef struct _frame PyFrameObject;
               ^
In file included from src/zope/container/_zope_container_contained.c:34:
src/zope/container/_compat.h:257:17: error: incomplete definition of type 'struct _frame'
    return frame->f_lasti * 2;
           ~~~~~^

See https://github.com/zopefoundation/zope.container/runs/6188321544?check_suite_focus=true#step:7:61 where pythoncapi_compat.h is src/zope/container/_compat.h.

Activity

  1. vstinner commented on Apr 27, 2022

    @vstinner
    Member

    If you don't need the latest enhancements of pythoncapi_compat.h, just keep your old version.

    Sadly, the new version is not compatible with Python 3.11 alpha versions. PyFrameObject got a lot of changes in alpha versions. Hopefully, new public getter functions were added to solve most issues: https://docs.python.org/dev/c-api/frame.html Problem: implementing these getter functions for early alpha versions would require a lot of code in pythoncapi_compat.h, and I chose to not do that.

    Workaround if you need to update pythoncapi_compat.h: manually remove the PyFrame functions which cause you build errors. Does it sound like a reasonable workaround to you? That's the approach that I adopted in my coverage PR: coveragepy/coveragepy#1353

  2. vstinner commented on Apr 27, 2022

    @vstinner
    Member

    (Oops, I clicked on the wrong button by mistake, I didn't want to close the issue.)

  3. icemac commented on Apr 29, 2022

    @icemac
    Author

    @vstinner Thank you for your explanation. It seems that I do not need PyFrame_GetLasti – at least in zope.container.

    Thank you for your hard work on the compatibility side!

  4. vstinner commented on Jun 14, 2022

    @vstinner
    Member

    Python 3.11 beta3 is now released: can you update to a newer Python 3.11?

  5. icemac commented on Jun 24, 2022

    @icemac
    Author

    I am trying to do so in zopefoundation/zope.container#45, but there are several other problems which arose over night in Python 3.10 and need to be fixed beforehand.

  6. vstinner commented on Jun 24, 2022

    @vstinner
    Member

    It seems to be unrelated to pythoncapi-compat. I close the issue.

    Supporting alpha versions of Python 3.11 is too complicated. To get Python 3.11, use beta1 or newer.

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