Nepenthes Development Team, 08.04.2010 15:51:
File "/usr/local/lib/python2.6/dist-packages/Cython/Compiler/Optimize.py",
line 910, in visit_SimpleCallNode
node, function, args)
File "/usr/local/lib/python2.6/dist-packages/Cython/Compiler/Optimize.py",
line 1033, in _dispatch_to_handler
return method_handler(node, arg_list, is_unbound_method)
File "/usr/local/lib/python2.6/dist-packages/Cython/Compiler/Optimize.py",
line 1481, in _handle_simple_method_bytes_decode
parameters = self._unpack_encoding_and_error_mode(node.pos, args)
File "/usr/local/lib/python2.6/dist-packages/Cython/Compiler/Optimize.py",
line 1524, in _unpack_encoding_and_error_mode
encoding_node = args[1]
IndexError: list index out of range
Hmm, my bad, I guess. I assume you do "some_byte_string.decode()"
somewhere, without arguments? The behaviour of that is platform dependant,
you should use an explicit encoding instead
That being said, the crash is a bug in Cython. Could you try the attached
patch?
Stefan
diff -r d9a3831ec027 Cython/Compiler/Optimize.py
--- a/Cython/Compiler/Optimize.py Tue Apr 06 16:40:12 2010 +0200
+++ b/Cython/Compiler/Optimize.py Thu Apr 08 18:11:47 2010 +0200
@@ -1944,20 +1944,25 @@
return None
def _unpack_encoding_and_error_mode(self, pos, args):
- encoding_node = args[1]
- if isinstance(encoding_node, ExprNodes.CoerceToPyTypeNode):
- encoding_node = encoding_node.arg
- if isinstance(encoding_node, (ExprNodes.UnicodeNode, ExprNodes.StringNode,
- ExprNodes.BytesNode)):
- encoding = encoding_node.value
- encoding_node = ExprNodes.BytesNode(encoding_node.pos, value=encoding,
- type=PyrexTypes.c_char_ptr_type)
- elif encoding_node.type.is_string:
+ null_node = ExprNodes.NullNode(pos)
+
+ if len(args) >= 2:
+ encoding_node = args[1]
+ if isinstance(encoding_node, ExprNodes.CoerceToPyTypeNode):
+ encoding_node = encoding_node.arg
+ if isinstance(encoding_node, (ExprNodes.UnicodeNode, ExprNodes.StringNode,
+ ExprNodes.BytesNode)):
+ encoding = encoding_node.value
+ encoding_node = ExprNodes.BytesNode(encoding_node.pos, value=encoding,
+ type=PyrexTypes.c_char_ptr_type)
+ elif encoding_node.type.is_string:
+ encoding = None
+ else:
+ return None
+ else:
encoding = None
- else:
- return None
+ encoding_node = null_node
- null_node = ExprNodes.NullNode(pos)
if len(args) == 3:
error_handling_node = args[2]
if isinstance(error_handling_node, ExprNodes.CoerceToPyTypeNode):
_______________________________________________
Cython-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/cython-dev