Commit a94ca702 authored by Stefan Behnel's avatar Stefan Behnel

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
parent a74bdd5a
...@@ -194,6 +194,10 @@ class SlotDescriptor(object): ...@@ -194,6 +194,10 @@ class SlotDescriptor(object):
return guard return guard
def generate(self, scope, code): def generate(self, scope, code):
preprocessor_guard = self.preprocessor_guard_code()
if preprocessor_guard:
code.putln(preprocessor_guard)
end_pypy_guard = False end_pypy_guard = False
if self.is_initialised_dynamically: if self.is_initialised_dynamically:
value = "0" value = "0"
...@@ -217,17 +221,17 @@ class SlotDescriptor(object): ...@@ -217,17 +221,17 @@ class SlotDescriptor(object):
code.putln("%s, /*%s*/" % (inherited_value, self.slot_name)) code.putln("%s, /*%s*/" % (inherited_value, self.slot_name))
code.putln("#else") code.putln("#else")
end_pypy_guard = True 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)) code.putln("%s, /*%s*/" % (value, self.slot_name))
if end_pypy_guard:
code.putln("#endif")
if self.py3 == '<RESERVED>': if self.py3 == '<RESERVED>':
code.putln("#else") code.putln("#else")
code.putln("0, /*reserved*/") code.putln("0, /*reserved*/")
if preprocessor_guard: if preprocessor_guard:
code.putln("#endif") code.putln("#endif")
if end_pypy_guard:
code.putln("#endif")
# Some C implementations have trouble statically # Some C implementations have trouble statically
# initialising a global with a pointer to an extern # initialising a global with a pointer to an extern
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment