aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/Python/ceval.c
diff options
context:
space:
mode:
Diffstat (limited to 'Python/ceval.c')
-rw-r--r--Python/ceval.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/Python/ceval.c b/Python/ceval.c
index e3968b07486..a8df045799d 100644
--- a/Python/ceval.c
+++ b/Python/ceval.c
@@ -343,6 +343,29 @@ const conversion_func _PyEval_ConversionFuncs[4] = {
[FVC_ASCII] = PyObject_ASCII
};
+const _Py_SpecialMethod _Py_SpecialMethods[] = {
+ [SPECIAL___ENTER__] = {
+ .name = &_Py_ID(__enter__),
+ .error = "'%.200s' object does not support the "
+ "context manager protocol (missed __enter__ method)",
+ },
+ [SPECIAL___EXIT__] = {
+ .name = &_Py_ID(__exit__),
+ .error = "'%.200s' object does not support the "
+ "context manager protocol (missed __exit__ method)",
+ },
+ [SPECIAL___AENTER__] = {
+ .name = &_Py_ID(__aenter__),
+ .error = "'%.200s' object does not support the asynchronous "
+ "context manager protocol (missed __aenter__ method)",
+ },
+ [SPECIAL___AEXIT__] = {
+ .name = &_Py_ID(__aexit__),
+ .error = "'%.200s' object does not support the asynchronous "
+ "context manager protocol (missed __aexit__ method)",
+ }
+};
+
// PEP 634: Structural Pattern Matching