[New-bugs-announce] [issue44985] Inconsistent returned value of inspect.getfullargspec(object.__init__).

Mehrzad report at bugs.python.org
Mon Aug 23 12:06:48 EDT 2021


New submission from Mehrzad <mehrzad.saremi at aut.ac.ir>:

The inspection `inspect.getfullargspec(object.__init__)` shows that `object.__init__` takes both varargs (starred) and varkw (double-starred) arguments.* However, it is impossible to call `object.__init__` with varargs or varkw arguments.

If one tries to call `object.__init__(SomeClass(), ...)` with either of those arguments, the following error is raised:

`TypeError: SomeClass.__init__() takes exactly one argument (the instance to initialize)`.

This error is not raised if `SomeClass()` is replaced with some literal, e.g. a number.



* I can not certify whether it is intended behavior or a bug, because the signature of `obj.__init__` takes those arguments.

----------
components: Distutils, Interpreter Core, Parser
files: object_init.py
messages: 400144
nosy: Mehrzad, dstufft, eric.araujo, lys.nikolaou, pablogsal
priority: normal
severity: normal
status: open
title: Inconsistent returned value of inspect.getfullargspec(object.__init__).
type: behavior
versions: Python 3.7
Added file: https://bugs.python.org/file50229/object_init.py

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


More information about the New-bugs-announce mailing list