Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compilation breaks on Python 3.11.0a7 in PyFrame_GetLasti #32

Closed
icemac opened this issue Apr 27, 2022 · 6 comments
Closed

Compilation breaks on Python 3.11.0a7 in PyFrame_GetLasti #32

icemac opened this issue Apr 27, 2022 · 6 comments

Comments

@icemac
Copy link

icemac commented Apr 27, 2022

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.

@vstinner
Copy link
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: nedbat/coveragepy#1353

@vstinner vstinner reopened this Apr 27, 2022
@vstinner
Copy link
Member

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

@icemac
Copy link
Author

icemac commented Apr 29, 2022

@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!

@vstinner
Copy link
Member

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

@icemac
Copy link
Author

icemac commented Jun 24, 2022

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.

@vstinner
Copy link
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
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants