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
3ec0a1a3
Commit
3ec0a1a3
authored
11 years ago
by
Damien George
Browse files
Options
Downloads
Patches
Plain Diff
py: Add 'object' object.
parent
eabdf671
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
py/obj.h
+3
-0
3 additions, 0 deletions
py/obj.h
py/objobject.c
+30
-0
30 additions, 0 deletions
py/objobject.c
py/py.mk
+1
-0
1 addition, 0 deletions
py/py.mk
py/qstrdefs.h
+4
-0
4 additions, 0 deletions
py/qstrdefs.h
py/runtime.c
+1
-0
1 addition, 0 deletions
py/runtime.c
with
39 additions
and
0 deletions
py/obj.h
+
3
−
0
View file @
3ec0a1a3
...
...
@@ -315,6 +315,9 @@ mp_obj_t *mp_obj_get_array_fixed_n(mp_obj_t o, machine_int_t n);
uint
mp_get_index
(
const
mp_obj_type_t
*
type
,
machine_uint_t
len
,
mp_obj_t
index
,
bool
is_slice
);
mp_obj_t
mp_obj_len_maybe
(
mp_obj_t
o_in
);
/* may return NULL */
// object
extern
const
mp_obj_type_t
mp_type_object
;
// none
extern
const
mp_obj_type_t
none_type
;
...
...
This diff is collapsed.
Click to expand it.
py/objobject.c
0 → 100644
+
30
−
0
View file @
3ec0a1a3
#include
<stdlib.h>
#include
"nlr.h"
#include
"misc.h"
#include
"mpconfig.h"
#include
"qstr.h"
#include
"obj.h"
#include
"runtime0.h"
typedef
struct
_mp_obj_object_t
{
mp_obj_base_t
base
;
}
mp_obj_object_t
;
const
mp_obj_type_t
mp_type_object
;
STATIC
mp_obj_t
object_make_new
(
mp_obj_t
type_in
,
uint
n_args
,
uint
n_kw
,
const
mp_obj_t
*
args
)
{
if
(
n_args
!=
0
||
n_kw
!=
0
)
{
nlr_jump
(
mp_obj_new_exception_msg
(
&
mp_type_TypeError
,
"object takes no arguments"
));
}
mp_obj_object_t
*
o
=
m_new_obj
(
mp_obj_object_t
);
o
->
base
.
type
=
&
mp_type_object
;
return
o
;
}
const
mp_obj_type_t
mp_type_object
=
{
{
&
mp_type_type
},
.
name
=
MP_QSTR_object
,
.
make_new
=
object_make_new
,
};
This diff is collapsed.
Click to expand it.
py/py.mk
+
1
−
0
View file @
3ec0a1a3
...
...
@@ -58,6 +58,7 @@ PY_O_BASENAME = \
objlist.o
\
objmap.o
\
objmodule.o
\
objobject.o
\
objnone.o
\
objnamedtuple.o
\
objrange.o
\
...
...
This diff is collapsed.
Click to expand it.
py/qstrdefs.h
+
4
−
0
View file @
3ec0a1a3
...
...
@@ -91,6 +91,10 @@ Q(ValueError)
Q
(
Warning
)
Q
(
ZeroDivisionError
)
Q
(
None
)
Q
(
False
)
Q
(
True
)
Q
(
object
)
Q
(
NoneType
)
...
...
This diff is collapsed.
Click to expand it.
py/runtime.c
+
1
−
0
View file @
3ec0a1a3
...
...
@@ -104,6 +104,7 @@ STATIC const mp_builtin_elem_t builtin_table[] = {
{
MP_QSTR_int
,
(
mp_obj_t
)
&
int_type
},
{
MP_QSTR_list
,
(
mp_obj_t
)
&
list_type
},
{
MP_QSTR_map
,
(
mp_obj_t
)
&
map_type
},
{
MP_QSTR_object
,
(
mp_obj_t
)
&
mp_type_object
},
{
MP_QSTR_set
,
(
mp_obj_t
)
&
set_type
},
{
MP_QSTR_str
,
(
mp_obj_t
)
&
str_type
},
{
MP_QSTR_super
,
(
mp_obj_t
)
&
super_type
},
...
...
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