Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 146868

Summary: jythonc -2.1 uses reserved assert function from Java
Product: Gentoo Linux Reporter: Joel <joel_123>
Component: New packagesAssignee: Java team <java>
Status: RESOLVED FIXED    
Severity: normal    
Priority: High    
Version: 2006.1   
Hardware: All   
OS: Linux   
URL: http://sourceforge.net/tracker/index.php?func=detail&aid=1554945&group_id=12867&atid=112867
Whiteboard:
Package list:
Runtime testing required: ---
Attachments: modified 2.1-assert.patch that fixes the problem

Description Joel 2006-09-08 12:38:35 UTC
Closely related to bug 142099, although this one shows up when jythonc is used to compile jython code rather than in compiling jython itself.  Use of jythonc when code that includes asserts will produce errors of the form:

  as of release 1.4, 'assert' is a keyword, and may not be used as an identifier
(try -source 1.3 or lower to use 'assert' as an identifier)
                                                     ^
A short code that reproduces this problem is:

# more test.py
import thread, threading
print 'hello, world'
thread.exit()
# jythonc --all test.py
processing test
...
Compiling with args: ['/opt/sun-jdk-1.5.0.08/bin/javac', '-classpath', '/usr/share/jython/lib/jython.jar:/usr/share/libreadline-java/lib/libreadline-java.jar:./jpywork::/usr/share/jython/tools/jythonc:/root/novelty/jython/server/.:/usr/share/jython/Lib', './jpywork/random.java', './jpywork/threading.java', './jpywork/sre_parse.java', './jpywork/copy.java', './jpywork/linecache.java', './jpywork/javaos.java', './jpywork/atexit.java', './jpywork/test.java', './jpywork/sre_constants.java', './jpywork/string.java', './jpywork/javapath.java', './jpywork/traceback.java', './jpywork/sre.java', './jpywork/StringIO.java', './jpywork/copy_reg.java', './jpywork/re.java', './jpywork/stat.java', './jpywork/UserDict.java', './jpywork/sre_compile.java', './jpywork/repr.java']
1  ./jpywork/threading.java:561: as of release 1.4, 'assert' is a keyword, and may not be used as an identifier
(try -source 1.3 or lower to use 'assert' as an identifier)
            if (frame.getglobal("__debug__").__nonzero__()) Py.assert(frame.getlocal(0).__getattr__("__RLock__owner")._is(frame.getlocal(2)), s$8);
                                                               ^
./jpywork/threading.java:705: as of release 1.4, 'assert' is a keyword, and may not be used as an identifier
(try -source 1.3 or lower to use 'assert' as an identifier)
            if (frame.getglobal("__debug__").__nonzero__()) Py


The fix is by renaming assert to assert_ in SimpleCompiler.py.  I have submitted the patch upstream.
Comment 1 Joel 2006-09-08 12:41:11 UTC
Created attachment 96431 [details, diff]
modified 2.1-assert.patch that fixes the problem

Fix to SimpleCompiler.py included with previous fixes of the same type.
Comment 2 Petteri Räty (RETIRED) gentoo-dev 2006-09-09 02:02:32 UTC
(In reply to comment #0)
> 
> 
> The fix is by renaming assert to assert_ in SimpleCompiler.py.  I have
> submitted the patch upstream.
> 

Please include the url for your upstream bug report in the bug report and put it in the URL field or if you used the mailing list mention that. This helps people to find the upstream bug report if they want to check what is the status in the upstream sources.
Comment 3 Joel 2006-09-09 14:14:49 UTC
Upstream report to mailing list is now in the URL.
Comment 4 Petteri Räty (RETIRED) gentoo-dev 2006-09-09 14:44:17 UTC
Patch applied. Thanks for the fix.