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
2d5ea781
Commit
2d5ea781
authored
Mar 05, 2015
by
Kevin Modzelewski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Let isinstance() work with non-type metaclasses
parent
c1085d8c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
2 deletions
+5
-2
src/runtime/objmodel.cpp
src/runtime/objmodel.cpp
+2
-2
test/tests/metaclasses.py
test/tests/metaclasses.py
+3
-0
No files found.
src/runtime/objmodel.cpp
View file @
2d5ea781
...
...
@@ -1913,9 +1913,9 @@ extern "C" bool isinstance(Box* obj, Box* cls, int64_t flags) {
}
if
(
!
false_on_noncls
)
{
assert
(
cls
->
cls
==
type_cls
);
assert
(
isSubclass
(
cls
->
cls
,
type_cls
)
);
}
else
{
if
(
cls
->
cls
!=
type_cls
)
if
(
!
isSubclass
(
cls
->
cls
,
type_cls
)
)
return
false
;
}
...
...
test/tests/metaclasses.py
View file @
2d5ea781
...
...
@@ -26,6 +26,9 @@ class C(object):
__metaclass__
=
M
print
"Made C"
,
type
(
C
)
print
isinstance
(
C
,
M
)
print
isinstance
(
C
,
type
)
print
isinstance
(
C
,
int
)
def
f
(
*
args
):
print
"f()"
,
args
[:
2
]
...
...
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