mirror of
https://github.com/python/cpython.git
synced 2025-08-30 05:35:08 +00:00
GH-120507: Lower the BEFORE_WITH
and BEFORE_ASYNC_WITH
instructions. (#120640)
* Remove BEFORE_WITH and BEFORE_ASYNC_WITH instructions. * Add LOAD_SPECIAL instruction * Reimplement `with` and `async with` statements using LOAD_SPECIAL
This commit is contained in:
parent
73dc1c678e
commit
9cefcc0ee7
22 changed files with 663 additions and 651 deletions
|
@ -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
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue