Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
TASTE
uPython-mirror
Commits
02fd83bc
Commit
02fd83bc
authored
May 03, 2016
by
Damien George
Browse files
tools/mpy-tool: Make sure that all C-level variables are unique.
Fixes issue #2023.
parent
b539a614
Changes
1
Hide whitespace changes
Inline
Side-by-side
tools/mpy-tool.py
View file @
02fd83bc
...
...
@@ -215,6 +215,9 @@ def extract_prelude(bytecode):
return
ip
,
ip2
,
(
n_state
,
n_exc_stack
,
scope_flags
,
n_pos_args
,
n_kwonly_args
,
n_def_pos_args
,
code_info_size
)
class
RawCode
:
# a set of all escaped names, to make sure they are unique
escaped_names
=
set
()
def
__init__
(
self
,
bytecode
,
qstrs
,
objs
,
raw_codes
):
# set core variables
self
.
bytecode
=
bytecode
...
...
@@ -240,6 +243,13 @@ class RawCode:
def
freeze
(
self
,
parent_name
):
self
.
escaped_name
=
parent_name
+
self
.
simple_name
.
qstr_esc
# make sure the escaped name is unique
i
=
2
while
self
.
escaped_name
in
RawCode
.
escaped_names
:
self
.
escaped_name
=
parent_name
+
self
.
simple_name
.
qstr_esc
+
str
(
i
)
i
+=
1
RawCode
.
escaped_names
.
add
(
self
.
escaped_name
)
# emit children first
for
rc
in
self
.
raw_codes
:
rc
.
freeze
(
self
.
escaped_name
+
'_'
)
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment