This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Python should enable computed gotos on Mac by default
Type: behavior Stage: resolved
Components: macOS Versions: Python 3.10
process
Status: closed Resolution: works for me
Dependencies: Superseder:
Assigned To: Nosy List: benjamin.peterson, laike9m, ned.deily, ronaldoussoren
Priority: normal Keywords:

Created on 2020-05-27 07:13 by laike9m, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Messages (7)
msg370051 - (view) Author: laike9m (laike9m) * Date: 2020-05-27 07:13
Issue is described here with more details:
https://stackoverflow.com/q/61860463/2142577

Basically, when building on Mac, Python should enable computed gotos by default, because it is supported (https://stackoverflow.com/a/62037189/2142577).

The documentation(https://docs.python.org/3/whatsnew/3.2.html#build-and-c-api-changes) says
> Computed gotos are now enabled by default on supported compilers (which are detected by the configure script). They can still be disabled selectively by specifying --without-computed-gotos.

This seems to imply that the capability detection is wrong.
msg370082 - (view) Author: Benjamin Peterson (benjamin.peterson) * (Python committer) Date: 2020-05-27 13:50
The configure script sets the result of compiler probing with HAVE_COMPUTED_GOTOS not USE_COMPUTED_GOTOS.
msg370162 - (view) Author: laike9m (laike9m) * Date: 2020-05-28 03:07
Hi Benjamin, do you mean that disabling computed gotos on Mac is the expected behavior?
msg370166 - (view) Author: Ronald Oussoren (ronaldoussoren) * (Python committer) Date: 2020-05-28 07:24
The result of auto detection of computed gotos can be seen using the HAVE_COMPUTED_GOTOS macro, not the USE_... one. 

Computed gotos should work on macOS, and does on my machine.
msg370523 - (view) Author: laike9m (laike9m) * Date: 2020-06-01 00:41
Thanks Ronald. I wrote an answer to summarize what I got so far:

https://stackoverflow.com/a/62037189/2142577

There's nothing wrong with the current behavior, so nothing really needs to be changed. But we still lack a way for users to check whether computed gotos is enabled out of the box, and `HAVE_COMPUTED_GOTOS` can't do the job either since it only detects the compiler's capability.
msg370541 - (view) Author: Ronald Oussoren (ronaldoussoren) * (Python committer) Date: 2020-06-01 07:51
Looking at the source code at <https://github.com/python/cpython/blob/a871f692b4a2e6c7d45579693e787edc0af1a02c/Python/ceval.c#L1024>: computed gotos are enabled automatically when they are available.
msg370542 - (view) Author: laike9m (laike9m) * Date: 2020-06-01 07:57
You're right. The part I don't understand is how `--without-computed-gotos`
disabled the feature. Also I guess since this feature is meant to be
transparent to users, it's ok to not have a way to inspect it.

On Mon, Jun 1, 2020 at 12:51 AM Ronald Oussoren <report@bugs.python.org>
wrote:

>
> Ronald Oussoren <ronaldoussoren@mac.com> added the comment:
>
> Looking at the source code at <
> https://github.com/python/cpython/blob/a871f692b4a2e6c7d45579693e787edc0af1a02c/Python/ceval.c#L1024>:
> computed gotos are enabled automatically when they are available.
>
> ----------
>
> _______________________________________
> Python tracker <report@bugs.python.org>
> <https://bugs.python.org/issue40790>
> _______________________________________
>
History
Date User Action Args
2022-04-11 14:59:31adminsetgithub: 84967
2020-06-01 07:57:00laike9msetmessages: + msg370542
2020-06-01 07:51:48ronaldoussorensetmessages: + msg370541
2020-06-01 00:41:26laike9msetmessages: + msg370523
2020-05-28 07:24:01ronaldoussorensetmessages: + msg370166
2020-05-28 03:07:28laike9msetmessages: + msg370162
2020-05-27 13:50:45benjamin.petersonsetstatus: open -> closed

nosy: + benjamin.peterson
messages: + msg370082

resolution: works for me
stage: resolved
2020-05-27 07:13:03laike9mcreate