Title: getpath miscalculates sys.path from second initialization with PYTHONHOME on Windows · Issue #91985 · python/cpython · GitHub
Open Graph Title: getpath miscalculates sys.path from second initialization with PYTHONHOME on Windows · Issue #91985 · python/cpython
X Title: getpath miscalculates sys.path from second initialization with PYTHONHOME on Windows · Issue #91985 · python/cpython
Description: When I ran the code below in a python build directory: #include
Open Graph Description: When I ran the code below in a python build directory: #include
X Description: When I ran the code below in a python build directory: #include <Python.h> int main(int argc, char *argv[]) { PyConfig config; PyConfig_InitPythonConfig(&config); for (int i=0; i < 3; ...
Opengraph URL: https://github.com/python/cpython/issues/91985
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"getpath miscalculates sys.path from second initialization with PYTHONHOME on Windows","articleBody":"When I ran the code below in a python build directory:\r\n```\r\n#include \u003cPython.h\u003e\r\nint\r\nmain(int argc, char *argv[])\r\n{\r\n PyConfig config;\r\n PyConfig_InitPythonConfig(\u0026config);\r\n for (int i=0; i \u003c 3; i++) {\r\n printf(\"\\n%d\\n\", i);\r\n Py_InitializeFromConfig(\u0026config);\r\n PyRun_SimpleString(\"import sys; list(map(print, sys.path))\");\r\n Py_Finalize();\r\n }\r\n PyConfig_Clear(\u0026config);\r\n return 0;\r\n}\r\n```\r\n* Expected results without `PYTHONHOME`:\r\n```\r\n0\r\nC:\\cpython-main\\PCbuild\\amd64\\python311.zip\r\nC:\\cpython-main\\Lib\r\nC:\\cpython-main\\PCbuild\\amd64\r\nC:\\cpython-main\r\nC:\\cpython-main\\Lib\\site-packages\r\n\r\n1\r\nC:\\cpython-main\\PCbuild\\amd64\\python311.zip\r\nC:\\cpython-main\\Lib\r\nC:\\cpython-main\\PCbuild\\amd64\r\nC:\\cpython-main\r\nC:\\cpython-main\\Lib\\site-packages\r\n\r\n2\r\nC:\\cpython-main\\PCbuild\\amd64\\python311.zip\r\nC:\\cpython-main\\Lib\r\nC:\\cpython-main\\PCbuild\\amd64\r\nC:\\cpython-main\r\nC:\\cpython-main\\Lib\\site-packages\r\n```\r\n\r\n* `set PYTHONHOME=C:\\cpython-main`:\r\n```\r\n0\r\nC:\\cpython-main\\PCbuild\\amd64\\python311.zip\r\nC:\\cpython-main\\Lib\r\nC:\\cpython-main\\PCbuild\\amd64\r\nC:\\cpython-main\r\nC:\\cpython-main\\Lib\\site-packages\r\n\r\n1\r\nC:\\cpython-main\\PCbuild\\amd64\\python311.zip\r\nC:\\cpython-main\\Lib\r\nC:\\cpython-main\\DLLs # \u003c\u003c\u003c\u003c\u003c\u003c\u003c\u003c\u003c\u003c unexpected\r\nC:\\cpython-main\r\nC:\\cpython-main\\Lib\\site-packages\r\n\r\n2\r\nC:\\cpython-main\\PCbuild\\amd64\\python311.zip\r\nC:\\cpython-main\\Lib\r\nC:\\cpython-main\\DLLs # \u003c\u003c\u003c\u003c\u003c\u003c\u003c\u003c\u003c\u003c unexpected\r\nC:\\cpython-main\r\nC:\\cpython-main\\Lib\\site-packages\r\n```\r\nCurrently, test_embed fails due to this. (#32313)","author":{"url":"https://github.com/neonene","@type":"Person","name":"neonene"},"datePublished":"2022-04-27T12:56:16.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":12},"url":"https://github.com/91985/cpython/issues/91985"}
| 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:206a462d-ced3-41bd-f79b-563c8009e389 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 8CFA:29F2E0:30935F:424DC4:696966B9 |
| html-safe-nonce | f3589435ecd86858c5f80fc54e56db2f94d135142df564546010a1aeddc55049 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4Q0ZBOjI5RjJFMDozMDkzNUY6NDI0REM0OjY5Njk2NkI5IiwidmlzaXRvcl9pZCI6IjUyODE0MzMyNzMxODk4ODU2MjUiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 37d2ef3514f7392d0aa1214b80aa75f2e9f3a4edcd7372a6757d0df14296c57d |
| hovercard-subject-tag | issue:1217319192 |
| 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/91985/issue_layout |
| twitter:image | https://opengraph.githubassets.com/dc076f3942b4f9424f9500104d866fb429398280dc2da890486b637f7158ad96/python/cpython/issues/91985 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/dc076f3942b4f9424f9500104d866fb429398280dc2da890486b637f7158ad96/python/cpython/issues/91985 |
| og:image:alt | When I ran the code below in a python build directory: #include |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | neonene |
| hostname | github.com |
| expected-hostname | github.com |
| None | c6f193beb8ff08443adc07685d75302ab8aaf0a135f6e251c3ff3112c8deb881 |
| 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 | ec4d88fbe7ed62446d90b0a6d8e6db4248a8f8b8 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width