Title: Are static library builds on Windows still supported? · Issue #110234 · python/cpython · GitHub
Open Graph Title: Are static library builds on Windows still supported? · Issue #110234 · python/cpython
X Title: Are static library builds on Windows still supported? · Issue #110234 · python/cpython
Description: Bug report Bug description: This is a followup from #110049 (comment), where @colesbury pointed out that we are assuming in a couple places that Windows builds are using a shared library. I think this might steam from the "availability" ...
Open Graph Description: Bug report Bug description: This is a followup from #110049 (comment), where @colesbury pointed out that we are assuming in a couple places that Windows builds are using a shared library. I think t...
X Description: Bug report Bug description: This is a followup from #110049 (comment), where @colesbury pointed out that we are assuming in a couple places that Windows builds are using a shared library. I think t...
Opengraph URL: https://github.com/python/cpython/issues/110234
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Are static library builds on Windows still supported?","articleBody":"# Bug report\r\n\r\n### Bug description:\r\n\r\nThis is a followup from https://github.com/python/cpython/pull/110049#discussion_r1340595301, where @colesbury pointed out that we are assuming in a couple places that Windows builds are using a shared library.\r\n\r\nI think this might steam from the \"availability\" section of the `sys.dllhandle` documentation only stating \"Windows\".\r\n\r\nIf static library builds on Windows are still supported, we should document that `sys.dllhandle` will only be available on shared library Windows builds.\r\n\r\nThis likely hasn't come up until now because we don't test this in the CI. AFAICT this is a \"best-effort\" option, where we are not really paying much attention to it, but will try to fix bugs if reported. It'd probably make sense to document that somewhere.\r\n\r\nBut with this going unnoticed for a while, it also raises the question, do we even want to support this use-case? The maintenance is minimal, so IMO it should be fine, but we definitely need to fix the `sys.dllhandle` documentation.\r\n\r\n---\r\n\r\n### Possibly problematic code\r\n\r\n#### ctypes\r\n\r\nhttps://github.com/python/cpython/blob/8d92b6eff3bac45e7d4871c46c4511218b9b685a/Lib/ctypes/__init__.py#L469-L474\r\n\r\nOn POSIX, no object name or handle is provided, because we want to get the handle for the running executable.\r\n\r\nFrom [dlopen's manpage](https://man.archlinux.org/man/dlopen.3)\r\n\r\n> void *dlopen(const char *filename, int flags);\r\n\r\n> If filename is NULL, then the returned handle is for the main program.\r\n\r\nOn Windows, we load the dynamic library instead. I am a bit out of my depth here, but AFAICT we do this because the dynamic library symbols are not present on the current process. Again, not sure about this, but AFAICT that should not be the case when using a static libpython, so, if I understand everything correctly, we would want to take the same approach as POSIX in this situation, and from what I can tell, that can be done with `GetModuleHandle(NULL)`.\r\n\r\n@zooba, could check if my analysis of the issue on Windows is correct? :rofl:\r\n\r\n#### Tests\r\n\r\nFailures from this wouldn't show up on CI, but should when running the tests on static library Windows builds. This is something we should probably fix, but is low priority.\r\n\r\nhttps://github.com/python/cpython/blob/8d92b6eff3bac45e7d4871c46c4511218b9b685a/Lib/test/test_site.py#L569\r\n\r\nhttps://github.com/python/cpython/blob/8d92b6eff3bac45e7d4871c46c4511218b9b685a/Lib/test/test_import/__init__.py#L742\r\n\r\nhttps://github.com/python/cpython/blob/8d92b6eff3bac45e7d4871c46c4511218b9b685a/Lib/test/support/__init__.py#L1552\r\n\r\n---\r\n\r\n### Relevant information\r\n\r\n#### Window static library build documentation\r\n\r\nhttps://github.com/python/cpython/blob/8d92b6eff3bac45e7d4871c46c4511218b9b685a/PCbuild/readme.txt#L266-L274\r\n\r\n---\r\n\r\n### CPython versions tested on:\r\n\r\nCPython main branch\r\n\r\n### Operating systems tested on:\r\n\r\nWindows","author":{"url":"https://github.com/FFY00","@type":"Person","name":"FFY00"},"datePublished":"2023-10-02T17:10:20Z","url":"https://github.com/python/cpython/issues/110234"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| 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:c36bf307-26f1-5798-8223-19eefacd99ea |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | B858:382318:5D2114:74E894:6B02073C |
| html-safe-nonce | a4d6950fbe155d7f8eeba9216481f33e09bb2cfa534d006b6b6341a0751e62b0 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCODU4OjM4MjMxODo1RDIxMTQ6NzRFODk0OjZCMDIwNzNDIiwidmlzaXRvcl9pZCI6Ijg5NDc4MDc1MjUzNDkyMzAzOTYiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 25e7c0ff561cabfb0a1726668585461aa5dd24cff3d3eb5b950343ae3119f6a1 |
| hovercard-subject-tag | issue:1922307140 |
| 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/110234/issue_layout |
| twitter:image | https://opengraph.githubassets.com/e4f0f6041d5172e29c9af9391a15137522be6291643d8de653084c3c34963e67/python/cpython/issues/110234 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/e4f0f6041d5172e29c9af9391a15137522be6291643d8de653084c3c34963e67/python/cpython/issues/110234 |
| og:image:alt | Bug report Bug description: This is a followup from #110049 (comment), where @colesbury pointed out that we are assuming in a couple places that Windows builds are using a shared library. I think t... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | FFY00 |
| hostname | github.com |
| expected-hostname | github.com |
| None | 87e774ee7c6b3bee0490394e4d3e57ec9dbc956f74b87ea685dc8996c1676456 |
| 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 | 423dbb54c5e7bfecc838eb387c1435eb3d0e760d |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width