From: Stefan Behnel Date: Sun, 30 May 2010 17:42:15 +0000 (+0200) Subject: disable tuple(genexpr) as it has a non-obvious negative effect on memory usage -... X-Git-Tag: 0.13.beta0~2^2~28 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=90f8c7762ca8ebbf743b1eac45cbef8b9c2b46ee;p=cython.git disable tuple(genexpr) as it has a non-obvious negative effect on memory usage - better let users write tuple([...]) explicitly --- diff --git a/Cython/Compiler/Optimize.py b/Cython/Compiler/Optimize.py index 8ab5f8e3..1e736fad 100644 --- a/Cython/Compiler/Optimize.py +++ b/Cython/Compiler/Optimize.py @@ -1186,7 +1186,7 @@ class EarlyReplaceBuiltinCalls(Visitor.EnvTransform): gen_expr_node.pos, loop = exec_code, result_node = result_ref, expr_scope = gen_expr_node.expr_scope, orig_func = 'sum') - def _handle_simple_function_tuple(self, node, pos_args): + def _DISABLED_handle_simple_function_tuple(self, node, pos_args): if len(pos_args) == 0: return ExprNodes.TupleNode(node.pos, args=[], constant_result=()) # This is a bit special - for iterables (including genexps), diff --git a/tests/run/inlined_generator_expressions.pyx b/tests/run/inlined_generator_expressions.pyx index 4685c3e2..eee9a9bc 100644 --- a/tests/run/inlined_generator_expressions.pyx +++ b/tests/run/inlined_generator_expressions.pyx @@ -1,12 +1,12 @@ cimport cython -def range_tuple_genexp(int N): - """ - >>> range_tuple_genexp(5) - (0, 1, 2, 3, 4) - """ - return tuple(i for i in range(N)) +## def range_tuple_genexp(int N): +## """ +## >>> range_tuple_genexp(5) +## (0, 1, 2, 3, 4) +## """ +## return tuple(i for i in range(N)) @cython.test_assert_path_exists('//ForFromStatNode',