From: Vitja Makarov Date: Sat, 13 Nov 2010 17:39:14 +0000 (+0300) Subject: Add testcase for ticket #593 X-Git-Tag: 0.14.1rc0~39 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=ac511d83692939cbce0637b8f1bd301138f80c7e;p=cython.git Add testcase for ticket #593 --- diff --git a/tests/bugs.txt b/tests/bugs.txt index 5f0b8715..c97798ef 100644 --- a/tests/bugs.txt +++ b/tests/bugs.txt @@ -18,6 +18,7 @@ ipow_crash_T562 pure_mode_cmethod_inheritance_T583 genexpr_iterable_lookup_T600 for_from_pyvar_loop_T601 +decorators_T593 # CPython regression tests that don't current work: pyregr.test_threadsignals diff --git a/tests/run/decorators_T593.pyx b/tests/run/decorators_T593.pyx new file mode 100644 index 00000000..39edde60 --- /dev/null +++ b/tests/run/decorators_T593.pyx @@ -0,0 +1,48 @@ +""" +>>> am_i_buggy +False +>>> Foo +False +""" +def testme(func): + try: + am_i_buggy + return True + except NameError: + return False +@testme +def am_i_buggy(): + pass + +def testclass(klass): + try: + Foo + return True + except NameError: + return False +@testclass +class Foo: + pass + +class ODict(dict): + def __init__(self): + dict.__init__(self) + self._order = [] + dict.__setitem__(self, '_order', self._order) + def __setitem__(self, key, value): + dict.__setitem__(self, key, value) + self._order.append(key) + +class Base(type): + @staticmethod + def __prepare__(*args, **kwargs): + return ODict() + +class Bar(metaclass=Base): + """ + >>> Bar._order + ['__module__', '__doc__', 'bar'] + """ + @property + def bar(self): + return 0