Skip to content
This repository has been archived by the owner on Jul 5, 2023. It is now read-only.

Allow compilation on python 3.10.0a6 #155

Merged
merged 2 commits into from Mar 7, 2021
Merged

Allow compilation on python 3.10.0a6 #155

merged 2 commits into from Mar 7, 2021

Conversation

Theelx
Copy link
Contributor

@Theelx Theelx commented Mar 3, 2021

It seems that pydebug.h and pyarena.h were moved from /Include/ to /Include/cpython/ in the latest 3.10 alpha (a6).

@the-knights-who-say-ni
Copy link

Hello, and thanks for your contribution!

I'm a bot set up to make sure that the project can legally accept this contribution by verifying everyone involved has signed the PSF contributor agreement (CLA).

Recognized GitHub username

We couldn't find a bugs.python.org (b.p.o) account corresponding to the following GitHub usernames:

@Theelgirl

This might be simply due to a missing "GitHub Name" entry in one's b.p.o account settings. This is necessary for legal reasons before we can look at this contribution. Please follow the steps outlined in the CPython devguide to rectify this issue.

You can check yourself to see if the CLA has been received.

Thanks again for the contribution, we look forward to reviewing it!

@Theelx
Copy link
Contributor Author

Theelx commented Mar 3, 2021

Just signed the CLA, waiting the "one business day" now for it to be processed.

Copy link
Collaborator

@hauntsaninja hauntsaninja left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for this!

#endif /* PGEN */

#if PY_MINOR_VERSION >= 10
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://docs.python.org/dev/whatsnew/3.10.html#id2 says we can just include Python.h instead, which we already do. So let's only include pydebug.h if PY_MINOR_VERSION < 10...
Actually, I just checked Python 3.5's Python.h (the oldest Python typed_ast supports) and it includes both pydebug and pyarena. So I think we can just remove the troublesome includes entirely?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's possible, I didn't think of that because I don't know C. I'll test that out.

@gvanrossum
Copy link
Member

I've tested this with Python 3.10a6 in a few places, and it's not quite 100% successful.

  1. On Windows 10 it works.
  2. On macOS 11.2.2 it does not work. I get many errors during compilation including #error architecture not supported. Note that my Mac is an Intel Mac, but the compiler apparently tries to compile for the new Apple CPU as well, and fails. Now I realize I have an old version of Xcode installed, so I'll try to refresh that and see how it goes. (If anyone remembers how to install the latest command line compilers without first installing Xcode let me know -- it's an uncomfortably large download and I never use the UI.)

I'll get back here if I get it compiling on macOS.

@gvanrossum
Copy link
Member

Well, according to https://devguide.python.org/setup/#macos-and-os-x I should just run xcode-select --install, which tells me to go use "Software Update" instead, which tells me I'm up to date. Still waiting for Xcode download to finish...

@Theelx
Copy link
Contributor Author

Theelx commented Mar 7, 2021

Have you tried the previous version of my PR, where I encased the problematic includes in an if check for python 3.10? I don't know any C or anything in depth about compilers, so that might not work, but the way I see it, its worth a shot.

Edit: Could it be an incompatibility introduced by supporting the M1 chip? Have you tried this on other python versions that support M1?

@hauntsaninja
Copy link
Collaborator

This works fine for me on macOS 10.15.7, so I propose merging and figuring out support for Apple Silicon in another place.
I don't know much about Apple Silicon, but might be worth looking at what cibuildwheel does, e.g. does this get things compiling for you? https://github.com/joerick/cibuildwheel/blob/c9451facbd7a4bb54d580a093c9e381d524c6170/cibuildwheel/macos.py#L248

@gvanrossum
Copy link
Member

Okay, will merge, and mark as closing #156. And I'll open a separate ticket for Apple Silicon.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants