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
90886807
Commit
90886807
authored
10 years ago
by
Damien George
Browse files
Options
Downloads
Plain Diff
Merge branch 'master' of github.com:micropython/micropython
parents
58ebde46
a8408a8a
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
py/objobject.c
+16
-0
16 additions, 0 deletions
py/objobject.c
py/objtype.c
+4
-0
4 additions, 0 deletions
py/objtype.c
tests/basics/class_super_object.py
+15
-0
15 additions, 0 deletions
tests/basics/class_super_object.py
with
35 additions
and
0 deletions
py/objobject.c
+
16
−
0
View file @
90886807
...
...
@@ -47,8 +47,24 @@ STATIC mp_obj_t object_make_new(mp_obj_t type_in, uint n_args, uint n_kw, const
return
o
;
}
#if MICROPY_CPYTHON_COMPAT
STATIC
mp_obj_t
object___init__
(
uint
n_args
,
const
mp_obj_t
*
args
)
{
return
mp_const_none
;
}
STATIC
MP_DEFINE_CONST_FUN_OBJ_1
(
object___init___obj
,
object___init__
);
#endif
STATIC
const
mp_map_elem_t
object_locals_dict_table
[]
=
{
#if MICROPY_CPYTHON_COMPAT
{
MP_OBJ_NEW_QSTR
(
MP_QSTR___init__
),
(
mp_obj_t
)
&
object___init___obj
},
#endif
};
STATIC
MP_DEFINE_CONST_DICT
(
object_locals_dict
,
object_locals_dict_table
);
const
mp_obj_type_t
mp_type_object
=
{
{
&
mp_type_type
},
.
name
=
MP_QSTR_object
,
.
make_new
=
object_make_new
,
.
locals_dict
=
(
mp_obj_t
)
&
object_locals_dict
,
};
This diff is collapsed.
Click to expand it.
py/objtype.c
+
4
−
0
View file @
90886807
...
...
@@ -735,7 +735,11 @@ STATIC void super_load_attr(mp_obj_t self_in, qstr attr, mp_obj_t *dest) {
for
(
uint
i
=
0
;
i
<
len
;
i
++
)
{
assert
(
MP_OBJ_IS_TYPE
(
items
[
i
],
&
mp_type_type
));
mp_obj_class_lookup
(
self
->
obj
,
(
mp_obj_type_t
*
)
items
[
i
],
attr
,
0
,
dest
);
if
(
dest
[
0
]
!=
MP_OBJ_NULL
)
{
return
;
}
}
mp_obj_class_lookup
(
self
->
obj
,
&
mp_type_object
,
attr
,
0
,
dest
);
}
const
mp_obj_type_t
mp_type_super
=
{
...
...
This diff is collapsed.
Click to expand it.
tests/basics/class_super_object.py
0 → 100644
+
15
−
0
View file @
90886807
# Calling object.__init__() via super().__init__
class
Test
(
object
):
def
__init__
(
self
):
super
().
__init__
()
print
(
"
Test.__init__
"
)
t
=
Test
()
class
Test2
:
def
__init__
(
self
):
super
().
__init__
()
print
(
"
Test2.__init__
"
)
t
=
Test2
()
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