Serhiy Storchaka added the comment:

There are patches based on modules_issue20186.patch that convert to Argument 
Clinic 4 modules: _csv, _lsprof, _tracemalloc and symtable. They are 
synchronized with current sources and updated to current Argument Clinic. 
Other changes:

* Addressed Larry's comments.

* Used converter names instead of format units (object instead of 'O' etc).

* Removed unneeded self declarations in _lsprof.

* Removed changes for _csv.Dialect.__new__. Generated signature has None as 
default values, but this is not true. Actually parameters don't have default 
values. This function can't be converted.

* Parameters of _lsprof.Profiler.enable should have the int converter, not 
bool. Default values are -1 (meaning "don't change current value"), not True.

* Made the parameter of _tracemalloc._get_object_traceback() positional-only.

* Simplified code for creating a result in _traceback functions.

----------
Added file: http://bugs.python.org/file46357/csv_clinic.patch
Added file: http://bugs.python.org/file46358/lsprof_clinic.patch
Added file: http://bugs.python.org/file46359/tracemalloc_clinic.patch
Added file: http://bugs.python.org/file46360/symtable_clinic.patch

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue20186>
_______________________________________
diff -r f44f44b14dfc Modules/_csv.c
--- a/Modules/_csv.c    Fri Jan 20 08:35:18 2017 +0200
+++ b/Modules/_csv.c    Fri Jan 20 18:17:14 2017 +0200
@@ -13,6 +13,12 @@ module instead.
 #include "Python.h"
 #include "structmember.h"
 
