Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
U
uPython-mirror
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
TASTE
uPython-mirror
Commits
eaf2e054
Commit
eaf2e054
authored
Feb 20, 2018
by
Damien George
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
py: Switch to use #if instead of if-stmt for remaining misc items.
parent
de145578
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
20 additions
and
9 deletions
+20
-9
py/objdict.c
py/objdict.c
+6
-2
py/objstr.c
py/objstr.c
+5
-1
py/runtime.c
py/runtime.c
+5
-2
py/vm.c
py/vm.c
+4
-4
No files found.
py/objdict.c
View file @
eaf2e054
...
...
@@ -61,9 +61,11 @@ STATIC void dict_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_
{
kind
=
PRINT_REPR
;
}
if
(
MICROPY_PY_COLLECTIONS_ORDEREDDICT
&&
self
->
base
.
type
!=
&
mp_type_dict
)
{
#if MICROPY_PY_COLLECTIONS_ORDEREDDICT
if
(
self
->
base
.
type
!=
&
mp_type_dict
)
{
mp_printf
(
print
,
"%q("
,
self
->
base
.
type
->
name
);
}
#endif
mp_print_str
(
print
,
"{"
);
size_t
cur
=
0
;
mp_map_elem_t
*
next
=
NULL
;
...
...
@@ -77,9 +79,11 @@ STATIC void dict_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_
mp_obj_print_helper
(
print
,
next
->
value
,
kind
);
}
mp_print_str
(
print
,
"}"
);
if
(
MICROPY_PY_COLLECTIONS_ORDEREDDICT
&&
self
->
base
.
type
!=
&
mp_type_dict
)
{
#if MICROPY_PY_COLLECTIONS_ORDEREDDICT
if
(
self
->
base
.
type
!=
&
mp_type_dict
)
{
mp_print_str
(
print
,
")"
);
}
#endif
}
STATIC
mp_obj_t
dict_make_new
(
const
mp_obj_type_t
*
type
,
size_t
n_args
,
size_t
n_kw
,
const
mp_obj_t
*
args
)
{
...
...
py/objstr.c
View file @
eaf2e054
...
...
@@ -429,11 +429,15 @@ STATIC mp_obj_t bytes_subscr(mp_obj_t self_in, mp_obj_t index, mp_obj_t value) {
#endif
size_t
index_val
=
mp_get_index
(
type
,
self_len
,
index
,
false
);
// If we have unicode enabled the type will always be bytes, so take the short cut.
if
(
MICROPY_PY_BUILTINS_STR_UNICODE
||
type
==
&
mp_type_bytes
)
{
#if MICROPY_PY_BUILTINS_STR_UNICODE
return
MP_OBJ_NEW_SMALL_INT
(
self_data
[
index_val
]);
#else
if
(
type
==
&
mp_type_bytes
)
{
return
MP_OBJ_NEW_SMALL_INT
(
self_data
[
index_val
]);
}
else
{
return
mp_obj_new_str_via_qstr
((
char
*
)
&
self_data
[
index_val
],
1
);
}
#endif
}
else
{
return
MP_OBJ_NULL
;
// op not supported
}
...
...
py/runtime.c
View file @
eaf2e054
...
...
@@ -1414,10 +1414,13 @@ mp_obj_t mp_parse_compile_execute(mp_lexer_t *lex, mp_parse_input_kind_t parse_i
mp_obj_t
module_fun
=
mp_compile
(
&
parse_tree
,
source_name
,
MP_EMIT_OPT_NONE
,
false
);
mp_obj_t
ret
;
if
(
MICROPY_PY_BUILTINS_COMPILE
&&
globals
==
NULL
)
{
#if MICROPY_PY_BUILTINS_COMPILE
if
(
globals
==
NULL
)
{
// for compile only, return value is the module function
ret
=
module_fun
;
}
else
{
}
else
#endif
{
// execute module function and get return value
ret
=
mp_call_function_0
(
module_fun
);
}
...
...
py/vm.c
View file @
eaf2e054
...
...
@@ -841,14 +841,14 @@ unwind_jump:;
if
((
unum
&
3
)
==
0
)
{
mp_obj_list_append
(
obj
,
sp
[
0
]);
sp
--
;
}
else
if
(
!
MICROPY_PY_BUILTINS_SET
||
(
unum
&
3
)
==
1
)
{
mp_obj_dict_store
(
obj
,
sp
[
0
],
sp
[
-
1
]);
sp
-=
2
;
#if MICROPY_PY_BUILTINS_SET
}
else
{
}
else
if
((
unum
&
3
)
==
2
)
{
mp_obj_set_store
(
obj
,
sp
[
0
]);
sp
--
;
#endif
}
else
{
mp_obj_dict_store
(
obj
,
sp
[
0
],
sp
[
-
1
]);
sp
-=
2
;
}
// next opcode is always JUMP
ip
+=
1
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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