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
923df348
Commit
923df348
authored
Nov 03, 2014
by
Kevin Modzelewski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
I guess exception handling is supposed to check __subclasscheck__
parent
8497cc62
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
37 additions
and
0 deletions
+37
-0
test/tests/exception_subclasscheck.py
test/tests/exception_subclasscheck.py
+37
-0
No files found.
test/tests/exception_subclasscheck.py
0 → 100644
View file @
923df348
# expected: fail
# - don't support this stuff yet
# Exception-catching is supposed to go through __subclasscheck__
class
M
(
type
):
def
__instancecheck__
(
self
,
instance
):
print
"instancecheck"
,
instance
return
True
def
__subclasscheck__
(
self
,
sub
):
print
"subclasscheck"
,
sub
return
True
class
E
(
Exception
):
__metaclass__
=
M
print
1
print
isinstance
(
E
(),
E
)
# does not print anything due to special-casing
print
2
print
isinstance
(
1
,
E
)
print
3
# This calls __subclasscheck__ twice...?
try
:
raise
E
()
except
E
:
pass
print
4
try
:
raise
Exception
()
except
E
:
pass
print
5
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