Fix cpdef, make corrupt c file older than pyx file.
authorRobert Bradshaw <robertwb@math.washington.edu>
Thu, 12 Jun 2008 03:31:34 +0000 (20:31 -0700)
committerRobert Bradshaw <robertwb@math.washington.edu>
Thu, 12 Jun 2008 03:31:34 +0000 (20:31 -0700)
Cython/Compiler/Symtab.py
Cython/Utils.py
tests/compile/cpdef.pyx [new file with mode: 0644]

index b74798d2d1ce6e6a98b87085523413a173875f10..e80139c197d4e9d3b5339793d11ccb21b03a7cee 100644 (file)
@@ -375,7 +375,7 @@ class Scope:
     def declare_pyfunction(self, name, pos):
         # Add an entry for a Python function.
         entry = self.lookup_here(name)
-        if entry:
+        if entry and not entry.type.is_cfunction:
             # This is legal Python, but for now will produce invalid C.
             error(pos, "'%s' already declared" % name)
         entry = self.declare_var(name, py_object_type, pos)
index c7ecf2c469a608ee99306ff23fa539529bc09e33..88550b587decd9b03fe27866f9c43138abadcaa6 100644 (file)
@@ -30,7 +30,7 @@ def castrate_file(path, st):
             "#error Do not use this file, it is the result of a failed Cython compilation.\n")
         f.close()
         if st:
-            os.utime(path, (st.st_atime, st.st_mtime))
+            os.utime(path, (st.st_atime, st.st_mtime-1))
 
 def modification_time(path):
     st = os.stat(path)
diff --git a/tests/compile/cpdef.pyx b/tests/compile/cpdef.pyx
new file mode 100644 (file)
index 0000000..1c3ed52
--- /dev/null
@@ -0,0 +1,6 @@
+cdef class A:
+    cpdef a(self):
+        ma(self)
+
+cpdef ma(x):
+    print x