+#include "clinic/_csv.c.h"
+/*[clinic input]
+module _csv
+class _csv.Dialect "PyObject *" "&Dialect_Type"
+[clinic start generated code]*/
+/*[clinic end generated code: output=da39a3ee5e6b4b0d input=6f3170c88d1c5a7a]*/
 
 typedef struct {
     PyObject *error_obj;   /* CSV exception */
@@ -1421,12 +1427,21 @@ csv_writer(PyObject *module, PyObject *a
 /*
  * DIALECT REGISTRY
  */
+
+/*[clinic input]
+_csv.list_dialects
+
+Return a list of all know dialect names.
+[clinic start generated code]*/
+
 static PyObject *
-csv_list_dialects(PyObject *module, PyObject *args)
+_csv_list_dialects_impl(PyObject *module)
+/*[clinic end generated code: output=a5b92b215b006a6d input=a31ccb1071637d7c]*/
 {
     return PyDict_Keys(_csvstate_global->dialects);
 }
 
+
 static PyObject *
 csv_register_dialect(PyObject *module, PyObject *args, PyObject *kwargs)
 {
@@ -1454,36 +1469,69 @@ csv_register_dialect(PyObject *module, P
     return Py_None;
 }
 
+/*[clinic input]
+_csv.unregister_dialect
+
+    name: object
+    /
+
+Delete the name/dialect mapping associated with a string name.
+[clinic start generated code]*/
+
 static PyObject *
-csv_unregister_dialect(PyObject *module, PyObject *name_obj)
+_csv_unregister_dialect(PyObject *module, PyObject *name)
+/*[clinic end generated code: output=cf44401586cd32eb input=24474725768445c0]*/
 {
-    if (PyDict_DelItem(_csvstate_global->dialects, name_obj) < 0)
+    if (PyDict_DelItem(_csvstate_global->dialects, name) < 0)
         return PyErr_Format(_csvstate_global->error_obj, "unknown dialect");
-    Py_INCREF(Py_None);
-    return Py_None;
+    Py_RETURN_NONE;
 }
 
+
+/*[clinic input]
+_csv.get_dialect
+
+    name: object
+    /
+
+Return the dialect instance associated with name.
+[clinic start generated code]*/
+
 static PyObject *
-csv_get_dialect(PyObject *module, PyObject *name_obj)
+_csv_get_dialect(PyObject *module, PyObject *name)
+/*[clinic end generated code: output=8f66fc0a27b68e24 input=c97af3b62e402afa]*/
 {
-    return get_dialect_from_registry(name_obj);
+    return get_dialect_from_registry(name);
 }
 
+
+/*[clinic input]
+_csv.field_size_limit
+
+    [
+    limit: object
+    ]
+    /
+
+Sets an upper limit on parsed fields.
+
+Returns old limit. If limit is not given, no new limit is set and
+the old limit is returned.
+[clinic start generated code]*/
+
 static PyObject *
-csv_field_size_limit(PyObject *module, PyObject *args)
+_csv_field_size_limit(PyObject *module, int group_right_1, PyObject *limit)
+/*[clinic end generated code: output=49e0056f0b1e96f7 input=76b66600a7195ac4]*/
 {
-    PyObject *new_limit = NULL;
     long old_limit = _csvstate_global->field_limit;
 
-    if (!PyArg_UnpackTuple(args, "field_size_limit", 0, 1, &new_limit))
-        return NULL;
-    if (new_limit != NULL) {
-        if (!PyLong_CheckExact(new_limit)) {
+    if (group_right_1) {
+        if (!PyLong_CheckExact(limit)) {
             PyErr_Format(PyExc_TypeError,
                          "limit must be an integer");
             return NULL;
         }
-        _csvstate_global->field_limit = PyLong_AsLong(new_limit);
+        _csvstate_global->field_limit = PyLong_AsLong(limit);
         if (_csvstate_global->field_limit == -1 && PyErr_Occurred()) {
             _csvstate_global->field_limit = old_limit;
             return NULL;
@@ -1583,44 +1631,22 @@ PyDoc_STRVAR(csv_writer_doc,
 "\n"
 "The \"fileobj\" argument can be any object that supports the file API.\n");
 
-PyDoc_STRVAR(csv_list_dialects_doc,
-"Return a list of all know dialect names.\n"
-"    names = csv.list_dialects()");
-
-PyDoc_STRVAR(csv_get_dialect_doc,
-"Return the dialect instance associated with name.\n"
-"    dialect = csv.get_dialect(name)");
-
 PyDoc_STRVAR(csv_register_dialect_doc,
 "Create a mapping from a string name to a dialect class.\n"
 "    dialect = csv.register_dialect(name[, dialect[, **fmtparams]])");
 
-PyDoc_STRVAR(csv_unregister_dialect_doc,
-"Delete the name/dialect mapping associated with a string name.\n"
-"    csv.unregister_dialect(name)");
-
-PyDoc_STRVAR(csv_field_size_limit_doc,
-"Sets an upper limit on parsed fields.\n"
-"    csv.field_size_limit([limit])\n"
-"\n"
-"Returns old limit. If limit is not given, no new limit is set and\n"
-"the old limit is returned");
 
 static struct PyMethodDef csv_methods[] = {
     { "reader", (PyCFunction)csv_reader,
         METH_VARARGS | METH_KEYWORDS, csv_reader_doc},
     { "writer", (PyCFunction)csv_writer,
         METH_VARARGS | METH_KEYWORDS, csv_writer_doc},
-    { "list_dialects", (PyCFunction)csv_list_dialects,
-        METH_NOARGS, csv_list_dialects_doc},
     { "register_dialect", (PyCFunction)csv_register_dialect,
-        METH_VARARGS | METH_KEYWORDS, csv_register_dialect_doc},
-    { "unregister_dialect", (PyCFunction)csv_unregister_dialect,
-        METH_O, csv_unregister_dialect_doc},
-    { "get_dialect", (PyCFunction)csv_get_dialect,
-        METH_O, csv_get_dialect_doc},
-    { "field_size_limit", (PyCFunction)csv_field_size_limit,
-        METH_VARARGS, csv_field_size_limit_doc},
+      METH_VARARGS | METH_KEYWORDS, csv_register_dialect_doc},
+    _CSV_LIST_DIALECTS_METHODDEF
+    _CSV_UNREGISTER_DIALECT_METHODDEF
+    _CSV_GET_DIALECT_METHODDEF
+    _CSV_FIELD_SIZE_LIMIT_METHODDEF
     { NULL, NULL }
 };
 
diff -r f44f44b14dfc Modules/clinic/_csv.c.h
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/Modules/clinic/_csv.c.h   Fri Jan 20 18:17:14 2017 +0200
@@ -0,0 +1,50 @@
+/*[clinic input]
+preserve
+[clinic start generated code]*/
+
+PyDoc_STRVAR(_csv_list_dialects__doc__,
+"list_dialects($module, /)\n"
+"--\n"
+"\n"
+"Return a list of all know dialect names.");
+
+#define _CSV_LIST_DIALECTS_METHODDEF    \
+    {"list_dialects", (PyCFunction)_csv_list_dialects, METH_NOARGS, 
_csv_list_dialects__doc__},
+
+static PyObject *
+_csv_list_dialects_impl(PyObject *module);
+
+static PyObject *
+_csv_list_dialects(PyObject *module, PyObject *Py_UNUSED(ignored))
+{
+    return _csv_list_dialects_impl(module);
+}
+
+PyDoc_STRVAR(_csv_unregister_dialect__doc__,
+"unregister_dialect($module, name, /)\n"
+"--\n"
+"\n"
+"Delete the name/dialect mapping associated with a string name.");
+
+#define _CSV_UNREGISTER_DIALECT_METHODDEF    \
+    {"unregister_dialect", (PyCFunction)_csv_unregister_dialect, METH_O, 
_csv_unregister_dialect__doc__},
+
+PyDoc_STRVAR(_csv_get_dialect__doc__,
+"get_dialect($module, name, /)\n"
+"--\n"
+"\n"
+"Return the dialect instance associated with name.");
+
+#define _CSV_GET_DIALECT_METHODDEF    \
+    {"get_dialect", (PyCFunction)_csv_get_dialect, METH_O, 
_csv_get_dialect__doc__},
+
+PyDoc_STRVAR(_csv_field_size_limit__doc__,
+"field_size_limit([limit])\n"
+"Sets an upper limit on parsed fields.\n"
+"\n"
+"Returns old limit. If limit is not given, no new limit is set and\n"
+"the old limit is returned.");
+
+#define _CSV_FIELD_SIZE_LIMIT_METHODDEF    \
+    {"field_size_limit", (PyCFunction)_csv_field_size_limit, METH_O, 
_csv_field_size_limit__doc__},
+/*[clinic end generated code: output=ce2035869742b7db input=a9049054013a1b77]*/
diff -r f44f44b14dfc Modules/_lsprof.c
--- a/Modules/_lsprof.c Fri Jan 20 08:35:18 2017 +0200
+++ b/Modules/_lsprof.c Fri Jan 20 18:02:02 2017 +0200
@@ -2,6 +2,12 @@
 #include "frameobject.h"
 #include "rotatingtree.h"
 
+/*[clinic input]
+module _lsprof
+class _lsprof.Profiler "ProfilerObject *" "&PyProfiler_Type"
+[clinic start generated code]*/
+/*[clinic end generated code: output=da39a3ee5e6b4b0d input=dea500b5ae122746]*/
+
 /*** Selection of a high-precision timer ***/
 
 #ifdef MS_WINDOWS
@@ -601,46 +607,47 @@ static int statsForEntry(rotating_node_t
     return err;
 }
 
-PyDoc_STRVAR(getstats_doc, "\
-getstats() -> list of profiler_entry objects\n\
-\n\
-Return all information collected by the profiler.\n\
-Each profiler_entry is a tuple-like object with the\n\
-following attributes:\n\
-\n\
-    code          code object\n\
-    callcount     how many times this was called\n\
-    reccallcount  how many times called recursively\n\
-    totaltime     total time in this entry\n\
-    inlinetime    inline time in this entry (not in subcalls)\n\
-    calls         details of the calls\n\
-\n\
-The calls attribute is either None or a list of\n\
-profiler_subentry objects:\n\
-\n\
-    code          called code object\n\
-    callcount     how many times this is called\n\
-    reccallcount  how many times this is called recursively\n\
-    totaltime     total time spent in this call\n\
-    inlinetime    inline time (not in further subcalls)\n\
-");
 
-static PyObject*
-profiler_getstats(ProfilerObject *pObj, PyObject* noarg)
+/*[clinic input]
+_lsprof.Profiler.getstats
+
+Return all information collected by the profiler.
+
+Each profiler_entry is a tuple-like object with the following attributes:
+
+    code          code object
+    callcount     how many times this was called
+    reccallcount  how many times called recursively
+    totaltime     total time in this entry
+    inlinetime    inline time in this entry (not in subcalls)
+    calls         details of the calls
+
+The calls attribute is either None or a list of profiler_subentry objects:
+
+    code          called code object
+    callcount     how many times this is called
+    reccallcount  how many times this is called recursively
+    totaltime     total time spent in this call
+    inlinetime    inline time (not in further subcalls)
+[clinic start generated code]*/
+
+static PyObject *
+_lsprof_Profiler_getstats_impl(ProfilerObject *self)
+/*[clinic end generated code: output=9461b451e9ef0f24 input=a6d5ede1f4cb3f71]*/
 {
     statscollector_t collect;
-    if (pending_exception(pObj))
+    if (pending_exception(self))
         return NULL;
-    if (!pObj->externalTimer)
+    if (!self->externalTimer)
         collect.factor = hpTimerUnit();
-    else if (pObj->externalTimerUnit > 0.0)
-        collect.factor = pObj->externalTimerUnit;
+    else if (self->externalTimerUnit > 0.0)
+        collect.factor = self->externalTimerUnit;
     else
         collect.factor = 1.0 / DOUBLE_TIMER_PRECISION;
     collect.list = PyList_New(0);
     if (collect.list == NULL)
         return NULL;
-    if (RotatingTree_Enum(pObj->profilerEntries, statsForEntry, &collect)
+    if (RotatingTree_Enum(self->profilerEntries, statsForEntry, &collect)
         != 0) {
         Py_DECREF(collect.list);
         return NULL;
@@ -669,31 +676,32 @@ setBuiltins(ProfilerObject *pObj, int nv
     return 0;
 }
 
-PyDoc_STRVAR(enable_doc, "\
-enable(subcalls=True, builtins=True)\n\
-\n\
-Start collecting profiling information.\n\
-If 'subcalls' is True, also records for each function\n\
-statistics separated according to its current caller.\n\
-If 'builtins' is True, records the time spent in\n\
-built-in functions separately from their caller.\n\
-");
 
-static PyObject*
-profiler_enable(ProfilerObject *self, PyObject *args, PyObject *kwds)
+/*[clinic input]
+_lsprof.Profiler.enable
+
+    subcalls: int = -1
+    builtins: int = -1
+    /
+
+Start collecting profiling information.
+
+If 'subcalls' is True, also records for each function
+statistics separated according to its current caller.
+If 'builtins' is True, records the time spent in
+built-in functions separately from their caller.
+[clinic start generated code]*/
+
+static PyObject *
+_lsprof_Profiler_enable_impl(ProfilerObject *self, int subcalls,
+                             int builtins)
+/*[clinic end generated code: output=1e747f9dc1edd571 input=7443f0f3799d770a]*/
 {
-    int subcalls = -1;
-    int builtins = -1;
-    static char *kwlist[] = {"subcalls", "builtins", 0};
-    if (!PyArg_ParseTupleAndKeywords(args, kwds, "|ii:enable",
-                                     kwlist, &subcalls, &builtins))
-        return NULL;
     if (setSubcalls(self, subcalls) < 0 || setBuiltins(self, builtins) < 0)
         return NULL;
     PyEval_SetProfile(profiler_callback, (PyObject*)self);
     self->flags |= POF_ENABLED;
-    Py_INCREF(Py_None);
-    return Py_None;
+    Py_RETURN_NONE;
 }
 
 static void
@@ -712,36 +720,38 @@ flush_unmatched(ProfilerObject *pObj)
 
 }
 
-PyDoc_STRVAR(disable_doc, "\
-disable()\n\
-\n\
-Stop collecting profiling information.\n\
-");
 
-static PyObject*
-profiler_disable(ProfilerObject *self, PyObject* noarg)
+/*[clinic input]
+_lsprof.Profiler.disable
+
+Stop collecting profiling information.
+[clinic start generated code]*/
+
+static PyObject *
+_lsprof_Profiler_disable_impl(ProfilerObject *self)
+/*[clinic end generated code: output=838cffef7f651870 input=05700b3fc68d1f50]*/
 {
     self->flags &= ~POF_ENABLED;
     PyEval_SetProfile(NULL, NULL);
     flush_unmatched(self);
     if (pending_exception(self))
         return NULL;
-    Py_INCREF(Py_None);
-    return Py_None;
+    Py_RETURN_NONE;
 }
 
-PyDoc_STRVAR(clear_doc, "\
-clear()\n\
-\n\
-Clear all profiling information collected so far.\n\
-");
 
-static PyObject*
-profiler_clear(ProfilerObject *pObj, PyObject* noarg)
+/*[clinic input]
+_lsprof.Profiler.clear
+
+Clear all profiling information collected so far.
+[clinic start generated code]*/
+
+static PyObject *
+_lsprof_Profiler_clear_impl(ProfilerObject *self)
+/*[clinic end generated code: output=dd1c668fb84b1335 input=fbe1f88c28be4f98]*/
 {
-    clearEntries(pObj);
-    Py_INCREF(Py_None);
-    return Py_None;
+    clearEntries(self);
+    Py_RETURN_NONE;
 }
 
 static void
@@ -755,51 +765,46 @@ profiler_dealloc(ProfilerObject *op)
     Py_TYPE(op)->tp_free(op);
 }
 
+/*[clinic input]
+_lsprof.Profiler.__init__
+
+    timer: object = NULL
+    timeunit: double = 0.0
+    subcalls: int(c_default="1") = True
+    builtins: int(c_default="1") = True
+    /
+
+Builds a profiler object using the specified timer function.
+
+The default timer is a fast built-in one based on real time.
+For custom timer functions returning integers, timeunit can
+be a float specifying a scale (i.e. how long each integer unit
+is, in seconds).
+[clinic start generated code]*/
+
 static int
-profiler_init(ProfilerObject *pObj, PyObject *args, PyObject *kw)
+_lsprof_Profiler___init___impl(ProfilerObject *self, PyObject *timer,
+                               double timeunit, int subcalls, int builtins)
+/*[clinic end generated code: output=ab5498359fd34283 input=310726c90ffbcfa1]*/
 {
-    PyObject *timer = NULL;
-    double timeunit = 0.0;
-    int subcalls = 1;
-    int builtins = 1;
-    static char *kwlist[] = {"timer", "timeunit",
-                                   "subcalls", "builtins", 0};
-
-    if (!PyArg_ParseTupleAndKeywords(args, kw, "|Odii:Profiler", kwlist,
-                                     &timer, &timeunit,
-                                     &subcalls, &builtins))
+    if (setSubcalls(self, subcalls) < 0 || setBuiltins(self, builtins) < 0)
         return -1;
-
-    if (setSubcalls(pObj, subcalls) < 0 || setBuiltins(pObj, builtins) < 0)
-        return -1;
-    pObj->externalTimerUnit = timeunit;
+    self->externalTimerUnit = timeunit;
     Py_XINCREF(timer);
-    Py_XSETREF(pObj->externalTimer, timer);
+    Py_XSETREF(self->externalTimer, timer);
     return 0;
 }
 
+#include "clinic/_lsprof.c.h"
+
 static PyMethodDef profiler_methods[] = {
-    {"getstats",    (PyCFunction)profiler_getstats,
-                    METH_NOARGS,                        getstats_doc},
-    {"enable",          (PyCFunction)profiler_enable,
-                    METH_VARARGS | METH_KEYWORDS,       enable_doc},
-    {"disable",         (PyCFunction)profiler_disable,
-                    METH_NOARGS,                        disable_doc},
-    {"clear",           (PyCFunction)profiler_clear,
-                    METH_NOARGS,                        clear_doc},
+    _LSPROF_PROFILER_GETSTATS_METHODDEF
+    _LSPROF_PROFILER_ENABLE_METHODDEF
+    _LSPROF_PROFILER_DISABLE_METHODDEF
+    _LSPROF_PROFILER_CLEAR_METHODDEF
     {NULL, NULL}
 };
 
-PyDoc_STRVAR(profiler_doc, "\
-Profiler(custom_timer=None, time_unit=None, subcalls=True, builtins=True)\n\
-\n\
-    Builds a profiler object using the specified timer function.\n\
-    The default timer is a fast built-in one based on real time.\n\
-    For custom timer functions returning integers, time_unit can\n\
-    be a float specifying a scale (i.e. how long each integer unit\n\
-    is, in seconds).\n\
-");
-
 static PyTypeObject PyProfiler_Type = {
     PyVarObject_HEAD_INIT(NULL, 0)
     "_lsprof.Profiler",                     /* tp_name */
@@ -821,7 +826,7 @@ static PyTypeObject PyProfiler_Type = {
     0,                                      /* tp_setattro */
     0,                                      /* tp_as_buffer */
     Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */
-    profiler_doc,                           /* tp_doc */
+    _lsprof_Profiler___init____doc__,       /* tp_doc */
     0,                                      /* tp_traverse */
     0,                                      /* tp_clear */
     0,                                      /* tp_richcompare */
@@ -836,7 +841,7 @@ static PyTypeObject PyProfiler_Type = {
     0,                                      /* tp_descr_get */
     0,                                      /* tp_descr_set */
     0,                                      /* tp_dictoffset */
-    (initproc)profiler_init,                /* tp_init */
+    _lsprof_Profiler___init__,              /* tp_init */
     PyType_GenericAlloc,                    /* tp_alloc */
     PyType_GenericNew,                      /* tp_new */
     PyObject_Del,                           /* tp_free */
diff -r f44f44b14dfc Modules/clinic/_lsprof.c.h
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/Modules/clinic/_lsprof.c.h        Fri Jan 20 18:02:02 2017 +0200
@@ -0,0 +1,152 @@
+/*[clinic input]
+preserve
+[clinic start generated code]*/
+
+PyDoc_STRVAR(_lsprof_Profiler_getstats__doc__,
+"getstats($self, /)\n"
+"--\n"
+"\n"
+"Return all information collected by the profiler.\n"
+"\n"
+"Each profiler_entry is a tuple-like object with the following attributes:\n"
+"\n"
+"    code          code object\n"
+"    callcount     how many times this was called\n"
+"    reccallcount  how many times called recursively\n"
+"    totaltime     total time in this entry\n"
+"    inlinetime    inline time in this entry (not in subcalls)\n"
+"    calls         details of the calls\n"
+"\n"
+"The calls attribute is either None or a list of profiler_subentry objects:\n"
+"\n"
+"    code          called code object\n"
+"    callcount     how many times this is called\n"
+"    reccallcount  how many times this is called recursively\n"
+"    totaltime     total time spent in this call\n"
+"    inlinetime    inline time (not in further subcalls)");
+
+#define _LSPROF_PROFILER_GETSTATS_METHODDEF    \
+    {"getstats", (PyCFunction)_lsprof_Profiler_getstats, METH_NOARGS, 
_lsprof_Profiler_getstats__doc__},
+
+static PyObject *
+_lsprof_Profiler_getstats_impl(ProfilerObject *self);
+
+static PyObject *
+_lsprof_Profiler_getstats(ProfilerObject *self, PyObject *Py_UNUSED(ignored))
+{
+    return _lsprof_Profiler_getstats_impl(self);
+}
+
+PyDoc_STRVAR(_lsprof_Profiler_enable__doc__,
+"enable($self, subcalls=-1, builtins=-1, /)\n"
+"--\n"
+"\n"
+"Start collecting profiling information.\n"
+"\n"
+"If \'subcalls\' is True, also records for each function\n"
+"statistics separated according to its current caller.\n"
+"If \'builtins\' is True, records the time spent in\n"
+"built-in functions separately from their caller.");
+
+#define _LSPROF_PROFILER_ENABLE_METHODDEF    \
+    {"enable", (PyCFunction)_lsprof_Profiler_enable, METH_FASTCALL, 
_lsprof_Profiler_enable__doc__},
+
+static PyObject *
+_lsprof_Profiler_enable_impl(ProfilerObject *self, int subcalls,
+                             int builtins);
+
+static PyObject *
+_lsprof_Profiler_enable(ProfilerObject *self, PyObject **args, Py_ssize_t 
nargs, PyObject *kwnames)
+{
+    PyObject *return_value = NULL;
+    int subcalls = -1;
+    int builtins = -1;
+
+    if (!_PyArg_ParseStack(args, nargs, "|ii:enable",
+        &subcalls, &builtins)) {
+        goto exit;
+    }
+
+    if (!_PyArg_NoStackKeywords("enable", kwnames)) {
+        goto exit;
+    }
+    return_value = _lsprof_Profiler_enable_impl(self, subcalls, builtins);
+
+exit:
+    return return_value;
+}
+
+PyDoc_STRVAR(_lsprof_Profiler_disable__doc__,
+"disable($self, /)\n"
+"--\n"
+"\n"
+"Stop collecting profiling information.");
+
+#define _LSPROF_PROFILER_DISABLE_METHODDEF    \
+    {"disable", (PyCFunction)_lsprof_Profiler_disable, METH_NOARGS, 
_lsprof_Profiler_disable__doc__},
+
+static PyObject *
+_lsprof_Profiler_disable_impl(ProfilerObject *self);
+
+static PyObject *
+_lsprof_Profiler_disable(ProfilerObject *self, PyObject *Py_UNUSED(ignored))
+{
+    return _lsprof_Profiler_disable_impl(self);
+}
+
+PyDoc_STRVAR(_lsprof_Profiler_clear__doc__,
+"clear($self, /)\n"
+"--\n"
+"\n"
+"Clear all profiling information collected so far.");
+
+#define _LSPROF_PROFILER_CLEAR_METHODDEF    \
+    {"clear", (PyCFunction)_lsprof_Profiler_clear, METH_NOARGS, 
_lsprof_Profiler_clear__doc__},
+
+static PyObject *
+_lsprof_Profiler_clear_impl(ProfilerObject *self);
+
+static PyObject *
+_lsprof_Profiler_clear(ProfilerObject *self, PyObject *Py_UNUSED(ignored))
+{
+    return _lsprof_Profiler_clear_impl(self);
+}
+
+PyDoc_STRVAR(_lsprof_Profiler___init____doc__,
+"Profiler(timer=None, timeunit=0.0, subcalls=True, builtins=True, /)\n"
+"--\n"
+"\n"
+"Builds a profiler object using the specified timer function.\n"
+"\n"
+"The default timer is a fast built-in one based on real time.\n"
+"For custom timer functions returning integers, timeunit can\n"
+"be a float specifying a scale (i.e. how long each integer unit\n"
+"is, in seconds).");
+
+static int
+_lsprof_Profiler___init___impl(ProfilerObject *self, PyObject *timer,
+                               double timeunit, int subcalls, int builtins);
+
+static int
+_lsprof_Profiler___init__(PyObject *self, PyObject *args, PyObject *kwargs)
+{
+    int return_value = -1;
+    PyObject *timer = NULL;
+    double timeunit = 0.0;
+    int subcalls = 1;
+    int builtins = 1;
+
+    if ((Py_TYPE(self) == &PyProfiler_Type) &&
+        !_PyArg_NoKeywords("Profiler", kwargs)) {
+        goto exit;
+    }
+    if (!PyArg_ParseTuple(args, "|Odii:Profiler",
+        &timer, &timeunit, &subcalls, &builtins)) {
+        goto exit;
+    }
+    return_value = _lsprof_Profiler___init___impl((ProfilerObject *)self, 
timer, timeunit, subcalls, builtins);
+
+exit:
+    return return_value;
+}
+/*[clinic end generated code: output=205f6aa40ac0e5b7 input=a9049054013a1b77]*/
diff -r f44f44b14dfc Modules/_tracemalloc.c
--- a/Modules/_tracemalloc.c    Fri Jan 20 08:35:18 2017 +0200
+++ b/Modules/_tracemalloc.c    Fri Jan 20 18:28:16 2017 +0200
@@ -4,6 +4,12 @@
 #include "pythread.h"
 #include "osdefs.h"
 
+#include "clinic/_tracemalloc.c.h"
+/*[clinic input]
+module _tracemalloc
+[clinic start generated code]*/
+/*[clinic end generated code: output=da39a3ee5e6b4b0d input=708a98302fc46e5f]*/
+
 /* Trace memory blocks allocated by PyMem_RawMalloc() */
 #define TRACE_RAW_MALLOC
 
@@ -1161,27 +1167,31 @@ tracemalloc_stop(void)
     tracemalloc_traceback = NULL;
 }
 
-PyDoc_STRVAR(tracemalloc_is_tracing_doc,
-    "is_tracing()->bool\n"
-    "\n"
-    "True if the tracemalloc module is tracing Python memory allocations,\n"
-    "False otherwise.");
 
 
-static PyObject*
-py_tracemalloc_is_tracing(PyObject *self)
+/*[clinic input]
+_tracemalloc.is_tracing
+
+Return True if the tracemalloc module is tracing Python memory allocations.
+[clinic start generated code]*/
+
+static PyObject *
+_tracemalloc_is_tracing_impl(PyObject *module)
+/*[clinic end generated code: output=2d763b42601cd3ef input=8beb4fb5446813be]*/
 {
     return PyBool_FromLong(tracemalloc_config.tracing);
 }
 
-PyDoc_STRVAR(tracemalloc_clear_traces_doc,
-    "clear_traces()\n"
-    "\n"
-    "Clear traces of memory blocks allocated by Python.");
 
+/*[clinic input]
+_tracemalloc.clear_traces
 
-static PyObject*
-py_tracemalloc_clear_traces(PyObject *self)
+Clear traces of memory blocks allocated by Python.
+[clinic start generated code]*/
+
+static PyObject *
+_tracemalloc_clear_traces_impl(PyObject *module)
+/*[clinic end generated code: output=a86080ee41b84197 input=0dab5b6c785183a5]*/
 {
     if (!tracemalloc_config.tracing)
         Py_RETURN_NONE;
@@ -1343,17 +1353,21 @@ tracemalloc_pyobject_decref_cb(_Py_hasht
 }
 
 
-PyDoc_STRVAR(tracemalloc_get_traces_doc,
-    "_get_traces() -> list\n"
-    "\n"
-    "Get traces of all memory blocks allocated by Python.\n"
-    "Return a list of (size: int, traceback: tuple) tuples.\n"
-    "traceback is a tuple of (filename: str, lineno: int) tuples.\n"
-    "\n"
-    "Return an empty list if the tracemalloc module is disabled.");
 
-static PyObject*
-py_tracemalloc_get_traces(PyObject *self, PyObject *obj)
+/*[clinic input]
+_tracemalloc._get_traces
+
+Get traces of all memory blocks allocated by Python.
+
+Return a list of (size: int, traceback: tuple) tuples.
+traceback is a tuple of (filename: str, lineno: int) tuples.
+
+Return an empty list if the tracemalloc module is disabled.
+[clinic start generated code]*/
+
+static PyObject *
+_tracemalloc__get_traces_impl(PyObject *module)
+/*[clinic end generated code: output=e9929876ced4b5cc input=6c7d2230b24255aa]*/
 {
     get_traces_t get_traces;
     int err;
@@ -1439,17 +1453,23 @@ tracemalloc_get_traceback(_PyTraceMalloc
 }
 
 
-PyDoc_STRVAR(tracemalloc_get_object_traceback_doc,
-    "_get_object_traceback(obj)\n"
-    "\n"
-    "Get the traceback where the Python object obj was allocated.\n"
-    "Return a tuple of (filename: str, lineno: int) tuples.\n"
-    "\n"
-    "Return None if the tracemalloc module is disabled or did not\n"
-    "trace the allocation of the object.");
 
-static PyObject*
-py_tracemalloc_get_object_traceback(PyObject *self, PyObject *obj)
+/*[clinic input]
+_tracemalloc._get_object_traceback
+
+    obj: object
+    /
+
+Get the traceback where the Python object obj was allocated.
+
+Return a tuple of (filename: str, lineno: int) tuples.
+Return None if the tracemalloc module is disabled or did not
+trace the allocation of the object.
+[clinic start generated code]*/
+
+static PyObject *
+_tracemalloc__get_object_traceback(PyObject *module, PyObject *obj)
+/*[clinic end generated code: output=41ee0553a658b0aa input=29495f1b21c53212]*/
 {
     PyTypeObject *type;
     void *ptr;
@@ -1503,25 +1523,29 @@ void
 #undef PUTS
 
 
-PyDoc_STRVAR(tracemalloc_start_doc,
-    "start(nframe: int=1)\n"
-    "\n"
-    "Start tracing Python memory allocations. Set also the maximum number \n"
-    "of frames stored in the traceback of a trace to nframe.");
 
-static PyObject*
-py_tracemalloc_start(PyObject *self, PyObject *args)
+/*[clinic input]
+_tracemalloc.start
+
+    nframe: Py_ssize_t = 1
+    /
+
+Start tracing Python memory allocations.
+
+Also set the maximum number of frames stored in the traceback of a
+trace to nframe.
+[clinic start generated code]*/
+
+static PyObject *
+_tracemalloc_start_impl(PyObject *module, Py_ssize_t nframe)
+/*[clinic end generated code: output=0f558d2079511553 input=997841629cc441cb]*/
 {
-    Py_ssize_t nframe = 1;
     int nframe_int;
 
-    if (!PyArg_ParseTuple(args, "|n:start", &nframe))
-        return NULL;
-
     if (nframe < 1 || nframe > MAX_NFRAME) {
         PyErr_Format(PyExc_ValueError,
                      "the number of frames must be in range [1; %i]",
-                     MAX_NFRAME);
+                     (int)MAX_NFRAME);
         return NULL;
     }
     nframe_int = Py_SAFE_DOWNCAST(nframe, Py_ssize_t, int);
@@ -1532,48 +1556,55 @@ py_tracemalloc_start(PyObject *self, PyO
     Py_RETURN_NONE;
 }
 
-PyDoc_STRVAR(tracemalloc_stop_doc,
-    "stop()\n"
-    "\n"
-    "Stop tracing Python memory allocations and clear traces\n"
-    "of memory blocks allocated by Python.");
 
+/*[clinic input]
+_tracemalloc.stop
 
-static PyObject*
-py_tracemalloc_stop(PyObject *self)
+Stop tracing Python memory allocations.
+
+Also clear traces of memory blocks allocated by Python.
+[clinic start generated code]*/
+
+static PyObject *
+_tracemalloc_stop_impl(PyObject *module)
+/*[clinic end generated code: output=c3c42ae03e3955cd input=7478f075e51dae18]*/
 {
     tracemalloc_stop();
     Py_RETURN_NONE;
 }
 
 
-PyDoc_STRVAR(tracemalloc_get_traceback_limit_doc,
-    "get_traceback_limit() -> int\n"
-    "\n"
-    "Get the maximum number of frames stored in the traceback\n"
-    "of a trace.\n"
-    "\n"
-    "By default, a trace of an allocated memory block only stores\n"
-    "the most recent frame: the limit is 1.");
+/*[clinic input]
+_tracemalloc.get_traceback_limit
 
-static PyObject*
-py_tracemalloc_get_traceback_limit(PyObject *self)
+Get the maximum number of frames stored in the traceback of a trace.
+
+By default, a trace of an allocated memory block only stores
+the most recent frame: the limit is 1.
+[clinic start generated code]*/
+
+static PyObject *
+_tracemalloc_get_traceback_limit_impl(PyObject *module)
+/*[clinic end generated code: output=d556d9306ba95567 input=da3cd977fc68ae3b]*/
 {
     return PyLong_FromLong(tracemalloc_config.max_nframe);
 }
 
 
-PyDoc_STRVAR(tracemalloc_get_tracemalloc_memory_doc,
-    "get_tracemalloc_memory() -> int\n"
-    "\n"
-    "Get the memory usage in bytes of the tracemalloc module\n"
-    "used internally to trace memory allocations.");
 
-static PyObject*
-tracemalloc_get_tracemalloc_memory(PyObject *self)
+/*[clinic input]
+_tracemalloc.get_tracemalloc_memory
+
+Get the memory usage in bytes of the tracemalloc module.
+
+This memory is used internally to trace memory allocations.
+[clinic start generated code]*/
+
+static PyObject *
+_tracemalloc_get_tracemalloc_memory_impl(PyObject *module)
+/*[clinic end generated code: output=e3f14e280a55f5aa input=5d919c0f4d5132ad]*/
 {
     size_t size;
-    PyObject *size_obj;
 
     size = _Py_hashtable_size(tracemalloc_tracebacks);
     size += _Py_hashtable_size(tracemalloc_filenames);
@@ -1582,22 +1613,24 @@ tracemalloc_get_tracemalloc_memory(PyObj
     size += _Py_hashtable_size(tracemalloc_traces);
     TABLES_UNLOCK();
 
-    size_obj = PyLong_FromSize_t(size);
-    return Py_BuildValue("N", size_obj);
+    return PyLong_FromSize_t(size);
 }
 
 
-PyDoc_STRVAR(tracemalloc_get_traced_memory_doc,
-    "get_traced_memory() -> (int, int)\n"
-    "\n"
-    "Get the current size and peak size of memory blocks traced\n"
-    "by the tracemalloc module as a tuple: (current: int, peak: int).");
 
-static PyObject*
-tracemalloc_get_traced_memory(PyObject *self)
+/*[clinic input]
+_tracemalloc.get_traced_memory
+
+Get the current size and peak size of memory blocks traced by tracemalloc.
+
+Returns a tuple: (current: int, peak: int).
+[clinic start generated code]*/
+
+static PyObject *
+_tracemalloc_get_traced_memory_impl(PyObject *module)
+/*[clinic end generated code: output=5b167189adb9e782 input=61ddb5478400ff66]*/
 {
     Py_ssize_t size, peak_size;
-    PyObject *size_obj, *peak_size_obj;
 
     if (!tracemalloc_config.tracing)
         return Py_BuildValue("ii", 0, 0);
@@ -1607,32 +1640,20 @@ tracemalloc_get_traced_memory(PyObject *
     peak_size = tracemalloc_peak_traced_memory;
     TABLES_UNLOCK();
 
-    size_obj = PyLong_FromSize_t(size);
-    peak_size_obj = PyLong_FromSize_t(peak_size);
-    return Py_BuildValue("NN", size_obj, peak_size_obj);
+    return Py_BuildValue("nn", size, peak_size);
 }
 
 
 static PyMethodDef module_methods[] = {
-    {"is_tracing", (PyCFunction)py_tracemalloc_is_tracing,
-     METH_NOARGS, tracemalloc_is_tracing_doc},
-    {"clear_traces", (PyCFunction)py_tracemalloc_clear_traces,
-     METH_NOARGS, tracemalloc_clear_traces_doc},
-    {"_get_traces", (PyCFunction)py_tracemalloc_get_traces,
-     METH_NOARGS, tracemalloc_get_traces_doc},
-    {"_get_object_traceback", (PyCFunction)py_tracemalloc_get_object_traceback,
-     METH_O, tracemalloc_get_object_traceback_doc},
-    {"start", (PyCFunction)py_tracemalloc_start,
-      METH_VARARGS, tracemalloc_start_doc},
-    {"stop", (PyCFunction)py_tracemalloc_stop,
-      METH_NOARGS, tracemalloc_stop_doc},
-    {"get_traceback_limit", (PyCFunction)py_tracemalloc_get_traceback_limit,
-     METH_NOARGS, tracemalloc_get_traceback_limit_doc},
-    {"get_tracemalloc_memory", (PyCFunction)tracemalloc_get_tracemalloc_memory,
-     METH_NOARGS, tracemalloc_get_tracemalloc_memory_doc},
-    {"get_traced_memory", (PyCFunction)tracemalloc_get_traced_memory,
-     METH_NOARGS, tracemalloc_get_traced_memory_doc},
-
+    _TRACEMALLOC_IS_TRACING_METHODDEF
+    _TRACEMALLOC_CLEAR_TRACES_METHODDEF
+    _TRACEMALLOC__GET_TRACES_METHODDEF
+    _TRACEMALLOC__GET_OBJECT_TRACEBACK_METHODDEF
+    _TRACEMALLOC_START_METHODDEF
+    _TRACEMALLOC_STOP_METHODDEF
+    _TRACEMALLOC_GET_TRACEBACK_LIMIT_METHODDEF
+    _TRACEMALLOC_GET_TRACEMALLOC_MEMORY_METHODDEF
+    _TRACEMALLOC_GET_TRACED_MEMORY_METHODDEF
     /* sentinel */
     {NULL, NULL}
 };
diff -r f44f44b14dfc Modules/clinic/_tracemalloc.c.h
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/Modules/clinic/_tracemalloc.c.h   Fri Jan 20 18:28:16 2017 +0200
@@ -0,0 +1,192 @@
+/*[clinic input]
+preserve
+[clinic start generated code]*/
+
+PyDoc_STRVAR(_tracemalloc_is_tracing__doc__,
+"is_tracing($module, /)\n"
+"--\n"
+"\n"
+"True if the tracemalloc module is tracing Python memory allocations, False 
otherwise.");
+
+#define _TRACEMALLOC_IS_TRACING_METHODDEF    \
+    {"is_tracing", (PyCFunction)_tracemalloc_is_tracing, METH_NOARGS, 
_tracemalloc_is_tracing__doc__},
+
+static PyObject *
+_tracemalloc_is_tracing_impl(PyObject *module);
+
+static PyObject *
+_tracemalloc_is_tracing(PyObject *module, PyObject *Py_UNUSED(ignored))
+{
+    return _tracemalloc_is_tracing_impl(module);
+}
+
+PyDoc_STRVAR(_tracemalloc_clear_traces__doc__,
+"clear_traces($module, /)\n"
+"--\n"
+"\n"
+"Clear traces of memory blocks allocated by Python.");
+
+#define _TRACEMALLOC_CLEAR_TRACES_METHODDEF    \
+    {"clear_traces", (PyCFunction)_tracemalloc_clear_traces, METH_NOARGS, 
_tracemalloc_clear_traces__doc__},
+
+static PyObject *
+_tracemalloc_clear_traces_impl(PyObject *module);
+
+static PyObject *
+_tracemalloc_clear_traces(PyObject *module, PyObject *Py_UNUSED(ignored))
+{
+    return _tracemalloc_clear_traces_impl(module);
+}
+
+PyDoc_STRVAR(_tracemalloc__get_traces__doc__,
+"_get_traces($module, /)\n"
+"--\n"
+"\n"
+"Get traces of all memory blocks allocated by Python.\n"
+"\n"
+"Return a list of (size: int, traceback: tuple) tuples.\n"
+"traceback is a tuple of (filename: str, lineno: int) tuples.\n"
+"\n"
+"Return an empty list if the tracemalloc module is disabled.");
+
+#define _TRACEMALLOC__GET_TRACES_METHODDEF    \
+    {"_get_traces", (PyCFunction)_tracemalloc__get_traces, METH_NOARGS, 
_tracemalloc__get_traces__doc__},
+
+static PyObject *
+_tracemalloc__get_traces_impl(PyObject *module);
+
+static PyObject *
+_tracemalloc__get_traces(PyObject *module, PyObject *Py_UNUSED(ignored))
+{
+    return _tracemalloc__get_traces_impl(module);
+}
+
+PyDoc_STRVAR(_tracemalloc__get_object_traceback__doc__,
+"_get_object_traceback($module, obj, /)\n"
+"--\n"
+"\n"
+"Get the traceback where the Python object obj was allocated.\n"
+"\n"
+"Return a tuple of (filename: str, lineno: int) tuples.\n"
+"Return None if the tracemalloc module is disabled or did not\n"
+"trace the allocation of the object.");
+
+#define _TRACEMALLOC__GET_OBJECT_TRACEBACK_METHODDEF    \
+    {"_get_object_traceback", (PyCFunction)_tracemalloc__get_object_traceback, 
METH_O, _tracemalloc__get_object_traceback__doc__},
+
+PyDoc_STRVAR(_tracemalloc_start__doc__,
+"start($module, nframe=1, /)\n"
+"--\n"
+"\n"
+"Start tracing Python memory allocations.\n"
+"\n"
+"Also set the maximum number of frames stored in the traceback of a\n"
+"trace to nframe.");
+
+#define _TRACEMALLOC_START_METHODDEF    \
+    {"start", (PyCFunction)_tracemalloc_start, METH_FASTCALL, 
_tracemalloc_start__doc__},
+
+static PyObject *
+_tracemalloc_start_impl(PyObject *module, Py_ssize_t nframe);
+
+static PyObject *
+_tracemalloc_start(PyObject *module, PyObject **args, Py_ssize_t nargs, 
PyObject *kwnames)
+{
+    PyObject *return_value = NULL;
+    Py_ssize_t nframe = 1;
+
+    if (!_PyArg_ParseStack(args, nargs, "|n:start",
+        &nframe)) {
+        goto exit;
+    }
+
+    if (!_PyArg_NoStackKeywords("start", kwnames)) {
+        goto exit;
+    }
+    return_value = _tracemalloc_start_impl(module, nframe);
+
+exit:
+    return return_value;
+}
+
+PyDoc_STRVAR(_tracemalloc_stop__doc__,
+"stop($module, /)\n"
+"--\n"
+"\n"
+"Stop tracing Python memory allocations.\n"
+"\n"
+"Also clear traces of memory blocks allocated by Python.");
+
+#define _TRACEMALLOC_STOP_METHODDEF    \
+    {"stop", (PyCFunction)_tracemalloc_stop, METH_NOARGS, 
_tracemalloc_stop__doc__},
+
+static PyObject *
+_tracemalloc_stop_impl(PyObject *module);
+
+static PyObject *
+_tracemalloc_stop(PyObject *module, PyObject *Py_UNUSED(ignored))
+{
+    return _tracemalloc_stop_impl(module);
+}
+
+PyDoc_STRVAR(_tracemalloc_get_traceback_limit__doc__,
+"get_traceback_limit($module, /)\n"
+"--\n"
+"\n"
+"Get the maximum number of frames stored in the traceback of a trace.\n"
+"\n"
+"By default, a trace of an allocated memory block only stores\n"
+"the most recent frame: the limit is 1.");
+
+#define _TRACEMALLOC_GET_TRACEBACK_LIMIT_METHODDEF    \
+    {"get_traceback_limit", (PyCFunction)_tracemalloc_get_traceback_limit, 
METH_NOARGS, _tracemalloc_get_traceback_limit__doc__},
+
+static PyObject *
+_tracemalloc_get_traceback_limit_impl(PyObject *module);
+
+static PyObject *
+_tracemalloc_get_traceback_limit(PyObject *module, PyObject 
*Py_UNUSED(ignored))
+{
+    return _tracemalloc_get_traceback_limit_impl(module);
+}
+
+PyDoc_STRVAR(_tracemalloc_get_tracemalloc_memory__doc__,
+"get_tracemalloc_memory($module, /)\n"
+"--\n"
+"\n"
+"Get the memory usage in bytes of the tracemalloc module.\n"
+"\n"
+"This memory is used internally to trace memory allocations.");
+
+#define _TRACEMALLOC_GET_TRACEMALLOC_MEMORY_METHODDEF    \
+    {"get_tracemalloc_memory", 
(PyCFunction)_tracemalloc_get_tracemalloc_memory, METH_NOARGS, 
_tracemalloc_get_tracemalloc_memory__doc__},
+
+static PyObject *
+_tracemalloc_get_tracemalloc_memory_impl(PyObject *module);
+
+static PyObject *
+_tracemalloc_get_tracemalloc_memory(PyObject *module, PyObject 
*Py_UNUSED(ignored))
+{
+    return _tracemalloc_get_tracemalloc_memory_impl(module);
+}
+
+PyDoc_STRVAR(_tracemalloc_get_traced_memory__doc__,
+"get_traced_memory($module, /)\n"
+"--\n"
+"\n"
+"Get the current size and peak size of memory blocks traced by tracemalloc.\n"
+"\n"
+"Returns a tuple: (current: int, peak: int).");
+
+#define _TRACEMALLOC_GET_TRACED_MEMORY_METHODDEF    \
+    {"get_traced_memory", (PyCFunction)_tracemalloc_get_traced_memory, 
METH_NOARGS, _tracemalloc_get_traced_memory__doc__},
+
+static PyObject *
+_tracemalloc_get_traced_memory_impl(PyObject *module);
+
+static PyObject *
+_tracemalloc_get_traced_memory(PyObject *module, PyObject *Py_UNUSED(ignored))
+{
+    return _tracemalloc_get_traced_memory_impl(module);
+}
+/*[clinic end generated code: output=1e059f24619e23f9 input=a9049054013a1b77]*/
diff -r f44f44b14dfc Modules/clinic/symtablemodule.c.h
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/Modules/clinic/symtablemodule.c.h Fri Jan 20 18:02:54 2017 +0200
@@ -0,0 +1,39 @@
+/*[clinic input]
+preserve
+[clinic start generated code]*/
+
+PyDoc_STRVAR(_symtable_symtable__doc__,
+"symtable($module, str, filename, startstr, /)\n"
+"--\n"
+"\n"
+"Return symbol and scope dictionaries used internally by compiler.");
+
+#define _SYMTABLE_SYMTABLE_METHODDEF    \
+    {"symtable", (PyCFunction)_symtable_symtable, METH_FASTCALL, 
_symtable_symtable__doc__},
+
+static PyObject *
+_symtable_symtable_impl(PyObject *module, const char *str,
+                        PyObject *filename, const char *startstr);
+
+static PyObject *
+_symtable_symtable(PyObject *module, PyObject **args, Py_ssize_t nargs, 
PyObject *kwnames)
+{
+    PyObject *return_value = NULL;
+    const char *str;
+    PyObject *filename;
+    const char *startstr;
+
+    if (!_PyArg_ParseStack(args, nargs, "sO&s:symtable",
+        &str, PyUnicode_FSDecoder, &filename, &startstr)) {
+        goto exit;
+    }
+
+    if (!_PyArg_NoStackKeywords("symtable", kwnames)) {
+        goto exit;
+    }
+    return_value = _symtable_symtable_impl(module, str, filename, startstr);
+
+exit:
+    return return_value;
+}
+/*[clinic end generated code: output=071dee4d836e2cfd input=a9049054013a1b77]*/
diff -r f44f44b14dfc Modules/symtablemodule.c
--- a/Modules/symtablemodule.c  Fri Jan 20 08:35:18 2017 +0200
+++ b/Modules/symtablemodule.c  Fri Jan 20 18:02:54 2017 +0200
@@ -4,20 +4,33 @@
 #include "Python-ast.h"
 #include "symtable.h"
 
+#include "clinic/symtablemodule.c.h"
+/*[clinic input]
+module _symtable
+[clinic start generated code]*/
+/*[clinic end generated code: output=da39a3ee5e6b4b0d input=f4685845a7100605]*/
+
+
+/*[clinic input]
+_symtable.symtable
+
+    str:       str
+    filename:  object(converter='PyUnicode_FSDecoder')
+    startstr:  str
+    /
+
+Return symbol and scope dictionaries used internally by compiler.
+[clinic start generated code]*/
+
 static PyObject *
-symtable_symtable(PyObject *self, PyObject *args)
+_symtable_symtable_impl(PyObject *module, const char *str,
+                        PyObject *filename, const char *startstr)
+/*[clinic end generated code: output=914b369c9b785956 input=6c615e84d5f408e3]*/
 {
     struct symtable *st;
     PyObject *t;
-
-    char *str;
-    PyObject *filename;
-    char *startstr;
     int start;
 
-    if (!PyArg_ParseTuple(args, "sO&s:symtable",
-                          &str, PyUnicode_FSDecoder, &filename, &startstr))
-        return NULL;
     if (strcmp(startstr, "exec") == 0)
         start = Py_file_input;
     else if (strcmp(startstr, "eval") == 0)
@@ -42,9 +55,7 @@ symtable_symtable(PyObject *self, PyObje
 }
 
 static PyMethodDef symtable_methods[] = {
-    {"symtable",        symtable_symtable,      METH_VARARGS,
-     PyDoc_STR("Return symbol and scope dictionaries"
-               " used internally by compiler.")},
+    _SYMTABLE_SYMTABLE_METHODDEF
     {NULL,              NULL}           /* sentinel */
 };
 
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to