Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
M
micropython
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
card10
micropython
Commits
52386caf
Commit
52386caf
authored
10 years ago
by
Paul Sokolovsky
Browse files
Options
Downloads
Patches
Plain Diff
objexcept: Implement explicit __init__ method, useful for subclasses.
parent
66ab571c
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
py/objexcept.c
+15
-0
15 additions, 0 deletions
py/objexcept.c
with
15 additions
and
0 deletions
py/objexcept.c
+
15
−
0
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) \
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment