forked from VimPlug/jedi
reversed builtin for pypy (is not a class), fixes #85
This commit is contained in:
+11
-1
@@ -330,7 +330,17 @@ def _generate_code(scope, mixin_funcs={}, depth=0):
|
|||||||
# the parser only supports basic functions with a newline after
|
# the parser only supports basic functions with a newline after
|
||||||
# the double dots
|
# the double dots
|
||||||
# find doc_str place
|
# find doc_str place
|
||||||
pos = re.search(r'\):\s*\n', mixin).end()
|
try:
|
||||||
|
pos = re.search(r'\):\s*\n', mixin).end()
|
||||||
|
except TypeError:
|
||||||
|
# pypy uses a different reversed builtin
|
||||||
|
if name == 'reversed':
|
||||||
|
mixin = 'def reversed(sequence):\n' \
|
||||||
|
' for i in self.__sequence: yield i'
|
||||||
|
pos = 24
|
||||||
|
else:
|
||||||
|
debug.warning('mixin trouble in pypy: %s', name)
|
||||||
|
raise
|
||||||
if pos is None:
|
if pos is None:
|
||||||
raise Exception("Builtin function not parsed correctly")
|
raise Exception("Builtin function not parsed correctly")
|
||||||
code += mixin[:pos] + doc_str + mixin[pos:]
|
code += mixin[:pos] + doc_str + mixin[pos:]
|
||||||
|
|||||||
Reference in New Issue
Block a user