Skip to content

py: Fix segfault in namedtuple when name is a non-interned string - #1077

Closed
stinos wants to merge 1 commit into
micropython:masterfrom
stinos:namedtuple-qstr
Closed

stinos wants to merge 1 commit into
micropython:masterfrom
stinos:namedtuple-qstr

Conversation

@stinos

@stinos stinos commented Jan 21, 2015

Copy link
Copy Markdown
Contributor
  • namedtuple was wrongly using MP_OBJ_QSTR_VALUE instead of mp_obj_str_get_qstr,
    so when passed a non-interned string it would segfault; fix this by using mp_obj_str_get_qstr
  • store the namedtuple field names as qstrs so it is not needed to use mp_obj_str_get_qstr
    everytime the field name has to be accessed. This also slighty increases performance when
    fetching attributes

- namedtuple was wrongly using MP_OBJ_QSTR_VALUE instead of mp_obj_str_get_qstr,
so when passed a non-interned string it would segfault; fix this by using mp_obj_str_get_qstr
- store the namedtuple field names as qstrs so it is not needed to use mp_obj_str_get_qstr
everytime the field name has to be accessed. This also slighty increases performance when
fetching attributes
@dpgeorge

Copy link
Copy Markdown
Member

Thanks! Rebased and merged in 6b63673.

@dpgeorge dpgeorge closed this Jan 24, 2015
@stinos
stinos deleted the namedtuple-qstr branch February 15, 2015 07:50
tannewt added a commit to tannewt/circuitpython that referenced this pull request Aug 2, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants