Skip to content

Mocking __new__ breaks subsequent object creation #8009

Closed Answered by ymyke
ymyke asked this question in General
Discussion options

You must be logged in to vote

BTW, it works if I change the class definition to this:

class A(object):
    def __new__(cls, *_, **__):
        return super(A, cls).__new__(cls)

    def __init__(self, x):
        self.x = x

Replies: 6 comments 3 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
2 replies
@mleiter06
Comment options

@ViaFlorian
Comment options

Answer selected by RonnyPfannschmidt
Comment options

You must be logged in to vote
1 reply
@crispyam
Comment options

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
7 participants
Converted from issue

This discussion was converted from issue #8009 on November 08, 2020 14:40.