[clang] [clang][Python] Apply type annotations to Python (PR #173845)
Vlad Serebrennikov via cfe-commits
cfe-commits at lists.llvm.org
Mon Jan 12 04:45:31 PST 2026
================
@@ -196,28 +205,26 @@ class TranslationUnitSaveError(Exception):
# Indicates that an unknown error occurred. This typically indicates that
# I/O failed during save.
- ERROR_UNKNOWN = 1
+ ERROR_UNKNOWN: int = 1
# Indicates that errors during translation prevented saving. The errors
# should be available via the TranslationUnit's diagnostics.
- ERROR_TRANSLATION_ERRORS = 2
-
+ ERROR_TRANSLATION_ERRORS: int = 2
# Indicates that the translation unit was somehow invalid.
- ERROR_INVALID_TU = 3
+ ERROR_INVALID_TU: int = 3
- def __init__(self, enumeration, message):
+ def __init__(self, enumeration: int, message: str) -> None:
----------------
Endilll wrote:
Having annotations on parameters is generally good, even if this is not a user-facing constructor and I have questions about taking an `int` here and calling it `enumeration`. But what value does `-> None` has on `__init__` functions?
https://github.com/llvm/llvm-project/pull/173845
More information about the cfe-commits
mailing list