FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

bpo-38787: Fix Argument Clinic defining_class_converter by vstinner · Pull Request #20074 · python/cpython · GitHub

Repository navigation

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .py  (1) All 1 file type selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
9 changes: 7 additions & 2 deletions Tools/clinic/clinic.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -724,7 +724,7 @@ def output_templates(self, f):

parser_prototype_def_class = normalize_snippet("""
static PyObject *
{c_basename}({self_type}{self_name}, PyTypeObject *cls, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
{c_basename}({self_type}{self_name}, PyTypeObject *{defining_class_name}, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
""")

# parser_body_fields remembers the fields passed in to the
Expand Down Expand Up @@ -1305,7 +1305,8 @@ def render_function(self, clinic, f):
template_dict['docstring'] = self.docstring_for_c_string(f)

template_dict['self_name'] = template_dict['self_type'] = template_dict['self_type_check'] = ''
f_self.converter.set_template_dict(template_dict)
for converter in converters:
converter.set_template_dict(template_dict)

f.return_converter.render(f, data)
template_dict['impl_return_type'] = f.return_converter.type
Expand Down Expand Up @@ -2698,6 +2699,10 @@ def parse_arg(self, argname, displayname):
""".format(argname=argname, paramname=self.name, cast=cast)
return None

def set_template_dict(self, template_dict):
pass


type_checks = {
'&PyLong_Type': ('PyLong_Check', 'int'),
'&PyTuple_Type': ('PyTuple_Check', 'tuple'),
Expand Down

Back | FazBrowse Home | New Git URL