cpython: 1435d2fe8e34 (original) (raw)
Mercurial > cpython
changeset 88721:1435d2fe8e34
Issue #20390: Final fix, for generating NoPositional/NoKeyword for __init__ calls. [#20390]
Larry Hastings larry@hastings.org | |
---|---|
date | Sat, 25 Jan 2014 22:01:12 -0800 |
parents | fb7cee081e31 |
children | 0ae768637a07 |
files | Misc/NEWS Modules/clinic/_bz2module.c.h Tools/clinic/clinic.py |
diffstat | 3 files changed, 23 insertions(+), 10 deletions(-)[+] [-] Misc/NEWS 2 Modules/clinic/_bz2module.c.h 11 Tools/clinic/clinic.py 20 |
line wrap: on
line diff
--- a/Misc/NEWS +++ b/Misc/NEWS @@ -133,7 +133,7 @@ Library IDLE ---- ---Issue #17390: Add Python version to Idle editor window title bar. +- Issue #17390: Add Python version to Idle editor window title bar. Original patches by Edmond Burnett and Kent Johnson.
--- a/Modules/clinic/_bz2module.c.h +++ b/Modules/clinic/_bz2module.c.h @@ -75,7 +75,8 @@ static int int return_value = -1; int compresslevel = 9;
- if ((Py_TYPE(self) == &BZ2Compressor_Type) &&
if (!PyArg_ParseTuple(args, "|i:BZ2Compressor",!_PyArg_NoKeywords("BZ2Compressor", kwargs))[](#l2.9) goto exit;[](#l2.10)
@@ -137,13 +138,15 @@ static int { int return_value = -1;
- if ((Py_TYPE(self) == &BZ2Decompressor_Type) &&
!_PyArg_NoPositional("BZ2Decompressor", args))[](#l2.19) goto exit;[](#l2.20)
- if ((Py_TYPE(self) == &BZ2Decompressor_Type) &&
return_value = _bz2_BZ2Decompressor___init___impl((BZ2Decompressor )self); exit: return return_value; } -/[clinic end generated code: checksum=9bb33ae7d35494b7a5365f03f390e4b5b8b1bc49]/ +/[clinic end generated code: checksum=4ade1dba3921a8bd8a614e5417f7654d8fb10be5]*/!_PyArg_NoKeywords("BZ2Decompressor", kwargs))[](#l2.23) goto exit;[](#l2.24)
--- a/Tools/clinic/clinic.py +++ b/Tools/clinic/clinic.py @@ -2593,11 +2593,21 @@ class self_converter(CConverter): def set_template_dict(self, template_dict): template_dict['self_name'] = self.name template_dict['self_type'] = self.parser_type
if ((self.function.kind == METHOD_NEW) and[](#l3.7)
self.function.cls and[](#l3.8)
self.function.cls.typedef):[](#l3.9)
template_dict['self_type_object'] = self.function.cls.type_object[](#l3.10)
template_dict['self_type_check'] = '({self_name} == {self_type_object}) &&\n '.format_map(template_dict)[](#l3.11)
kind = self.function.kind[](#l3.12)
cls = self.function.cls[](#l3.13)
if ((kind in (METHOD_NEW, METHOD_INIT)) and cls and cls.typedef):[](#l3.15)
if kind == METHOD_NEW:[](#l3.16)
passed_in_type = self.name[](#l3.17)
else:[](#l3.18)
passed_in_type = 'Py_TYPE({})'.format(self.name)[](#l3.19)
line = '({passed_in_type} == {type_object}) &&\n '[](#l3.21)
d = {[](#l3.22)
'type_object': self.function.cls.type_object,[](#l3.23)
'passed_in_type': passed_in_type[](#l3.24)
}[](#l3.25)
template_dict['self_type_check'] = line.format_map(d)[](#l3.26)