Title: `sysconfig --generate-posix-vars` can hang on cyclic variable definitions · Issue #136097 · python/cpython · GitHub
Open Graph Title: `sysconfig --generate-posix-vars` can hang on cyclic variable definitions · Issue #136097 · python/cpython
X Title: `sysconfig --generate-posix-vars` can hang on cyclic variable definitions · Issue #136097 · python/cpython
Description: 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)' > ./...
Open Graph Description: 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 repr...
X Description: 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: ...
Opengraph URL: https://github.com/python/cpython/issues/136097
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"`sysconfig --generate-posix-vars` can hang on cyclic variable definitions","articleBody":"# Bug report\n\n### Bug description:\n\nThis loop can run forever if there's a cycle in the Makefile variable definitions:\nhttps://github.com/python/cpython/blob/5334732f9c8a44722e4b339f4bb837b5b0226991/Lib/sysconfig/__main__.py#L79\n\nTo reproduce:\n```shell\nmake clean\necho 'foo=$(foo)' \u003e ./Modules/Setup.local\n./configure\nmake # hangs forever\n```\nOr more minimally:\n```shell\nmake clean\necho 'foo=$(foo)' \u003e ./Modules/Setup.local\nmake Makefile\n./python -m sysconfig --generate-posix-vars # hangs forever\n```\nLonger cycles are also possible, e.g. `v1=$(v2)`, `v2=$(v3)`, ...., `v999=$(v1)`.\n\n\nNote 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.\n\n@serhiy-storchaka you may be interested, this is very similar to #136073\n\n### CPython versions tested on:\n\nCPython main branch\n\n### Operating systems tested on:\n\nLinux\n\n\u003c!-- gh-linked-prs --\u003e\n### Linked PRs\n* gh-136166\n\u003c!-- /gh-linked-prs --\u003e\n","author":{"url":"https://github.com/brianschubert","@type":"Person","name":"brianschubert"},"datePublished":"2025-06-29T12:40:41.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":1},"url":"https://github.com/136097/cpython/issues/136097"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:d448b076-613a-f366-6961-393256dfb5c0 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | A6CA:ECDF9:10945D4:16ED581:696A9404 |
| html-safe-nonce | dd1c45cd42e42b6575f4aa0d3371bcdd9b12a05ab7fd774d3ac33fe660644fa9 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBNkNBOkVDREY5OjEwOTQ1RDQ6MTZFRDU4MTo2OTZBOTQwNCIsInZpc2l0b3JfaWQiOiIxNTU5MDM0NzA2MTc2NjI0NjgiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | bcde7d1052af80c2518d4ec023f2a06c0444222c2eba1c7b41b885a61695bf5e |
| hovercard-subject-tag | issue:3186130546 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/python/cpython/136097/issue_layout |
| twitter:image | https://opengraph.githubassets.com/f03e8a5c32dd894db80f5ecb2038b0e5066c5df78eb6e134a8a876ad4198512c/python/cpython/issues/136097 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/f03e8a5c32dd894db80f5ecb2038b0e5066c5df78eb6e134a8a876ad4198512c/python/cpython/issues/136097 |
| og:image:alt | 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 repr... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | brianschubert |
| hostname | github.com |
| expected-hostname | github.com |
| None | 4dd496afc954da9c207b2d9fbe86e3074619f565754aa1d9274aec30d9e5b8d7 |
| turbo-cache-control | no-preview |
| go-import | github.com/python/cpython git https://github.com/python/cpython.git |
| octolytics-dimension-user_id | 1525981 |
| octolytics-dimension-user_login | python |
| octolytics-dimension-repository_id | 81598961 |
| octolytics-dimension-repository_nwo | python/cpython |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 81598961 |
| octolytics-dimension-repository_network_root_nwo | python/cpython |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 31496a13b80a2f6ad77d6c617ee2255a3545b539 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width