Title: Use the Python-specific `Py_DEBUG` macro rather than `_DEBUG` in Windows-related C code · Issue #131942 · python/cpython · GitHub
Open Graph Title: Use the Python-specific `Py_DEBUG` macro rather than `_DEBUG` in Windows-related C code · Issue #131942 · python/cpython
X Title: Use the Python-specific `Py_DEBUG` macro rather than `_DEBUG` in Windows-related C code · Issue #131942 · python/cpython
Description: Follow the discussion at #131799 (comment). Currently, the Windows-related C code is mixed using the Python-specific Py_DEBUG macro and non-Python-specific _DEBUG macro. The documentation said _DEBUG implies Py_DEBUG. Py_DEBUG Compiling ...
Open Graph Description: Follow the discussion at #131799 (comment). Currently, the Windows-related C code is mixed using the Python-specific Py_DEBUG macro and non-Python-specific _DEBUG macro. The documentation said _DEB...
X Description: Follow the discussion at #131799 (comment). Currently, the Windows-related C code is mixed using the Python-specific Py_DEBUG macro and non-Python-specific _DEBUG macro. The documentation said _DEB...
Opengraph URL: https://github.com/python/cpython/issues/131942
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Use the Python-specific `Py_DEBUG` macro rather than `_DEBUG` in Windows-related C code","articleBody":"Follow the discussion at https://github.com/python/cpython/pull/131799#discussion_r2021223342.\n\nCurrently, the Windows-related C code is mixed using the Python-specific `Py_DEBUG` macro and non-Python-specific `_DEBUG` macro.\n\nThe documentation said `_DEBUG` implies `Py_DEBUG`.\n\n\u003e ### [Py_DEBUG](https://docs.python.org/3/c-api/intro.html#c.Py_DEBUG)\n\u003e \n\u003e Compiling the interpreter with the `Py_DEBUG` macro defined produces what is generally meant by [a debug build of Python](https://docs.python.org/3/using/configure.html#debug-build). Py_DEBUG is enabled in the Unix build by adding [--with-pydebug](https://docs.python.org/3/using/configure.html#cmdoption-with-pydebug) to the `./configure` command. It is also implied by the presence of the not-Python-specific `_DEBUG` macro. When `Py_DEBUG` is enabled in the Unix build, compiler optimization is disabled.\n\nAnd it is guaranteed by the following code on Windows.\n\nhttps://github.com/python/cpython/blob/4940d96135a92b90bbc1dcc399f665817f956640/PC/pyconfig.h.in#L379-L381\n\nAll platform-non-specific code and Unix-specific code is using the Python-specific `Py_DEBUG` macro. It would be nice to use `Py_DEBUG` in Windows-related C code either. It could improve the code readability and maintainability.\n\n\u003c!-- gh-linked-prs --\u003e\n### Linked PRs\n* gh-131944\n\u003c!-- /gh-linked-prs --\u003e\n","author":{"url":"https://github.com/XuehaiPan","@type":"Person","name":"XuehaiPan"},"datePublished":"2025-03-31T15:24:13.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":3},"url":"https://github.com/131942/cpython/issues/131942"}
| 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:60ebbca4-ebd3-c2a4-7956-6d67a0a22fb5 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | CBC6:2B78D3:243FE89:311FDE2:6A5391EC |
| html-safe-nonce | ed9f1dfee7fd14da8a7ac472855e8987668c54c08f2bc313471faebaae113346 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDQkM2OjJCNzhEMzoyNDNGRTg5OjMxMUZERTI6NkE1MzkxRUMiLCJ2aXNpdG9yX2lkIjoiMTgwOTc3NTA4NzE3MzQ3Mjc0OCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | de5670e6e5cd72782cd3f1110bc993b04ffd200451a754e92863b575dd45e995 |
| hovercard-subject-tag | issue:2960829860 |
| 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/131942/issue_layout |
| twitter:image | https://opengraph.githubassets.com/e864550b7e256cd883195ec48eccb2b33d8fef64c4293281ff1e41324c7af62c/python/cpython/issues/131942 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/e864550b7e256cd883195ec48eccb2b33d8fef64c4293281ff1e41324c7af62c/python/cpython/issues/131942 |
| og:image:alt | Follow the discussion at #131799 (comment). Currently, the Windows-related C code is mixed using the Python-specific Py_DEBUG macro and non-Python-specific _DEBUG macro. The documentation said _DEB... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | XuehaiPan |
| 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