@@ -0,0 +1,1039 @@
+# Various ways to call object.__new__%0Atry:%0A    # If we don't expose object.__new__ (small ports), there's%0A    # nothing to test.%0A    object.__new__%0Aexcept AttributeError:%0A    print(%22SKIP%22)%0A    raise SystemExit%0A%0A%0Atry:%0A    object.__new__(int)%0Aexcept TypeError:%0A    print(%22TypeError1%22)%0A%0Atry:%0A    object.__new__(int, 1)%0Aexcept TypeError:%0A    print(%22TypeError2%22)%0A%0Ao = object()%0Aprint(type(o))%0A%0Atry:%0A    object(1)%0Aexcept TypeError:%0A    print(%22TypeError3%22)%0A%0Aclass A: pass%0A%0Ao2 = object.__new__(A)%0Aprint(type(o2).__name__)%0A%0Atry:%0A    object.__new__(A, 1)%0Aexcept TypeError:%0A    print(%22TypeError4%22)%0A%0A%0Aclass B:%0A    field = 1%0A%0Ao3 = object.__new__(B)%0Aassert %22field%22 in dir(o3)%0A%0A%0Aclass C:%0A    def __init__(self, a, b):%0A        1/0%0A        print(a, b)%0A%0A# CPython allows this, silently ignores extra params in this case%0A# (i.e. when __init__ is defined).%0A#o4 = object.__new__(C, 1, 2, 3)%0A#print(o4, dir(o4))%0A%0A%0Aclass D:%0A    pass%0A    def __new__(self, a, b):%0A        print(a, b)%0A%0Atry:%0A    o5 = object.__new__(D, 1, 2)%0Aexcept TypeError:%0A    print(%22TypeError5%22)%0A

Test for various ways to call object.__new__().