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
caf17be1
Commit
caf17be1
authored
Nov 27, 2002
by
Michael W. Hudson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
I had the inheritance cycle stuff backwards. Oops!
parent
e16e01fa
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
4 deletions
+14
-4
Lib/test/test_descr.py
Lib/test/test_descr.py
+8
-0
Objects/typeobject.c
Objects/typeobject.c
+6
-4
No files found.
Lib/test/test_descr.py
View file @
caf17be1
...
...
@@ -3452,6 +3452,7 @@ def mutable_bases():
pass
d
=
D
()
e
=
E
()
D
.
__bases__
=
(
C
,)
D
.
__bases__
=
(
C2
,)
vereq
(
d
.
meth
(),
1
)
vereq
(
e
.
meth
(),
1
)
...
...
@@ -3492,6 +3493,13 @@ def mutable_bases():
# actually, we'll have crashed by here...
raise
TestFailed
,
"shouldn't be able to create inheritance cycles"
try
:
D
.
__bases__
=
(
E
,)
except
TypeError
:
pass
else
:
raise
TestFailed
,
"shouldn't be able to create inheritance cycles"
# let's throw a classic class into the mix:
class
Classic
:
def
meth2
(
self
):
...
...
Objects/typeobject.c
View file @
caf17be1
...
...
@@ -208,10 +208,12 @@ type_set_bases(PyTypeObject *type, PyObject *value, void *context)
type
->
tp_name
,
ob
->
ob_type
->
tp_name
);
return
-
1
;
}
if
(
PyType_IsSubtype
(
type
,
(
PyTypeObject
*
)
ob
))
{
PyErr_SetString
(
PyExc_TypeError
,
"a __bases__ item causes an inheritance cycle"
);
return
-
1
;
if
(
PyType_Check
(
ob
))
{
if
(
PyType_IsSubtype
((
PyTypeObject
*
)
ob
,
type
))
{
PyErr_SetString
(
PyExc_TypeError
,
"a __bases__ item causes an inheritance cycle"
);
return
-
1
;
}
}
}
...
...
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