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
b81e1fde
Commit
b81e1fde
authored
Jan 11, 2014
by
Paul Sokolovsky
Browse files
Add AssertionError.
parent
eae16445
Changes
2
Hide whitespace changes
Inline
Side-by-side
py/emitpass1.c
View file @
b81e1fde
...
...
@@ -45,10 +45,7 @@ static void emit_pass1_load_id(emit_t *emit, qstr qstr) {
bool
added
;
id_info_t
*
id
=
scope_find_or_add_id
(
emit
->
scope
,
qstr
,
&
added
);
if
(
added
)
{
if
(
qstr
==
MP_QSTR_AssertionError
)
{
// TODO how much of a hack is this?
id
->
kind
=
ID_INFO_KIND_GLOBAL_EXPLICIT
;
}
else
if
(
strcmp
(
qstr_str
(
qstr
),
"super"
)
==
0
&&
emit
->
scope
->
kind
==
SCOPE_FUNCTION
)
{
if
(
strcmp
(
qstr_str
(
qstr
),
"super"
)
==
0
&&
emit
->
scope
->
kind
==
SCOPE_FUNCTION
)
{
// special case, super is a global, and also counts as use of __class__
id
->
kind
=
ID_INFO_KIND_GLOBAL_EXPLICIT
;
id_info_t
*
id2
=
scope_find_local_in_parent
(
emit
->
scope
,
emit
->
qstr___class__
);
...
...
py/runtime.c
View file @
b81e1fde
...
...
@@ -90,6 +90,7 @@ void rt_init(void) {
mp_map_add_qstr
(
&
map_builtins
,
MP_QSTR_SyntaxError
,
mp_obj_new_exception
(
MP_QSTR_SyntaxError
));
mp_map_add_qstr
(
&
map_builtins
,
MP_QSTR_ValueError
,
mp_obj_new_exception
(
MP_QSTR_ValueError
));
mp_map_add_qstr
(
&
map_builtins
,
MP_QSTR_OSError
,
mp_obj_new_exception
(
MP_QSTR_OSError
));
mp_map_add_qstr
(
&
map_builtins
,
MP_QSTR_AssertionError
,
mp_obj_new_exception
(
MP_QSTR_AssertionError
));
// built-in objects
mp_map_add_qstr
(
&
map_builtins
,
MP_QSTR_Ellipsis
,
mp_const_ellipsis
);
...
...
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