Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
TASTE
uPython-mirror
Commits
52386caf
Commit
52386caf
authored
May 18, 2014
by
Paul Sokolovsky
Browse files
objexcept: Implement explicit __init__ method, useful for subclasses.
parent
66ab571c
Changes
1
Hide whitespace changes
Inline
Side-by-side
py/objexcept.c
View file @
52386caf
...
...
@@ -120,12 +120,27 @@ STATIC void exception_load_attr(mp_obj_t self_in, qstr attr, mp_obj_t *dest) {
}
}
STATIC
mp_obj_t
exc___init__
(
uint
n_args
,
const
mp_obj_t
*
args
)
{
mp_obj_exception_t
*
self
=
args
[
0
];
mp_obj_t
argst
=
mp_obj_new_tuple
(
n_args
-
1
,
args
+
1
);
self
->
args
=
argst
;
return
mp_const_none
;
}
STATIC
MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN
(
exc___init___obj
,
1
,
MP_OBJ_FUN_ARGS_MAX
,
exc___init__
);
STATIC
const
mp_map_elem_t
exc_locals_dict_table
[]
=
{
{
MP_OBJ_NEW_QSTR
(
MP_QSTR___init__
),
(
mp_obj_t
)
&
exc___init___obj
},
};
STATIC
MP_DEFINE_CONST_DICT
(
exc_locals_dict
,
exc_locals_dict_table
);
const
mp_obj_type_t
mp_type_BaseException
=
{
{
&
mp_type_type
},
.
name
=
MP_QSTR_BaseException
,
.
print
=
mp_obj_exception_print
,
.
make_new
=
mp_obj_exception_make_new
,
.
load_attr
=
exception_load_attr
,
.
locals_dict
=
(
mp_obj_t
)
&
exc_locals_dict
,
};
#define MP_DEFINE_EXCEPTION_BASE(base_name) \
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment