|
2 | 2 |
|
3 | 3 | from mypyc.ir.ops import ERR_NEVER, ERR_FALSE, ERR_ALWAYS
|
4 | 4 | from mypyc.ir.rtypes import bool_rprimitive, object_rprimitive, void_rtype, exc_rtuple
|
5 |
| -from mypyc.primitives.registry import ( |
6 |
| - simple_emit, custom_op, c_custom_op |
7 |
| -) |
| 5 | +from mypyc.primitives.registry import c_custom_op |
8 | 6 |
|
9 | 7 | # If the argument is a class, raise an instance of the class. Otherwise, assume
|
10 | 8 | # that the argument is an exception object, and raise it.
|
|
43 | 41 | c_function_name='CPy_NoErrOccured',
|
44 | 42 | error_kind=ERR_FALSE)
|
45 | 43 |
|
46 |
| -# Assert that the error indicator has been set. |
47 |
| -assert_err_occured_op = custom_op( |
48 |
| - arg_types=[], |
49 |
| - result_type=void_rtype, |
50 |
| - error_kind=ERR_NEVER, |
51 |
| - format_str='assert_err_occurred', |
52 |
| - emit=simple_emit('assert(PyErr_Occurred() != NULL && "failure w/o err!");')) |
53 | 44 |
|
54 | 45 | # Keep propagating a raised exception by unconditionally giving an error value.
|
55 | 46 | # This doesn't actually raise an exception.
|
56 |
| -keep_propagating_op = custom_op( |
| 47 | +keep_propagating_op = c_custom_op( |
57 | 48 | arg_types=[],
|
58 |
| - result_type=bool_rprimitive, |
59 |
| - error_kind=ERR_FALSE, |
60 |
| - format_str='{dest} = keep_propagating', |
61 |
| - emit=simple_emit('{dest} = 0;')) |
| 49 | + return_type=bool_rprimitive, |
| 50 | + c_function_name='CPy_KeepPropagating', |
| 51 | + error_kind=ERR_FALSE) |
62 | 52 |
|
63 | 53 | # Catches a propagating exception and makes it the "currently
|
64 | 54 | # handled exception" (by sticking it into sys.exc_info()). Returns the
|
|
0 commit comments