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

FIX: Account form stdbool.h being included in Python.h #184

Merged
merged 1 commit into from
Jan 25, 2022

Conversation

tacaswell
Copy link
Contributor

As of CPython 3.11 (via python/cpython#29883) stdbool.h is now included in Python.h so do attempt to redefine bool/true/false.

I was not sure the easiest way to add this to #178 nor if this is the preferred way to do this in c.

As of CPython 3.11 (via python/cpython#29883) stdbool.h
is now included in Python.h so do attempt to redefine bool/true/false.
Copy link
Member

@JelleZijlstra JelleZijlstra left a comment

Choose a reason for hiding this comment

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

Today I learned about __bool_true_false_are_defined. Apparently the C standard requires that that definition appear in stdbool.h.

@srittau srittau merged commit 36110cf into python:master Jan 25, 2022
@tacaswell tacaswell deleted the py311_compile branch January 25, 2022 14:41
@brandtbucher
Copy link
Member

brandtbucher commented Feb 17, 2022

Any chance we can get a release with this fix included? We'd like to use mypy/mypyc in our benchmark suite for measuring CPython performance improvements, but typed-ast currently won't build on 3.11.

(We can install from a git commit hash if not, but being able to pin a proper release seems better.)

@hauntsaninja
Copy link
Collaborator

Sure, I can make a release this weekend. Note that you shouldn't need typed_ast for mypy/c as long as you're using >=3.8 and don't want to check Python 2 code.

@brandtbucher
Copy link
Member

Note that you shouldn't need typed_ast for mypy/c as long as you're using >=3.8 and don't want to check Python 2 code.

Oh, interesting. Our benchmark is using an older mypy version where this doesn't seem to be the case (pinning a more modern version seems to fix the issue).

Thanks for your quick and helpful response!

@JelleZijlstra
Copy link
Member

How old is the version you're using? With newer versions of mypy you should be careful because they come precompiled with mypyc, which is good for mypy's speed but makes it less useful for benchmarking CPython. It's likely to be fine for 3.11 since we don't provide compiled wheels for 3.11, but it may come up if you're trying to compare with released versions.

@brandtbucher
Copy link
Member

The current version of the benchmark uses mypy==0.790 with typed-ast==1.4.1:

/~https://github.com/pyston/python-macrobenchmarks/blob/main/benchmarks/bm_mypy/requirements.txt

I was able to get it working again by using mypy==0.900 with typed-ast==1.4.1; python_version < "3.8".

If that's using mypyc, is there any way to force it to fall back to the pure-Python version?

@brandtbucher
Copy link
Member

(Congrats on your promotion, by the way!)

@JelleZijlstra
Copy link
Member

Looks like 0.790 already had mypyc wheels, but only up to 3.8: https://pypi.org/project/mypy/0.790/#files. You can avoid them by installing from the sdist, I think the pip invocation for that is pip install --no-binary=mypy.

(And thanks!)

@hauntsaninja
Copy link
Collaborator

Thanks again, this change was released in 1.5.3 #185

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.

6 participants