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
56588b70
Commit
56588b70
authored
Oct 08, 2016
by
Serhiy Storchaka
Browse files
Options
Browse Files
Download
Plain Diff
Issue #26906: Resolving special methods of uninitialized type now causes
implicit initialization of the type instead of a fail.
parents
2b801456
8ef34600
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
5 deletions
+22
-5
Misc/NEWS
Misc/NEWS
+3
-0
Objects/typeobject.c
Objects/typeobject.c
+19
-5
No files found.
Misc/NEWS
View file @
56588b70
...
...
@@ -10,6 +10,9 @@ What's New in Python 3.6.0 beta 2
Core and Builtins
-----------------
- Issue #26906: Resolving special methods of uninitialized type now causes
implicit initialization of the type instead of a fail.
- Issue #18287: PyType_Ready() now checks that tp_name is not NULL.
Original patch by Niklas Koep.
...
...
Objects/typeobject.c
View file @
56588b70
...
...
@@ -2914,11 +2914,25 @@ _PyType_Lookup(PyTypeObject *type, PyObject *name)
/* Look in tp_dict of types in MRO */
mro
=
type
->
tp_mro
;
/* If mro is NULL, the type is either not yet initialized
by PyType_Ready(), or already cleared by type_clear().
Either way the safest thing to do is to return NULL. */
if
(
mro
==
NULL
)
return
NULL
;
if
(
mro
==
NULL
)
{
if
((
type
->
tp_flags
&
Py_TPFLAGS_READYING
)
==
0
&&
PyType_Ready
(
type
)
<
0
)
{
/* It's not ideal to clear the error condition,
but this function is documented as not setting
an exception, and I don't want to change that.
When PyType_Ready() can't proceed, it won't
set the "ready" flag, so future attempts to ready
the same type will call it again -- hopefully
in a context that propagates the exception out.
*/
PyErr_Clear
();
return
NULL
;
}
mro
=
type
->
tp_mro
;
if
(
mro
==
NULL
)
{
return
NULL
;
}
}
res
=
NULL
;
/* keep a strong reference to mro because type->tp_mro can be replaced
...
...
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