Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
TASTE
uPython-mirror
Commits
ad9daadf
Commit
ad9daadf
authored
Apr 29, 2015
by
Damien George
Browse files
py: Fix attrtuple array length in print and creation.
parent
95f53461
Changes
1
Hide whitespace changes
Inline
Side-by-side
py/objattrtuple.c
View file @
ad9daadf
...
...
@@ -34,7 +34,7 @@ STATIC
#endif
void
mp_obj_attrtuple_print_helper
(
const
mp_print_t
*
print
,
const
qstr
*
fields
,
mp_obj_tuple_t
*
o
)
{
mp_print_str
(
print
,
"("
);
for
(
mp_uint_t
i
=
0
;
i
<
(
o
->
len
-
1
)
;
i
++
)
{
for
(
mp_uint_t
i
=
0
;
i
<
o
->
len
;
i
++
)
{
if
(
i
>
0
)
{
mp_print_str
(
print
,
", "
);
}
...
...
@@ -51,7 +51,7 @@ void mp_obj_attrtuple_print_helper(const mp_print_t *print, const qstr *fields,
STATIC
void
mp_obj_attrtuple_print
(
const
mp_print_t
*
print
,
mp_obj_t
o_in
,
mp_print_kind_t
kind
)
{
(
void
)
kind
;
mp_obj_tuple_t
*
o
=
o_in
;
const
qstr
*
fields
=
(
const
qstr
*
)
o
->
items
[
o
->
len
-
1
];
const
qstr
*
fields
=
(
const
qstr
*
)
o
->
items
[
o
->
len
];
mp_obj_attrtuple_print_helper
(
print
,
fields
,
o
);
}
...
...
@@ -71,8 +71,9 @@ STATIC void mp_obj_attrtuple_attr(mp_obj_t self_in, qstr attr, mp_obj_t *dest) {
}
mp_obj_t
mp_obj_new_attrtuple
(
const
qstr
*
fields
,
mp_uint_t
n
,
const
mp_obj_t
*
items
)
{
mp_obj_tuple_t
*
o
=
m
p
_obj_
new_tuple
(
n
+
1
,
NULL
);
mp_obj_tuple_t
*
o
=
m
_new
_obj_
var
(
mp_obj_tuple_t
,
mp_obj_t
,
n
+
1
);
o
->
base
.
type
=
&
mp_type_attrtuple
;
o
->
len
=
n
;
for
(
mp_uint_t
i
=
0
;
i
<
n
;
i
++
)
{
o
->
items
[
i
]
=
items
[
i
];
}
...
...
Write
Preview
Supports
Markdown
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