Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
Pyston
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
Pyston
Commits
647363c8
Commit
647363c8
authored
Jul 28, 2014
by
Kevin Modzelewski
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #110 from undingen/defaults_crash
Fix crash when passing alot of defaults
parents
da069735
7681663b
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
3 deletions
+10
-3
src/runtime/objmodel.cpp
src/runtime/objmodel.cpp
+6
-3
test/tests/defaults_basic.py
test/tests/defaults_basic.py
+4
-0
No files found.
src/runtime/objmodel.cpp
View file @
647363c8
...
...
@@ -1849,8 +1849,11 @@ Box* callFunc(BoxedFunction* func, CallRewriteArgs* rewrite_args, ArgPassSpec ar
Box
*
oarg1
=
NULL
,
*
oarg2
=
NULL
,
*
oarg3
=
NULL
;
Box
**
oargs
=
NULL
;
if
(
num_output_args
>
3
)
oargs
=
(
Box
**
)
alloca
((
num_output_args
-
3
)
*
sizeof
(
Box
*
));
if
(
num_output_args
>
3
)
{
int
size
=
(
num_output_args
-
3
)
*
sizeof
(
Box
*
);
oargs
=
(
Box
**
)
alloca
(
size
);
memset
(
&
oargs
[
0
],
0
,
size
);
}
////
// First, match up positional parameters to positional/varargs:
...
...
@@ -1867,7 +1870,7 @@ Box* callFunc(BoxedFunction* func, CallRewriteArgs* rewrite_args, ArgPassSpec ar
getArg
(
i
+
positional_to_positional
,
oarg1
,
oarg2
,
oarg3
,
oargs
)
=
varargs
[
i
];
}
std
::
vector
<
bool
>
params_filled
(
argspec
.
num
_args
,
false
);
std
::
vector
<
bool
>
params_filled
(
num_output
_args
,
false
);
for
(
int
i
=
0
;
i
<
positional_to_positional
+
varargs_to_positional
;
i
++
)
{
params_filled
[
i
]
=
true
;
}
...
...
test/tests/defaults_basic.py
View file @
647363c8
...
...
@@ -43,3 +43,7 @@ def f3():
f
(
4
,
[])
f
(
5
,
[])
f3
()
def
f4
(
a
=
1
,
b
=
2
,
c
=
3
,
d
=
4
,
e
=
5
,
f
=
6
,
g
=
7
,
h
=
8
):
print
a
,
b
,
c
,
d
,
e
,
f
,
g
,
h
f4
()
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