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
be718c33
Commit
be718c33
authored
Jun 03, 2019
by
Jeroen Demeyer
Committed by
Petr Viktorin
Jun 03, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bpo-36974: add some assertions for PEP 590 (GH-13682)
parent
9e3e06e5
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
0 deletions
+14
-0
Objects/typeobject.c
Objects/typeobject.c
+14
-0
No files found.
Objects/typeobject.c
View file @
be718c33
...
...
@@ -5233,6 +5233,20 @@ PyType_Ready(PyTypeObject *type)
_PyObject_ASSERT
((
PyObject
*
)
type
,
(
type
->
tp_flags
&
Py_TPFLAGS_READYING
)
==
0
);
/* Consistency checks for PEP 590:
* - Py_TPFLAGS_METHOD_DESCRIPTOR requires tp_descr_get
* - _Py_TPFLAGS_HAVE_VECTORCALL requires tp_call and
* tp_vectorcall_offset > 0
* To avoid mistakes, we require this before inheriting.
*/
if
(
type
->
tp_flags
&
Py_TPFLAGS_METHOD_DESCRIPTOR
)
{
_PyObject_ASSERT
((
PyObject
*
)
type
,
type
->
tp_descr_get
!=
NULL
);
}
if
(
type
->
tp_flags
&
_Py_TPFLAGS_HAVE_VECTORCALL
)
{
_PyObject_ASSERT
((
PyObject
*
)
type
,
type
->
tp_vectorcall_offset
>
0
);
_PyObject_ASSERT
((
PyObject
*
)
type
,
type
->
tp_call
!=
NULL
);
}
type
->
tp_flags
|=
Py_TPFLAGS_READYING
;
#ifdef Py_TRACE_REFS
...
...
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