Title: MSVC 5274 warning suppression for _Py_ALIGN_AS should be local · Issue #135183 · python/cpython · GitHub
Open Graph Title: MSVC 5274 warning suppression for _Py_ALIGN_AS should be local · Issue #135183 · python/cpython
X Title: MSVC 5274 warning suppression for _Py_ALIGN_AS should be local · Issue #135183 · python/cpython
Description: Bug report In #133966 (comment) we added a Python.h-wide suppression for MSVC warning 5274 “Application of _Alignas on a structured type in C”. I think it should be instead applied locally, after a bit of thought. AFAICS, 5274 warns that...
Open Graph Description: Bug report In #133966 (comment) we added a Python.h-wide suppression for MSVC warning 5274 “Application of _Alignas on a structured type in C”. I think it should be instead applied locally, after a...
X Description: Bug report In #133966 (comment) we added a Python.h-wide suppression for MSVC warning 5274 “Application of _Alignas on a structured type in C”. I think it should be instead applied locally, after a...
Opengraph URL: https://github.com/python/cpython/issues/135183
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"MSVC 5274 warning suppression for _Py_ALIGN_AS should be local","articleBody":"# Bug report\n\nIn https://github.com/python/cpython/pull/133966#issuecomment-2888485497 we added a `Python.h`-wide suppression for MSVC warning [5274](https://learn.microsoft.com/en-us/cpp/overview/cpp-conformance-improvements?view=msvc-170#application-of-_alignas-on-a-structured-type-in-c) “Application of _Alignas on a structured type in C”.\n\nI think it should be instead applied locally, after a bit of thought.\n\nAFAICS, 5274 warns that structs compiled with MSVC versions older than 17.9 might end up with a different layout (ABI) than ones compiled with 17.9+. That can cause trouble for extensions.\n\nIn `PyASCIIObject`, `_Py_ALIGN_AS` is applied to an anonymous struct. I think we can assume that no one is pulling `state`'s type out with something like `typeof(my_PyASCIIObject.state)` – and if they do, getting an 4B-aligned struct is very unlikely to cause trouble in practice.\nBut, that is the kind of analysis one should do when a 5274 warning pops up.\n\n\u003c!-- gh-linked-prs --\u003e\n### Linked PRs\n* gh-135184\n\u003c!-- /gh-linked-prs --\u003e\n","author":{"url":"https://github.com/encukou","@type":"Person","name":"encukou"},"datePublished":"2025-06-05T14:40:23.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":1},"url":"https://github.com/135183/cpython/issues/135183"}
| 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:dd4e37e8-910e-3c67-a653-7a5b02c1c98b |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | CA2E:166AAB:139A9D1:1A623A3:6A5345D7 |
| html-safe-nonce | 159a1296ba54473b14c9aace39f93bdef800715ba50e91bb00afd5866546b053 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDQTJFOjE2NkFBQjoxMzlBOUQxOjFBNjIzQTM6NkE1MzQ1RDciLCJ2aXNpdG9yX2lkIjoiOTEyMDQ5MjQ2NjQ5OTQzODAzOSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | ba7ee0acad02a5c23388a6f3e034bb58973503bd0745741bfa5bebdd0dadcd91 |
| hovercard-subject-tag | issue:3121532972 |
| 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/135183/issue_layout |
| twitter:image | https://opengraph.githubassets.com/d287fd6fb5eb684be278bc54308c542232057de6967d57676d0013714eaa4e7e/python/cpython/issues/135183 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/d287fd6fb5eb684be278bc54308c542232057de6967d57676d0013714eaa4e7e/python/cpython/issues/135183 |
| og:image:alt | Bug report In #133966 (comment) we added a Python.h-wide suppression for MSVC warning 5274 “Application of _Alignas on a structured type in C”. I think it should be instead applied locally, after a... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | encukou |
| hostname | github.com |
| expected-hostname | github.com |
| None | b9a586c06a05a7a86fc7e3f4dbd03e42f6869085879aa184aa6369456dbd50fb |
| 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 | 07a982c1d40157c619b364352b704c3ce66bb332 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width