Bug 620023 - python-peak-util-assembler appears to use JUMP_IF_FALSE - needs porting to python 2.7
Summary: python-peak-util-assembler appears to use JUMP_IF_FALSE - needs porting to py...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: python-peak-util-assembler
Version: 14
Hardware: All
OS: Linux
low
medium
Target Milestone: ---
Assignee: Luke Macken
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks: Python27Rebuild 620019
TreeView+ depends on / blocked
 
Reported: 2010-07-31 12:58 UTC by Dave Malcolm
Modified: 2016-09-20 02:41 UTC (History)
3 users (show)

Fixed In Version: python-peak-util-assembler-0.6-2.20100803svn2646.fc14
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2010-08-05 14:27:30 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)
Log of selftest failures against python 2.7 (54.28 KB, text/plain)
2010-07-31 13:26 UTC, Dave Malcolm
no flags Details
Initial attempt at a patch; doesn't work yet. (2.40 KB, patch)
2010-07-31 14:16 UTC, Dave Malcolm
no flags Details | Diff

Description Dave Malcolm 2010-07-31 12:58:04 UTC
See bug 620019: python-peak-rules fails in its selftest suite on Python 2.7, with:

  File "/usr/lib/python2.7/site-packages/peak/util/assembler.py", line 221, in
TryExcept
    next_test.JUMP_IF_FALSE, Code.POP_TOP,      # remove condition
AttributeError: 'Label' object has no attribute 'JUMP_IF_FALSE'

http://koji.fedoraproject.org/koji/getfile?taskID=2368743&name=build.log

JUMP_IF_FALSE was removed in 2.7:
http://svn.python.org/view?view=rev&revision=70071    

Looks like BytecodeAssembler needs fixing up to reflect these bytecode changes.

It appears that we do run the selftests in python-peak-util-assembler.spec:
%check
nosetests

so it's a bit disturbing that this rebuilt successfully against 2.7:
http://kojipkgs.fedoraproject.org/packages/python-peak-util-assembler/0.5.1/2.fc14/data/logs/noarch/build.log

+ nosetests
.
----------------------------------------------------------------------
Ran 1 test in 0.036s
OK

Comment 1 Dave Malcolm 2010-07-31 13:03:12 UTC
(In reply to comment #0)

> It appears that we do run the selftests in python-peak-util-assembler.spec:
> %check
> nosetests
> 
> so it's a bit disturbing that this rebuilt successfully against 2.7:
> http://kojipkgs.fedoraproject.org/packages/python-peak-util-assembler/0.5.1/2.fc14/data/logs/noarch/build.log
> 
> + nosetests
> .
> ----------------------------------------------------------------------
> Ran 1 test in 0.036s
> OK    


BytecodeAssembler-0.5.1/test_assembler.py has:
def additional_tests():
    import doctest
    return doctest.DocFileSuite(
        'README.txt',
        optionflags=doctest.ELLIPSIS|doctest.NORMALIZE_WHITESPACE,
    )

and README.txt has doctests for Try/Except, which do include JUMP_IF_FALSE.

Are the doctests really getting run in our builds?

Comment 2 Dave Malcolm 2010-07-31 13:22:36 UTC
Running
  nosetests
"passes", but it looks like the tests aren't run:
.
----------------------------------------------------------------------
Ran 1 test in 0.034s

OK

Running:
  python setup.py test
fails with numerous errors from inside README.txt; will attach

Comment 3 Dave Malcolm 2010-07-31 13:26:06 UTC
Created attachment 435753 [details]
Log of selftest failures against python 2.7

Comment 4 Dave Malcolm 2010-07-31 14:16:39 UTC
Created attachment 435757 [details]
Initial attempt at a patch; doesn't work yet.

Unfortunately the doctests contain lots of embedded assumptions about Python bytecode.

I'm attaching an attempt at a patch for the higher-level API, which is what I believe peak-rules is using.

This doesn't work yet, I get exceptions in the stack-depth checking.  Looks like this needs to be reworked to cope with the stack-effect of a bytecode varying based on whether or not a conditional branch is followed, which is the case for
JUMP_IF_TRUE_OR_POP and JUMP_IF_FALSE_OR_POP
(see http://svn.python.org/view/python/trunk/Doc/library/dis.rst?r1=70071&r2=70070&pathrev=70071 )

Comment 5 Toshio Ernie Kuratomi 2010-08-02 15:36:14 UTC
I email pje/peak mailing list about this and he's made a few workarounds and a new release:
http://pypi.python.org/pypi/BytecodeAssembler/0.5.2

There's a few test failures but they're only supposed to be false positives.  Explanation here:

http://www.eby-sarna.com/pipermail/peak/2010-August/003375.html

Comment 6 Dave Malcolm 2010-08-02 16:12:48 UTC
Note that 0.5.2 has a license change:

diff of PKG-INFO:
-License: PSF or ZPL
+License: http://www.apache.org/licenses/LICENSE-2.0

Comment 7 Fedora Update System 2010-08-03 12:45:42 UTC
python-peak-util-assembler-0.6-2.20100803svn2646.fc14 has been submitted as an update for Fedora 14.
http://admin.fedoraproject.org/updates/python-peak-util-assembler-0.6-2.20100803svn2646.fc14

Comment 8 Fedora Update System 2010-08-05 14:27:26 UTC
python-peak-util-assembler-0.6-2.20100803svn2646.fc14 has been pushed to the Fedora 14 stable repository.  If problems still persist, please make note of it in this bug report.


Note You need to log in before you can comment on or make changes to this bug.