Title: [C API] Add PyImport_ImportModuleAttr(mod_name, attr_name) helper function · Issue #128911 · python/cpython · GitHub
Open Graph Title: [C API] Add PyImport_ImportModuleAttr(mod_name, attr_name) helper function · Issue #128911 · python/cpython
X Title: [C API] Add PyImport_ImportModuleAttr(mod_name, attr_name) helper function · Issue #128911 · python/cpython
Description: Feature or enhancement Proposal: Python has an internal _PyImport_GetModuleAttrString(mod_name, attr_name) helper function to import a module and get a module attribute. I propose to make this function public to be able to use it outside...
Open Graph Description: Feature or enhancement Proposal: Python has an internal _PyImport_GetModuleAttrString(mod_name, attr_name) helper function to import a module and get a module attribute. I propose to make this func...
X Description: Feature or enhancement Proposal: Python has an internal _PyImport_GetModuleAttrString(mod_name, attr_name) helper function to import a module and get a module attribute. I propose to make this func...
Opengraph URL: https://github.com/python/cpython/issues/128911
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"[C API] Add PyImport_ImportModuleAttr(mod_name, attr_name) helper function","articleBody":"# Feature or enhancement\n\n### Proposal:\n\nPython has an internal `_PyImport_GetModuleAttrString(mod_name, attr_name)` helper function to import a module and get a module attribute. I propose to make this function public to be able to use it outside Python.\n\n**UPDATE:** Function renamed to `PyImport_ImportModuleAttrString()`.\n\nThe function is convenient to use and is used by the following files in Python:\n\n* Modules/arraymodule.c\n* Modules/cjkcodecs/cjkcodecs.h\n* Modules/_ctypes/callbacks.c\n* Modules/_datetimemodule.c\n* Modules/_decimal/_decimal.c\n* Modules/_elementtree.c\n* Modules/faulthandler.c\n* Modules/_lsprof.c\n* Modules/_operator.c\n* Modules/_pickle.c\n* Modules/posixmodule.c\n* Modules/selectmodule.c\n* Modules/_sqlite/connection.c\n* Modules/_sqlite/module.c\n* Modules/_sre/sre.c\n* Modules/timemodule.c\n* Modules/_zoneinfo.c\n* Objects/abstract.c\n* Objects/fileobject.c\n* Objects/memoryobject.c\n* Parser/pegen.c\n* Parser/tokenizer/file_tokenizer.c\n* Python/import.c\n* Python/pylifecycle.c\n\n\n\n### Has this already been discussed elsewhere?\n\nNo response given\n\n### Links to previous discussion of this feature:\n\n_No response_\n\n\u003c!-- gh-linked-prs --\u003e\n### Linked PRs\n* gh-128912\n* gh-128915\n* gh-128960\n* gh-128989\n* gh-129657\n\u003c!-- /gh-linked-prs --\u003e\n","author":{"url":"https://github.com/vstinner","@type":"Person","name":"vstinner"},"datePublished":"2025-01-16T11:44:30.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":4},"url":"https://github.com/128911/cpython/issues/128911"}
| 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:b449a8ce-7534-fca8-9608-29d2a704ddc7 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 9678:22C7EF:F6AD8D:14A44F0:6969929D |
| html-safe-nonce | 5ae8e72c68d6aeb8c1810ee97c41aa474a51439e4e31788fd7c4c557f09777a8 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5Njc4OjIyQzdFRjpGNkFEOEQ6MTRBNDRGMDo2OTY5OTI5RCIsInZpc2l0b3JfaWQiOiI3MzIzODU0OTA4NjYzODk0Njg1IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | af6775d1f337ec00f132addecc0eb4ad2ac819f15496f42c919810558e143c2b |
| hovercard-subject-tag | issue:2792492139 |
| 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/128911/issue_layout |
| twitter:image | https://opengraph.githubassets.com/be38c2f33ce03a107f189bd9a1b2375420b9b3830ad7735278dfc3fe014483a0/python/cpython/issues/128911 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/be38c2f33ce03a107f189bd9a1b2375420b9b3830ad7735278dfc3fe014483a0/python/cpython/issues/128911 |
| og:image:alt | Feature or enhancement Proposal: Python has an internal _PyImport_GetModuleAttrString(mod_name, attr_name) helper function to import a module and get a module attribute. I propose to make this func... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | vstinner |
| hostname | github.com |
| expected-hostname | github.com |
| None | 3542e147982176a7ebaa23dfb559c8af16f721c03ec560c68c56b64a0f35e751 |
| 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 | af80af7cc9e3de9c336f18b208a600950a3c187c |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width