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
9c817b94
Commit
9c817b94
authored
Mar 26, 2014
by
Damien George
Browse files
Merge branch 'master' of github.com:micropython/micropython
parents
548e76cf
af1ae303
Changes
2
Hide whitespace changes
Inline
Side-by-side
py/obj.h
View file @
9c817b94
...
...
@@ -315,6 +315,7 @@ bool mp_obj_exception_match(mp_obj_t exc, const mp_obj_type_t *exc_type);
void
mp_obj_exception_clear_traceback
(
mp_obj_t
self_in
);
void
mp_obj_exception_add_traceback
(
mp_obj_t
self_in
,
qstr
file
,
machine_uint_t
line
,
qstr
block
);
void
mp_obj_exception_get_traceback
(
mp_obj_t
self_in
,
machine_uint_t
*
n
,
machine_uint_t
**
values
);
mp_obj_t
mp_obj_exception_get_value
(
mp_obj_t
self_in
);
// str
extern
const
mp_obj_type_t
str_type
;
...
...
py/objexcept.c
View file @
9c817b94
...
...
@@ -61,16 +61,22 @@ STATIC mp_obj_t mp_obj_exception_make_new(mp_obj_t type_in, uint n_args, uint n_
return
o
;
}
// Get exception "value" - that is, first argument, or None
mp_obj_t
mp_obj_exception_get_value
(
mp_obj_t
self_in
)
{
mp_obj_exception_t
*
self
=
self_in
;
if
(
self
->
args
.
len
==
0
)
{
return
mp_const_none
;
}
else
{
return
self
->
args
.
items
[
0
];
}
}
STATIC
void
exception_load_attr
(
mp_obj_t
self_in
,
qstr
attr
,
mp_obj_t
*
dest
)
{
mp_obj_exception_t
*
self
=
self_in
;
if
(
attr
==
MP_QSTR_args
)
{
dest
[
0
]
=
&
self
->
args
;
}
else
if
(
self
->
base
.
type
==
&
mp_type_StopIteration
&&
attr
==
MP_QSTR_value
)
{
if
(
self
->
args
.
len
==
0
)
{
dest
[
0
]
=
mp_const_none
;
}
else
{
dest
[
0
]
=
self
->
args
.
items
[
0
];
}
dest
[
0
]
=
mp_obj_exception_get_value
(
self
);
}
}
...
...
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