summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Behnel <stefan_ml@behnel.de>2015-02-22 13:32:44 +0100
committerStefan Behnel <stefan_ml@behnel.de>2015-02-22 13:32:44 +0100
commita94ca7023cd031019bde9c82e1ee51d6fcde181e (patch)
tree12d7fc5004320c74065e0f59f220aea27281b974
parenta74bdd5a79c57754542abed8a39b0a9cc75329ff (diff)
downloadcython-a94ca7023cd031019bde9c82e1ee51d6fcde181e.tar.gz
fix compilation in pypy3 when special methods are inherited that are no longer available in Py3
--HG-- extra : transplant_source : 5%FC%EB%8D%0D%CC%F1%7C%CC%909%A9%0C%1C%C2%94Nx%E0m
-rw-r--r--Cython/Compiler/TypeSlots.py14
1 files changed, 9 insertions, 5 deletions
diff --git a/Cython/Compiler/TypeSlots.py b/Cython/Compiler/TypeSlots.py
index f9eb6bb1c..6efaf5daa 100644
--- a/Cython/Compiler/TypeSlots.py
+++ b/Cython/Compiler/TypeSlots.py
@@ -194,6 +194,10 @@ class SlotDescriptor(object):
return guard
def generate(self, scope, code):
+ preprocessor_guard = self.preprocessor_guard_code()
+ if preprocessor_guard:
+ code.putln(preprocessor_guard)
+
end_pypy_guard = False
if self.is_initialised_dynamically:
value = "0"
@@ -217,17 +221,17 @@ class SlotDescriptor(object):
code.putln("%s, /*%s*/" % (inherited_value, self.slot_name))
code.putln("#else")
end_pypy_guard = True
- preprocessor_guard = self.preprocessor_guard_code()
- if preprocessor_guard:
- code.putln(preprocessor_guard)
+
code.putln("%s, /*%s*/" % (value, self.slot_name))
+
+ if end_pypy_guard:
+ code.putln("#endif")
+
if self.py3 == '<RESERVED>':
code.putln("#else")
code.putln("0, /*reserved*/")
if preprocessor_guard:
code.putln("#endif")
- if end_pypy_guard:
- code.putln("#endif")
# Some C implementations have trouble statically
# initialising a global with a pointer to an extern