-
-
Notifications
You must be signed in to change notification settings - Fork 33.6k
Open
Labels
interpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)topic-C-APItype-featureA feature request or enhancementA feature request or enhancement
Description
Summary
This issue proposes the depreciation of the PyException_HEAD macro.
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.- It is not part of the public C API and was never intended to be used externally.
- However, a small number of external projects have copied this pattern (for example,
confluent_kafka). - If there are some internals change in the future (e.g. for PEP 697), this macro will
create a maintenance burden.
This deprecation would allow external projects time to migrate, rather than breaking
them immediately.
Proposed actions
- Marking the macro as deprecated in the header using
Py_DEPRECATED()or a
compiler warning. - We can also add the documentation note stating that the macro is deprecated and may be
removed in a future release. - We can add a NEWS entry.
- Recommending that new code use exception creation patterns compatible with PEP 697.
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:
Metadata
Metadata
Assignees
Labels
interpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)topic-C-APItype-featureA feature request or enhancementA feature request or enhancement