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
64a7ab2a
Commit
64a7ab2a
authored
Mar 29, 2016
by
Kevin Modzelewski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix some error messages
parent
231ac3c9
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
2 deletions
+9
-2
src/runtime/objmodel.cpp
src/runtime/objmodel.cpp
+5
-2
test/tests/func_arg_passing.py
test/tests/func_arg_passing.py
+4
-0
No files found.
src/runtime/objmodel.cpp
View file @
64a7ab2a
...
@@ -4371,8 +4371,11 @@ void rearrangeArgumentsInternal(ParamReceiveSpec paramspec, const ParamNames* pa
...
@@ -4371,8 +4371,11 @@ void rearrangeArgumentsInternal(ParamReceiveSpec paramspec, const ParamNames* pa
for
(
int
i
=
0
;
i
<
paramspec
.
num_args
-
paramspec
.
num_defaults
;
i
++
)
{
for
(
int
i
=
0
;
i
<
paramspec
.
num_args
-
paramspec
.
num_defaults
;
i
++
)
{
if
(
params_filled
[
i
])
if
(
params_filled
[
i
])
continue
;
continue
;
raiseExcHelper
(
TypeError
,
"%s() takes exactly %d arguments (%ld given)"
,
func_name_cb
(),
paramspec
.
num_args
,
argspec
.
num_args
+
argspec
.
num_keywords
+
varargs_size
);
int
min_args
=
paramspec
.
num_args
-
paramspec
.
num_defaults
;
const
char
*
exactly
=
(
paramspec
.
num_defaults
||
paramspec
.
takes_varargs
)
?
"at least"
:
"exactly"
;
raiseExcHelper
(
TypeError
,
"%s() takes %s %d argument%s (%ld given)"
,
func_name_cb
(),
exactly
,
min_args
,
min_args
==
1
?
""
:
"s"
,
argspec
.
num_args
+
argspec
.
num_keywords
+
varargs_size
);
}
}
// There can be more defaults than arguments.
// There can be more defaults than arguments.
...
...
test/tests/func_arg_passing.py
View file @
64a7ab2a
...
@@ -36,6 +36,10 @@ def f2(a, b=3, c=4, d=5, *args, **kw):
...
@@ -36,6 +36,10 @@ def f2(a, b=3, c=4, d=5, *args, **kw):
print
a
,
b
,
c
,
d
,
args
,
kw
print
a
,
b
,
c
,
d
,
args
,
kw
def
g
():
def
g
():
try
:
print
f2
()
except
Exception
as
e
:
print
e
try
:
try
:
print
f2
(
1
)
print
f2
(
1
)
except
Exception
as
e
:
except
Exception
as
e
:
...
...
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