-
Notifications
You must be signed in to change notification settings - Fork 7
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
Fix build for Python 3.12 #31
Fix build for Python 3.12 #31
Conversation
For all functions/objects of distutils that haven't been directly replaced by a setuptools implementation yet, there is a complete copy of distutils inside of it.
@mdavidsaver How do you feel about these changes? |
bd99dfb
to
f098023
Compare
I would like for setuptools-dso to continue to support as wide a range of python versions as is practical. I do not think I could accept a change to only support the latest cpython series. |
I did have another look at it. I reworked the import try/excepts that were there before and they seem to work (I have locally imported this into a local project and it appears to build and run with 3.12). |
0f5e9c2
to
bc5bd66
Compare
@mdavidsaver I have tried to reproduced this
And got the output:
Do you have ideas why it could be faiiling on the Actions Runner? EDIT: It seemed like this line was failing silently for some reason, as the next line it tried to open the "eval_macros_out.c" file it generates, but the build error states that the file doesn't exist: |
Can you compare setuptools versions? My first suspicion would be that my hacky logic to patch in |
So it seems like the Actions build is using setuptools 69.5.1 This is the same as the version on my local Windows Server 2022 Standard environment
What is even more weird is that from investigsting further, the
|
@mdavidsaver could it be worth re-running the two failing builds to see if they have the same outcome? |
I made a rookie mistake, I was working on the wrong branch on the local Windows server. |
@mdavidsaver you were right, the issue is associated with patching I can confirm that the
Output:
The only thing I can think of is that the check sees they are at different memory addresses and determines they must be different. Unless it's down to how the The only success I have had is to compare their qualified names, e.g. if compiler.__class__.preprocess.__qualname__ == CCompiler.preprocess.__qualname__: which does return True. EDIT: if compiler.__class__.preprocess.__code__ == CCompiler.preprocess.__code__: |
e22369f
to
791afe2
Compare
hmmm. I wonder what monkey patching is going on? Presumably
|
Yeah this is the case, not sure why though as I thought it would always be True too...
So print(inspect.getsourcefile(CCompiler))
print(inspect.getsourcefile(compiler.__class__))
print(inspect.getsourcefile(compiler.preprocess)) returns
which shows it is using the default impl... |
I've done some digging into this problem, and it all comes down to the fact that The issue is that when we get a
So none of the inheritance/instance checks will ever work, as functionally these are two separate classes with different method chains. The fix appears to be simple; as
Unconditionally, outside of the current fix's try-except parsing. This seems to have some support from the setuptools maintainers, and so doesn't seem like the worst fix to do... |
It is worth noting this is only the case when |
Seems like the |
50ca8d5
to
7fe9159
Compare
@mdavidsaver I ran the actions workflow on my forked repo and all the tests/builds passed. What do you think of the changes? |
@mdavidsaver have you had a chance to look at these changes since your last comment? I know of some people who are interested in Python 3.12 support. 🙂 |
I'm sorry I have been short on time recently. Before merging I would like to get test results for building |
@mdavidsaver I decided to build these packages with Python 3.8 and 3.12 to see that they worked with this branch of
I found an issue on |
No I don't think so. Not with any of the Debian builds I have used. I had GHA re-run with Which specific cpython and nose versions are involved? (In case this is a .0 situation like epics-base/p4p#98 (comment))
I don't understand how It might be worth wrapping this line with Or to replace this line with the following to, maybe, see how _before = list(sys.modules)
try:
self.assertWarns(UserWarning, fn) # warns of empty choices
except:
self.assertListEqual(_before, list(sys.modules))
raise If neither turns up anything interesting, then I can only suggest testing with a different environment. (eg. docker/podman w/ |
Cython = 3.0.10
Using this seems to suggest during the execution the
|
After following the Python Build commands listed in https://github.com/mdavidsaver/p4p/blob/70b030de2f30cf690bb317429f59bd092e65420e/.github/workflows/build.yml |
@mdavidsaver can we merge this and make an alpha release please? Does it make sense to add me, @OCopping and @AlexanderWells-diamond to all the relevant modules so we can make alpha releases of the whole stack now? |
Uploaded as 2.11a2. Thank you all for your patience... |
As of Python 3.12,
distutils
has been fully deprecated and removed from stlib. This PR aims to replace all imports ofdistutils
with either a direct replacement insetuptools
, or to use the exact copy of the function/object in the copy ofdistutils
inside of setuptools.Fixes #24