GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — `sysconfig --generate-posix-vars` can hang on cyclic variable definitions · Issue #136097 · python/cpython

sysconfig --generate-posix-vars can hang on cyclic variable definitions #136097

New issue
Copy link
New issue
Copy link
Closed
Closed
sysconfig --generate-posix-vars can hang on cyclic variable definitions#136097
Copy link
Assignees
serhiy-storchaka
Labels
buildThe build process and cross-buildThe build process and cross-buildstdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytopic-sysconfigtype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error

Description

@brianschubert
brianschubert
opened on Jun 29, 2025
Issue body actions

Bug report

Bug description:

This loop can run forever if there's a cycle in the Makefile variable definitions:

cpython/Lib/sysconfig/__main__.py

Line 79 in 5334732

while len(variables) > 0:

To reproduce:

make clean
echo 'foo=$(foo)' > ./Modules/Setup.local
./configure
make  # hangs forever

Or more minimally:

make clean
echo 'foo=$(foo)' > ./Modules/Setup.local
make Makefile
./python -m sysconfig --generate-posix-vars  # hangs forever

Longer cycles are also possible, e.g. v1=$(v2), v2=$(v3), ...., v999=$(v1).

Note that this is less of an issue if the recursive variable definition gets expanded in the Makefile before python -m sysconfig --generate-posix-vars gets invoked. In that case, Make will detect the cycle and exit before the infinite loop occurs.

@serhiy-storchaka you may be interested, this is very similar to #136073

CPython versions tested on:

CPython main branch

Operating systems tested on:

Linux

Linked PRs

  • gh-136097: Fix sysconfig._parse_makefile() #136166

Activity

  1. brianschubert
    added
    type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
    stdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directory
    buildThe build process and cross-buildThe build process and cross-build
    topic-sysconfig
    on Jun 29, 2025
  2. serhiy-storchaka
    self-assigned this
    on Jun 29, 2025
  3. serhiy-storchaka
    added a commit that references this issue on Jul 1, 2025

    pythongh-136097: Fix sysconfig._parse_makefile()

    967214c
  4. serhiy-storchaka commented on Jul 1, 2025

    @serhiy-storchaka
    serhiy-storchaka
    on Jul 1, 2025
    Member
    More actions

    Thank you for report. This is much complex code, and it is not always clear what behavior is correct.

    Recursive solution fixes the problem of infinite recursion and other bugs, but it introduces other problem -- stack consumption. If you create several hundred forward referencing variables, you can now get RecursionError. It would be possible to solve this using topological sorting, but I am not sure that it is worth to do this.

  5. serhiy-storchaka
    added a commit that references this issue on Jul 1, 2025

    pythongh-136097: Fix sysconfig._parse_makefile()

    3888755
  6. FFY00
    added a commit that references this issue on Oct 4, 2025

    gh-136097: Fix sysconfig._parse_makefile() (#136166)

    9e3542a
  7. danigm
    added a commit that references this issue on Oct 7, 2025

    pythongh-136097: Fix sysconfig._parse_makefile() (python#136166)

    328e5b9
  8. StanFromIreland
    closed this as completedon Aug 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

  • @serhiy-storchaka
    serhiy-storchaka

Labels

buildThe build process and cross-buildThe build process and cross-buildstdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytopic-sysconfigtype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    You are visitor 01402503 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.