.. versionadded:: 3.6
-.. data:: CodeType
+.. class:: CodeType(**kwargs)
.. index:: builtin: compile
Note that the audited arguments may not match the names or positions
required by the initializer.
+ .. method:: CodeType.replace(**kwargs)
+
+ Return a copy of the code object with new values for the specified fields.
+
+ .. versionadded:: 3.8
+
.. data:: CellType
The type for cell objects: such objects are used as containers for
" co_lnotab=None)\n"
"--\n"
"\n"
-"Return a new code object with new specified fields.");
+"Return a copy of the code object with new values for the specified fields.");
#define CODE_REPLACE_METHODDEF \
{"replace", (PyCFunction)(void(*)(void))code_replace, METH_FASTCALL|METH_KEYWORDS, code_replace__doc__},
exit:
return return_value;
}
-/*[clinic end generated code: output=fade581d6313a0c2 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=27fe34e82106b220 input=a9049054013a1b77]*/
co_name: unicode(c_default="self->co_name") = None
co_lnotab: PyBytesObject(c_default="(PyBytesObject *)self->co_lnotab") = None
-Return a new code object with new specified fields.
+Return a copy of the code object with new values for the specified fields.
[clinic start generated code]*/
static PyObject *
PyObject *co_varnames, PyObject *co_freevars,
PyObject *co_cellvars, PyObject *co_filename,
PyObject *co_name, PyBytesObject *co_lnotab)
-/*[clinic end generated code: output=25c8e303913bcace input=77189e46579ec426]*/
+/*[clinic end generated code: output=25c8e303913bcace input=d9051bc8f24e6b28]*/
{
#define CHECK_INT_ARG(ARG) \
if (ARG < 0) { \