Closed MatthiasKohl closed 5 years ago
This bug comes from function wrapped_cls
in ClassicAdapter.__call__
I'm not sure if the underlying problem comes from this library, so I'm not sure if this is really the best place to report this bug. On my system at least, I found a weird issue, where if you use a function like this:
def new_constructor(cls, *args, **kwargs):
print(cls)
print(args)
print(kwargs)
SomeClass.__new__ = classmethod(new_constructor)
It seems to call the new_constructor
with the class argument twice (in cls
and args[0]
). But doing this:
def new_constructor(*args, **kwargs):
print(cls)
print(args)
print(kwargs)
SomeClass.__new__ = classmethod(new_constructor)
works as expected.
No idea why, this looks very strange... possibly an obscure issue with my system (?)
I ended up working around this problem by using deprecated on the __init__
function only. Not sure what the underlying issue is, though.
I need to investigate this issue further.
This exception is raised when some parameters in passed to __init__
(in addition to self
).
Here is a demonstration of the problem:
class Something(object):
def __new__(cls, *args, **kwargs):
return super(Something, cls).__new__(cls, *args, **kwargs)
def __init__(self, a=5):
self.a = a
Something(5)
You get:
Traceback (most recent call last):
...
TypeError: object() takes no parameters
Because object.__new__
has no extra parameters.
Expected Behavior
No exception, returns class as expected.
Actual Behavior
Not complete traceback but most important part:
Environment