From 70b3c710107552f752e32e0012b0a72b68dc34ea Mon Sep 17 00:00:00 2001 From: Robert Bradshaw Date: Wed, 11 Jun 2008 20:31:34 -0700 Subject: [PATCH] Fix cpdef, make corrupt c file older than pyx file. --- Cython/Compiler/Symtab.py | 2 +- Cython/Utils.py | 2 +- tests/compile/cpdef.pyx | 6 ++++++ 3 files changed, 8 insertions(+), 2 deletions(-) create mode 100644 tests/compile/cpdef.pyx diff --git a/Cython/Compiler/Symtab.py b/Cython/Compiler/Symtab.py index b74798d2..e80139c1 100644 --- a/Cython/Compiler/Symtab.py +++ b/Cython/Compiler/Symtab.py @@ -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) diff --git a/Cython/Utils.py b/Cython/Utils.py index c7ecf2c4..88550b58 100644 --- a/Cython/Utils.py +++ b/Cython/Utils.py @@ -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 index 00000000..1c3ed528 --- /dev/null +++ b/tests/compile/cpdef.pyx @@ -0,0 +1,6 @@ +cdef class A: + cpdef a(self): + ma(self) + +cpdef ma(x): + print x -- 2.26.2