From 7c0ea3b0fecaff29e0cb5d32c3612e0a46afccf1 Mon Sep 17 00:00:00 2001 From: Robert Bradshaw Date: Sat, 16 Aug 2008 04:25:51 -0700 Subject: [PATCH] Fix public extensions declared in pxd files. --- Cython/Compiler/Nodes.py | 9 --------- tests/run/extmember.pyx | 16 +++++++++++++++- 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/Cython/Compiler/Nodes.py b/Cython/Compiler/Nodes.py index d1a418c9..a67dffa5 100644 --- a/Cython/Compiler/Nodes.py +++ b/Cython/Compiler/Nodes.py @@ -2151,15 +2151,6 @@ class CClassDefNode(ClassDefNode): if self.doc and Options.docstrings: scope.doc = embed_position(self.pos, self.doc) - if has_body and not self.in_pxd: - # transforms not yet run on pxd files - from ParseTreeTransforms import AnalyseDeclarationsTransform - transform = AnalyseDeclarationsTransform(None) - for entry in scope.var_entries: - if hasattr(entry, 'needs_property'): - property = transform.create_Property(entry) - self.body.stats.append(property) - if has_body: self.body.analyse_declarations(scope) if self.in_pxd: diff --git a/tests/run/extmember.pyx b/tests/run/extmember.pyx index 86faeed5..c1b958a6 100644 --- a/tests/run/extmember.pyx +++ b/tests/run/extmember.pyx @@ -7,7 +7,21 @@ __doc__ = """ >>> s.e is s True >>> s.e = None + + >>> s = Bot() + >>> s.e = s + >>> s.e = 1 + Traceback (most recent call last): + TypeError: Cannot convert int to extmember.Bot + >>> s.e is s + True + >>> s.e = None """ +# declared in the pxd cdef class Spam: - cdef public Spam e + pass + +# not declared in the pxd +cdef class Bot: + cdef public Bot e -- 2.26.2