Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
prepend argument variables with _
This prevents collisions with python keywords which would cause a syntax error when executing it later
  • Loading branch information
conorpp authored May 19, 2017
commit 2e2d8c31225ea4109f5f37ea81623c5a78a58efa
6 changes: 3 additions & 3 deletions solid/solidpython.py
Original file line number Diff line number Diff line change
Expand Up @@ -247,15 +247,15 @@ def new_openscad_class_str(class_name, args=[], kwargs=[], include_file_path=Non
args_pairs = ''

for arg in args:
args_str += ', ' + arg
args_pairs += "'%(arg)s':%(arg)s, " % vars()
args_str += ', _' + arg
args_pairs += "'%(arg)s':_%(arg)s, " % vars()

# kwargs have a default value defined in their SCAD versions. We don't
# care what that default value will be (SCAD will take care of that), just
# that one is defined.
for kwarg in kwargs:
args_str += ', %(kwarg)s=None' % vars()
args_pairs += "'%(kwarg)s':%(kwarg)s, " % vars()
args_pairs += "'%(kwarg)s':_%(kwarg)s, " % vars()

if include_file_path:
# include_file_path may include backslashes on Windows; escape them
Expand Down