[New-bugs-announce] [issue42291] Incorrect signature of CodeType.replace()

Serhiy Storchaka report at bugs.python.org
Sun Nov 8 05:38:14 EST 2020


New submission from Serhiy Storchaka <storchaka+cpython at gmail.com>:

Currently the signature of types.CodeType.replace() is

replace(self, /, *, co_argcount=-1, co_posonlyargcount=-1, co_kwonlyargcount=-1, co_nlocals=-1, co_stacksize=-1, co_flags=-1, co_firstlineno=-1, co_code=None, co_consts=None, co_names=None, co_varnames=None, co_freevars=None, co_cellvars=None, co_filename=None, co_name=None, co_lnotab=None)

But -1 and None are incorrect values for many parameters, and even if they would be correct, they are not default values. By default, if you do not specify some argument, the value of the corresponding attribute would not be changed.

Argument Clinic and the inspect module do not support this case.

----------
components: Argument Clinic, Library (Lib)
messages: 380545
nosy: larry, serhiy.storchaka, vstinner, yselivanov
priority: normal
severity: normal
status: open
title: Incorrect signature of CodeType.replace()
type: behavior
versions: Python 3.10, Python 3.8, Python 3.9

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue42291>
_______________________________________


More information about the New-bugs-announce mailing list