Skip to content

sysconfig gives misleading results for USE_COMPUTED_GOTOS #57449

Open

Description

@florentx
mannequin
BPO 13240
Nosy @pitrou, @vstinner, @merwok, @florentx, @meadori
Files
  • issue13240.patch: Patch v0 against tip (3.3.0a0)
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = None
    closed_at = None
    created_at = <Date 2011-10-21.14:41:25.714>
    labels = ['3.8', 'type-bug', 'library', '3.9', '3.10']
    title = 'sysconfig gives misleading results for USE_COMPUTED_GOTOS'
    updated_at = <Date 2020-11-16.19:30:57.509>
    user = 'https://github.com/florentx'

    bugs.python.org fields:

    activity = <Date 2020-11-16.19:30:57.509>
    actor = 'iritkatriel'
    assignee = 'none'
    closed = False
    closed_date = None
    closer = None
    components = ['Library (Lib)']
    creation = <Date 2011-10-21.14:41:25.714>
    creator = 'flox'
    dependencies = []
    files = ['23503']
    hgrepos = []
    issue_num = 13240
    keywords = ['patch']
    message_count = 12.0
    messages = ['146090', '146097', '146099', '146100', '146105', '146106', '146107', '146108', '146109', '146235', '146376', '146408']
    nosy_count = 5.0
    nosy_names = ['pitrou', 'vstinner', 'eric.araujo', 'flox', 'meador.inge']
    pr_nums = []
    priority = 'normal'
    resolution = None
    stage = None
    status = 'open'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue13240'
    versions = ['Python 3.8', 'Python 3.9', 'Python 3.10']

    Linked PRs

    Activity

    1. vstinner commented on Oct 21, 2011

      @vstinner
      Member

      Computed goto are disabled (in my Python 3.3 on Linux with GCC),
      I checked by adding #error to ceval.c.

      Hum, I don't understand how, but I missed the #error failure. Computed goto *are enabled* by default.

    2. meadori commented on Oct 23, 2011

      @meadori
      Member

      Actually, I think sysconfig does the right thing when it comes to all
      the configure-generated HAVE_XXX variables

      I agree. The 'configure' script could be improved, though. If we truly
      want to enable this by default, then the defaulting should be moved to
      configure. This will give a more accurate portrayal in sysconfig.
      Also, we can do the USE but !HAVE check in configure, which is better
      anyway because the error is caught earlier.

      I am thinking something like the attached. Thoughts?

      P.S. We could probably get rid of the HAVE macro all together by doing
      all the work in the 'configure' script.

    3. merwok commented on Oct 25, 2011

      @merwok
      Member

      If we truly want to enable this by default, then the defaulting should be moved to
      configure. This will give a more accurate portrayal in sysconfig.

      This sounds good. (I know little about configure/pyconfig.h, but making sysconfig more accurate is a valuable result.)

      P.S. We could probably get rid of the HAVE macro all together by doing
      all the work in the 'configure' script.

      Would that be a breach of backward compatibility for sysconfig?

    4. meadori commented on Oct 26, 2011

      @meadori
      Member

      > P.S. We could probably get rid of the HAVE macro all together by doing
      > all the work in the 'configure' script.
      Would that be a breach of backward compatibility for sysconfig?

      Yeah, I think so. Best to leave it alone then.

    5. added
      3.8 (EOL)
      3.9 (EOL)
      3.10 (EOL)
      on Nov 16, 2020
    6. transferred this issue fromon Apr 10, 2022
    7. added and removed
      3.10 (EOL)
      3.9 (EOL)
      3.8 (EOL)
      on Apr 29, 2023
    8. arhadthedev commented on Apr 29, 2023

      @arhadthedev
      Member

      Is the issue still reprodusible on OS X?

    9. ronaldoussoren commented on May 2, 2023

      @ronaldoussoren
      Contributor

      Is the issue still reprodusible on OS X?

      % python                                                                                                                                  (master)pyobjc-8
      Python 3.11.3 (v3.11.3:f3909b8bc8, Apr  4 2023, 20:12:10) [Clang 13.0.0 (clang-1300.0.29.30)] on darwin
      Type "help", "copyright", "credits" or "license" for more information.
      >>> from sysconfig import get_config_var
      >>> get_config_var('HAVE_COMPUTED_GOTOS')
      1
      >>> get_config_var('USE_COMPUTED_GOTOS')
      1
      >>> 

      This is with the 3.11.3 installed from python.org. So no, this doesn't seem to be reproducible on macOS.

    10. ronaldoussoren commented on Jun 24, 2023

      @ronaldoussoren
      Contributor

      Dropping the os-mac label because this isn't a Mac-specific issue.

    11. vasiliyk commented on Oct 22, 2026

      @vasiliyk
      Contributor

      Still reproducible on 3.16.0a1+dev:

      >>> from sysconfig import get_config_var
      >>> get_config_var('HAVE_COMPUTED_GOTOS')
      1
      >>> get_config_var('USE_COMPUTED_GOTOS')
      0

      configure leaves USE_COMPUTED_GOTOS undefined in pyconfig.h.
      sysconfig reads that as 0, but Python/ceval_macros.h treats it as 1, so computed gotos are actually enabled.

      The fix agreed above still applies:
      let configure.ac define USE_COMPUTED_GOTOS to 1 when no option is given and the compiler supports it.

      I will open a PR for this.

    12. vasiliyk commented on Nov 24, 2026

      @vasiliyk
      Contributor

      With PR configure.ac defines USE_COMPUTED_GOTOS to 1 when no option is given and the compiler supports it.

      --with-computed-gotos and --without-computed-gotos still give 1 and 0.

    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

    Metadata

    Metadata

    Assignees

    No one assigned

      Labels

      stdlibtype-bug

      Projects

      No projects

        Milestone

        No milestone

        Relationships

        None yet

        Development

        No branches or pull requests

        Issue actions