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
5dc3e3f1
Commit
5dc3e3f1
authored
Jun 13, 2006
by
Brett Cannon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Missed test for rev. 46933; infinite recursion from __coerce__() returning its arguments reversed.
parent
1541ef08
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
1 deletion
+19
-1
Lib/test/test_coercion.py
Lib/test/test_coercion.py
+19
-1
No files found.
Lib/test/test_coercion.py
View file @
5dc3e3f1
...
...
@@ -2,7 +2,7 @@ import copy
import
sys
import
warnings
import
unittest
from
test.test_support
import
run_unittest
from
test.test_support
import
run_unittest
,
TestFailed
# Fake a number that implements numeric methods through __coerce__
class
CoerceNumber
:
...
...
@@ -318,6 +318,24 @@ class CoercionTest(unittest.TestCase):
return
0
self
.
assertEquals
(
cmp
(
ClassicWackyComparer
(),
evil_coercer
),
0
)
def
test_infinite_rec_classic_classes
(
self
):
# if __coerce__() returns its arguments reversed it causes an infinite
# recursion for classic classes.
class
Tester
:
def
__coerce__
(
self
,
other
):
return
other
,
self
exc
=
TestFailed
(
"__coerce__() returning its arguments reverse "
"should raise RuntimeError"
)
try
:
Tester
()
+
1
except
(
RuntimeError
,
TypeError
):
return
except
:
raise
exc
else
:
raise
exc
def
test_main
():
warnings
.
filterwarnings
(
"ignore"
,
r'complex divmod\
(
\), // and % are deprecated'
,
...
...
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