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
f37624e1
Commit
f37624e1
authored
Jan 28, 2015
by
Serhiy Storchaka
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue #22079: PyType_Ready() now checks that statically allocated type has
no dynamically allocated bases.
parent
c46af544
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
0 deletions
+20
-0
Misc/NEWS
Misc/NEWS
+6
-0
Objects/typeobject.c
Objects/typeobject.c
+14
-0
No files found.
Misc/NEWS
View file @
f37624e1
...
@@ -117,6 +117,12 @@ Build
...
@@ -117,6 +117,12 @@ Build
- Issue #23212: Update 10.5 OS X installer build to use OpenSSL 1.0.1k.
- Issue #23212: Update 10.5 OS X installer build to use OpenSSL 1.0.1k.
C API
-----
- Issue #22079: PyType_Ready() now checks that statically allocated type has
no dynamically allocated bases.
What'
s
New
in
Python
2.7.9
?
What'
s
New
in
Python
2.7.9
?
===========================
===========================
...
...
Objects/typeobject.c
View file @
f37624e1
...
@@ -4073,6 +4073,20 @@ PyType_Ready(PyTypeObject *type)
...
@@ -4073,6 +4073,20 @@ PyType_Ready(PyTypeObject *type)
inherit_slots
(
type
,
(
PyTypeObject
*
)
b
);
inherit_slots
(
type
,
(
PyTypeObject
*
)
b
);
}
}
/* All bases of statically allocated type should be statically allocated */
if
(
!
(
type
->
tp_flags
&
Py_TPFLAGS_HEAPTYPE
))
for
(
i
=
0
;
i
<
n
;
i
++
)
{
PyObject
*
b
=
PyTuple_GET_ITEM
(
bases
,
i
);
if
(
PyType_Check
(
b
)
&&
(((
PyTypeObject
*
)
b
)
->
tp_flags
&
Py_TPFLAGS_HEAPTYPE
))
{
PyErr_Format
(
PyExc_TypeError
,
"type '%.100s' is not dynamically allocated but "
"its base type '%.100s' is dynamically allocated"
,
type
->
tp_name
,
((
PyTypeObject
*
)
b
)
->
tp_name
);
goto
error
;
}
}
/* Sanity check for tp_free. */
/* Sanity check for tp_free. */
if
(
PyType_IS_GC
(
type
)
&&
(
type
->
tp_flags
&
Py_TPFLAGS_BASETYPE
)
&&
if
(
PyType_IS_GC
(
type
)
&&
(
type
->
tp_flags
&
Py_TPFLAGS_BASETYPE
)
&&
(
type
->
tp_free
==
NULL
||
type
->
tp_free
==
PyObject_Del
))
{
(
type
->
tp_free
==
NULL
||
type
->
tp_free
==
PyObject_Del
))
{
...
...
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