Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
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
Kirill Smelkov
cpython
Commits
c3fe99d3
Commit
c3fe99d3
authored
Feb 19, 2001
by
Jeremy Hylton
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
SF patch #103749: implicit tuple + default arg
parent
9659def6
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
40 additions
and
3 deletions
+40
-3
Lib/test/output/test_compile
Lib/test/output/test_compile
+7
-0
Lib/test/test_compile.py
Lib/test/test_compile.py
+33
-3
No files found.
Lib/test/output/test_compile
View file @
c3fe99d3
test_compile
testing complex args
1 2
1 2
3 4
1 2 3
1 2 3
2 3 4
Lib/test/test_compile.py
View file @
c3fe99d3
...
...
@@ -4,19 +4,49 @@ if verbose:
print
'Running tests on argument handling'
try
:
exec
(
'def f(a, a): pass'
)
exec
'def f(a, a): pass'
raise
TestFailed
,
"duplicate arguments"
except
SyntaxError
:
pass
try
:
exec
(
'def f(a = 0, a = 1): pass'
)
exec
'def f(a = 0, a = 1): pass'
raise
TestFailed
,
"duplicate keyword arguments"
except
SyntaxError
:
pass
try
:
exec
(
'def f(a): global a; a = 1'
)
exec
'def f(a): global a; a = 1'
raise
TestFailed
,
"variable is global and local"
except
SyntaxError
:
pass
print
"testing complex args"
def
comp_args
((
a
,
b
)):
print
a
,
b
comp_args
((
1
,
2
))
def
comp_args
((
a
,
b
)
=
(
3
,
4
)):
print
a
,
b
comp_args
((
1
,
2
))
comp_args
()
def
comp_args
(
a
,
(
b
,
c
)):
print
a
,
b
,
c
comp_args
(
1
,
(
2
,
3
))
def
comp_args
(
a
=
2
,
(
b
,
c
)
=
(
3
,
4
)):
print
a
,
b
,
c
comp_args
(
1
,
(
2
,
3
))
comp_args
()
try
:
exec
'def f(a=1, (b, c)): pass'
raise
TestFailed
,
"non-default args after default"
except
SyntaxError
:
pass
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