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
GitLab 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
330cf6d0
Commit
330cf6d0
authored
Feb 2, 2014
by
Damien George
Browse files
Options
Downloads
Patches
Plain Diff
Change id to return signed integer.
parent
0ebf8534
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
py/builtin.c
+1
-1
1 addition, 1 deletion
py/builtin.c
tests/basics/builtin_id.py
+7
-0
7 additions, 0 deletions
tests/basics/builtin_id.py
with
8 additions
and
1 deletion
py/builtin.c
+
1
−
1
View file @
330cf6d0
...
@@ -366,7 +366,7 @@ static mp_obj_t mp_builtin_bytes(uint n_args, const mp_obj_t *args) {
...
@@ -366,7 +366,7 @@ static mp_obj_t mp_builtin_bytes(uint n_args, const mp_obj_t *args) {
MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN
(
mp_builtin_bytes_obj
,
1
,
3
,
mp_builtin_bytes
);
MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN
(
mp_builtin_bytes_obj
,
1
,
3
,
mp_builtin_bytes
);
static
mp_obj_t
mp_builtin_id
(
mp_obj_t
o_in
)
{
static
mp_obj_t
mp_builtin_id
(
mp_obj_t
o_in
)
{
return
mp_obj_new_int
_from_uint
((
machine_
u
int_t
)
o_in
);
return
mp_obj_new_int
((
machine_int_t
)
o_in
);
}
}
MP_DEFINE_CONST_FUN_OBJ_1
(
mp_builtin_id_obj
,
mp_builtin_id
);
MP_DEFINE_CONST_FUN_OBJ_1
(
mp_builtin_id_obj
,
mp_builtin_id
);
This diff is collapsed.
Click to expand it.
tests/basics/builtin_id.py
+
7
−
0
View file @
330cf6d0
print
(
id
(
1
)
==
id
(
2
))
print
(
id
(
1
)
==
id
(
2
))
print
(
id
(
None
)
==
id
(
None
))
print
(
id
(
None
)
==
id
(
None
))
print
(
id
([])
==
id
([]))
l
=
[
1
,
2
]
print
(
id
(
l
)
==
id
(
l
))
f
=
lambda
:
None
print
(
id
(
f
)
==
id
(
f
))
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