[issue26549] co_stacksize is calculated from unoptimized code

2017-12-14 Thread STINNER Victor
STINNER Victor added the comment: > Seems moving constant folding to the AST level (issue29469) have solved this > issue. Wow, it's cool to see this bug finally fixed! -- ___ Python tracker

[issue26549] co_stacksize is calculated from unoptimized code

2017-12-14 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Seems moving constant folding to the AST level (issue29469) have solved this issue. >>> def foo(): ... a = (1,2,3,4,5,6,7,8,9,10) ... >>> foo.__code__.co_stacksize 1 -- resolution: -> out of date stage: -> resolved status: open -> closed supe

[issue26549] co_stacksize is calculated from unoptimized code

2017-07-22 Thread Antoine Pitrou
Changes by Antoine Pitrou : -- nosy: +haypo, serhiy.storchaka ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: h

[issue26549] co_stacksize is calculated from unoptimized code

2016-05-18 Thread STINNER Victor
Changes by STINNER Victor : -- type: -> performance ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://ma

[issue26549] co_stacksize is calculated from unoptimized code

2016-05-16 Thread Meador Inge
Meador Inge added the comment: See also issue24340 -- ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://m

[issue26549] co_stacksize is calculated from unoptimized code

2016-05-09 Thread Meador Inge
Meador Inge added the comment: Strictly speaking, the stack size is calculated *after* the peephole optimizer is run, but the code that computes the stack depth operates on the basic block graph instead of the assembled and optimized byte code. Anyway, the conclusion is the same as Brett noted

[issue26549] co_stacksize is calculated from unoptimized code

2016-04-23 Thread Jelle Zijlstra
Jelle Zijlstra added the comment: This also affects co_consts, which includes constants that are no longer used by the optimized code: In [8]: def f(): return (1, 2, 3, 4, 5) ...: In [9]: f.func_code.co_consts Out[9]: (None, 1, 2, 3, 4, 5, (1, 2, 3, 4, 5)) In [12]: dis.dis(f) 2

[issue26549] co_stacksize is calculated from unoptimized code

2016-03-13 Thread Brett Cannon
Brett Cannon added the comment: I also suspect you're right, Antti, that the stack size is calculated prior to the bytecode being passed to through the peepholer which would have made the built tuple a value in the const array. Off the top of my head I don't remember where the stack size calcu

[issue26549] co_stacksize is calculated from unoptimized code

2016-03-13 Thread SilentGhost
Changes by SilentGhost : -- nosy: +benjamin.peterson, brett.cannon, georg.brandl, ncoghlan, yselivanov ___ Python tracker ___ ___ Pyth

[issue26549] co_stacksize is calculated from unoptimized code

2016-03-12 Thread Antti Haapala
New submission from Antti Haapala: When answering a question on StackOverflow, I noticed that a function that only loads a constant tuple to a local variable still has a large `co_stacksize` as if it was built with BUILD_TUPLE. e.g. >>> def foo(): ... a = (1,2,3,4,5,6,7,8,9,10)