Repository navigation
Deprecation of PyException_HEAD #142410
Description
Activity
- addedtype-featureA feature request or enhancementA feature request or enhancement
on Dec 8, 2025 - addedinterpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)
on Dec 8, 2025 For the record, it's non-trivial to deprecate a macro. Unlike functions, macros don't have compiler's attributes. We could make an ugly hack where the fields in this macro are deprecated though.
We'll just soft-deprecate this if approved by the C API WG: capi-workgroup/decisions#86. It might be worth doing a hard-deprecation at some point, but I'm not going to bother fighting that battle right now.
Reacted by Bartosz Sławecki and Krishna-web-hubKrishna-web-hub commented
on Dec 8, 2025 on Dec 8, 2025 · Hidden as duplicateAuthorshow commentMore actionsLet's wait until the C API WG has finished voting, then we can document the soft deprecation.
Reacted by Bartosz Sławecki and Krishna-web-hubKrishna-web-hub commented
on Dec 8, 2025 on Dec 8, 2025 · Hidden as resolvedAuthorshow commentMore actionsThis issue proposes the depreciation of the PyException_HEAD macro.
I would prefer a soft deprecation rather than a hard deprecation. I don't think that this issue is severe enough to justify a hard deprecation.
Thank you @vstinner. That makes sense. I will wait for the C API WG decision, and if approved, I can submit a PR that
adds the documentation note and NEWS entry for the soft deprecation.Krishna-web-hub commented
on Feb 13, 2026 ContributorAuthorMore actionsHello @vstinner , @picnixz , @ZeroIntensity as C API WG has decided to soft deprecate the PyException_Head so should i raise a pr for the soft deprecation of PyException_Head.
Yes, you can open a PR to soft deprecate the PyException_HEAD macro.
I thought I already marked it as deprecated as part of #143896. I haven't added a warning note to any of the other soft-deprecated APIs, so I don't think it makes sense for
PyException_HEADto have one either.@ZeroIntensity then should i close the PR and the Issue for this or any changes you want?.
Yeah, I think we're done here.
Summary
This issue proposes the depreciation of the
PyException_HEADmacro.During review of PR #141522 (Document PyException_HEAD), the reviewers indicated that
this macro is internal, should not be documented, and should instead be deprecated.
PyException_HEADis an internal macro used in CPython to define exception types.confluent_kafka).
create a maintenance burden.
This deprecation would allow external projects time to migrate, rather than breaking
them immediately.
Proposed actions
Py_DEPRECATED()or acompiler warning.
removed in a future release.
No behavior change or removal is proposed at this time.
CC
@ZeroIntensity
@vstinner
@StanFromIreland
Has this already been discussed elsewhere?
This has been discussed in one of the closed pr #141522
Links to previous discussion of this feature:
#141522
Linked PRs