mirror of
https://github.com/python/cpython
synced 2026-09-29 12:10:30 +03:00
bpo-39573: Update clinic to use Py_IS_TYPE() function (GH-18507)
This commit is contained in:
parent
d212c3c55d
commit
9aeb0ef930
5 changed files with 14 additions and 16 deletions
|
|
@ -3585,17 +3585,14 @@ class self_converter(CConverter):
|
|||
cls = self.function.cls
|
||||
|
||||
if ((kind in (METHOD_NEW, METHOD_INIT)) and cls and cls.typedef):
|
||||
type_object = self.function.cls.type_object
|
||||
if kind == METHOD_NEW:
|
||||
passed_in_type = self.name
|
||||
type_check = '({} == {})'.format(self.name, type_object)
|
||||
else:
|
||||
passed_in_type = 'Py_TYPE({})'.format(self.name)
|
||||
type_check = 'Py_IS_TYPE({}, {})'.format(self.name, type_object)
|
||||
|
||||
line = '({passed_in_type} == {type_object}) &&\n '
|
||||
d = {
|
||||
'type_object': self.function.cls.type_object,
|
||||
'passed_in_type': passed_in_type
|
||||
}
|
||||
template_dict['self_type_check'] = line.format_map(d)
|
||||
line = '{} &&\n '.format(type_check)
|
||||
template_dict['self_type_check'] = line
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue