Bug 620023 - python-peak-util-assembler appears to use JUMP_IF_FALSE - needs porting to python 2.7
python-peak-util-assembler appears to use JUMP_IF_FALSE - needs porting to py...
Status: CLOSED ERRATA
Product: Fedora
Classification: Fedora
Component: python-peak-util-assembler (Show other bugs)
14
All Linux
low Severity medium
: ---
: ---
Assigned To: Luke Macken
Fedora Extras Quality Assurance
:
Depends On:
Blocks: Python27Rebuild 620019
  Show dependency treegraph
 
Reported: 2010-07-31 08:58 EDT by Dave Malcolm
Modified: 2016-09-19 22:41 EDT (History)
3 users (show)

See Also:
Fixed In Version: python-peak-util-assembler-0.6-2.20100803svn2646.fc14
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2010-08-05 10:27:30 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


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

  None (edit)
Description Dave Malcolm 2010-07-31 08:58:04 EDT
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 09:03:12 EDT
(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 09:22:36 EDT
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 09:26:06 EDT
Created attachment 435753 [details]
Log of selftest failures against python 2.7
Comment 4 Dave Malcolm 2010-07-31 10:16:39 EDT
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 11:36:14 EDT
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 12:12:48 EDT
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 08:45:42 EDT
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 10:27:26 EDT
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.