disable compile time error in favour of a runtime error as it might be too strict...
authorStefan Behnel <scoder@users.berlios.de>
Sun, 1 Nov 2009 14:16:58 +0000 (15:16 +0100)
committerStefan Behnel <scoder@users.berlios.de>
Sun, 1 Nov 2009 14:16:58 +0000 (15:16 +0100)
Cython/Compiler/Optimize.py
tests/errors/tp_new_errors.pyx [deleted file]

index 53ab9fa33cb8cfd3c5fd48641dcfe4fa5737435e..853bde141e0e040c007b1a6772fdabfa08f29cc7 100644 (file)
@@ -1062,10 +1062,7 @@ class OptimizeBuiltinCalls(Visitor.EnvTransform):
             # otherwise, we know it's a type and we know it's the same
             # type for both - that should do
         elif type_arg.type_entry != obj.type_entry:
-            # different types - do what CPython does at runtime
-            error(type_arg.pos, "%s.__new__(%s) is not safe, use %s.__new__()" %
-                  (obj.type_entry.name, type_arg.type_entry.name,
-                   type_arg.type_entry.name))
+            # different types - may or may not lead to an error at runtime
             return node
 
         # FIXME: we could potentially look up the actual tp_new C method
diff --git a/tests/errors/tp_new_errors.pyx b/tests/errors/tp_new_errors.pyx
deleted file mode 100644 (file)
index 05b5615..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-
-cdef class MyType:
-    def __init__(self):
-        print "INIT"
-
-cdef class MySubType(MyType):
-    def __init__(self):
-        print "INIT"
-
-cdef class MyOtherType:
-    def __init__(self):
-        print "INIT"
-
-def make_new():
-    m = MyType.__new__(MyType)
-    m = MyOtherType.__new__(MyOtherType)
-    return m
-
-def make_new_error():
-    m = MySubType.__new__(MyType)
-    m = MyOtherType.__new__(MyType)
-    m = MyOtherType.__new__(MySubType)
-    return m
-
-_ERRORS = """
-20:32: MySubType.__new__(MyType) is not safe, use MyType.__new__()
-21:34: MyOtherType.__new__(MyType) is not safe, use MyType.__new__()
-22:37: MyOtherType.__new__(MySubType) is not safe, use MySubType.__new__()
-"""