[issue15251] new.code and new.function crashes Python iterpretter

2012-07-04 Thread Jeffrey Harper
Jeffrey Harper added the comment: Martin, Thanks for your response. I didn't know it was possible to pass freevars and cellvars to new.code. I think the documentation needs to be updated. The documentation for 2.7.3 located at http://docs.python.org/library/new.html?highligh

[issue15251] new.code and new.function crashes Python iterpretter

2012-07-04 Thread Jeffrey Harper
Jeffrey Harper added the comment: The marshal loads and dumps don't seem to be necessary to reproduce the crash. On both the Windows Vista and Ubuntu Linux systems, the crash still occurred when I replaced: mcopy_code = loads(dumps(code)) with: mcopy_code = code #loads(dumps

[issue15251] new.code and new.function crashes Python iterpretter

2012-07-04 Thread Jeffrey Harper
New submission from Jeffrey Harper : I've attached a script that crashes the Python interpreter. I can get the crash to occur under Windows Vista with this version of Python: C:\tmp\remote>c:\Python27\python.exe Python 2.7.1 Stackless 3.1b3 060516 (release27-maint, Jan 1 2011,

[issue11244] Negative tuple elements produce inefficient code.

2011-02-18 Thread Jeffrey Harper
Jeffrey Harper added the comment: Here's a patch against the version of test_peepholer.py in 3.2rc3. It verifies that expressions like the following are optimized: 3*-4 (1,-2,3) a in {1,-2,3) -- keywords: +patch Added file: http://bugs.python.org/file20787/test_peepholer.

[issue11244] Negative tuple elements produce inefficient code.

2011-02-18 Thread Jeffrey Harper
Jeffrey Harper added the comment: I think r82043 may also explain why 3.1.3 can fold the expression 2 * -3 into -6 while 3.2rc3 cannot. # test.py from dis import dis def y(): 2 * -3 print("dis y:") dis(y) C:\tmp>c:\Python32\python.exe --version Python 3.2rc3 C:\tm

[issue11244] Negative tuple elements produce inefficient code.

2011-02-18 Thread Jeffrey Harper
Jeffrey Harper added the comment: I have also determined that negative elements interfere with the frozenset optimization described in issue6690. http://bugs.python.org/issue6690. Here's an example program: # test.py from dis import dis def x(var): return var in {1,2,3} # Note curly b

[issue11244] Negative tuple elements produce inefficient code.

2011-02-18 Thread Jeffrey Harper
New submission from Jeffrey Harper : In Python 3.2, a tuple like (1,-2,3) will not be optimized into a constants at compile time. The tuple is built at run-time. Earlier versions of Python optimized these tuples at compile time. Here's an example program. # test.py from dis import dis

[issue11099] Bytes pickled with 3.1 not unpickled with 2.7 correctly

2011-02-02 Thread Jeffrey Harper
New submission from Jeffrey Harper : When a bytes object is pickled with 3.1 and then unpickled with 2.7, the results are incorrect. The example below shows that pickling b'abcdefg' in 3.1 and then unpickling in 2.7 produces the string '[97L, 98L, 99L, 100L, 101L, 102L, 103L]&#