boblusebob | 19 Jul 10:25

Possible Bugs in Jython 2.5a1 array

Hi,

I have found what I think are two bugs in the Jython 2.5 Alpha code for arrays.  The reason that I am writing here rather than making a bug report is that I am not positive they are bugs since arrays in Jython are a bit complicated (to me anyway).

The first question:

The following runnable short code snippet runs on both Jython and Python (I am running on Windows XP Pro) but gives slightly different results.

-----------------------------------------
import array

a = array.array("c", 'abc123')
print a
print a.tostring()
print


print repr(a.tostring())

for i in a:
    print i,
   
print

-----------------------------------------------

In Python 2.5.2 it prints the following:

    array('c', 'abc123')  # this is where they are different
    abc123

    'abc123'
    a b c 1 2 3

In Jython 2.5a1 it prints:

    array('c',['a', 'b', 'c', '1', '2', '3'])  # this is where they are different
    abc123

    'abc123'
    a b c 1 2 3


Intuitively, the Jython result seems right, an array of char.  But, my understanding of char in Python says that the Jython is wrong.  I think a Python char is 1 or more characters, in other words a string.  the Jython char array is actually several char arrays rather than one char array.


The other problem is unsigned char  -  using a 'B' as the type code.  I receive the following error message in Jython when declaring an array with the 'B' type code ( 'b' - signed char - works ok):


 Traceback (most recent call last):
  File "C:\...\src\charArraysUnsigned.py", line 6, in <module>
    a = array.array("B", 'abc123')
ValueError: typecode must be in [zcbhilfd]

The following very short code snippet should recreate the error in Jython:

---------------------------------
import array

a = array.array("B", 'abc123')

---------------------------------------

I'll open bug reports if someone will confirm that these are bugs and not something that needed to be done to get Java and Python working together.

Thanks,
  Bob

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Jython-dev mailing list
Jython-dev <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jython-dev
Jython tracker | 18 Jul 18:08
Favicon

Summary of Jython tracker Issues


ACTIVITY SUMMARY (07/11/08 - 07/18/08)
Jython tracker at http://bugs.jython.org/

To view or respond to any of the issues listed below, click on the issue 
number.  Do NOT respond to this message.

  223 open (+11) /   878 closed ( +2) /  1101 total (+13)

Open issues with patches:    35

Average duration of open issues: 795 days.
Median duration of open issues: 1238 days.

Open Issues Breakdown
   open   223 (+11)
pending     0 ( +0)

Issues Created Or Reopened (14)
_______________________________

String missing rsplit                                            07/11/08
CLOSED http://bugs.jython.org/issue1023    reopened pjenvey        

jython2.5a startup error                                         07/15/08
CLOSED http://bugs.jython.org/issue1068    created  tonetheman     

setuptools: 'NoneType' object has no attribute 'startswith'      07/16/08
       http://bugs.jython.org/issue1069    created  thijs          

Standalone crashes with ZipException                             07/16/08
       http://bugs.jython.org/issue1070    created  ReneLeonhardt  

strftime uses 2-letter %a and system locale                      07/16/08
       http://bugs.jython.org/issue1071    created  ReneLeonhardt  

Parsing error in file with white space at the end                07/16/08
       http://bugs.jython.org/issue1072    created  fjakobs        

help() in interactive python raises TypeError under Windows      07/16/08
CLOSED http://bugs.jython.org/issue1073    created  gkalab         

support for "signal" and "fcntl" module                          07/16/08
       http://bugs.jython.org/issue1074    created  cheeming       

os.rmdir  deletes file                                           07/17/08
       http://bugs.jython.org/issue1075    created  jnair          

2.5a1 jython.bat doesn't work from Windows explorer              07/17/08
       http://bugs.jython.org/issue1076    created  dergo          

Standalone installation fails                                    07/17/08
       http://bugs.jython.org/issue1077    created  cartman        

Popen3 objects don't have the pid attribute                      07/17/08
       http://bugs.jython.org/issue1078    created  cheeming       

twisted.python.threadable module: missing attribute '_RLock'     07/17/08
       http://bugs.jython.org/issue1079    created  cheeming       

support for annotations?                                         07/17/08
       http://bugs.jython.org/issue1080    created  cprinos        

Issues Now Closed (4)
_____________________

String missing rsplit                                               3 days
       http://bugs.jython.org/issue1023    zyasoft        

Problems with re and unicode                                       39 days
       http://bugs.jython.org/issue1046    zyasoft        

jython2.5a startup error                                            0 days
       http://bugs.jython.org/issue1068    nriley         

help() in interactive python raises TypeError under Windows         0 days
       http://bugs.jython.org/issue1073    nriley         

Top Issues Most Discussed (3)
_____________________________

  3 2.5a1 jython.bat doesn't work from Windows explorer                1 days
open    http://bugs.jython.org/issue1076   

  3 setuptools: 'NoneType' object has no attribute 'startswith'        3 days
open    http://bugs.jython.org/issue1069   

  3 String missing rsplit                                              3 days
closed  http://bugs.jython.org/issue1023   

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Jython-dev mailing list
Jython-dev <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jython-dev
Picon

Re: [Jython-users] Jython in Eclipse Plugin

Baroudi Malek wrote:

Yeah right, obviously, thanks .... just downloaded the sources (ouch).

Anything a bit smaller and easier to get into that pydev ?


SB

<at> +

2008/7/17 Sébastien Boisgérault <Sebastien.Boisgerault <at> ensmp.fr>:

Hi all,

Does anyone have a sample Eclipse plugin that embeds Jython ?
(jython.jar standalone as well as jython scripts). Or at least
pointers or prior experience (good/bad) with this scheme ?

Who knows ;). I am having problems with this ... and I would like
to avoid spending 1000's of hours into Eclipse Plugin docs ...

Cheers,

SB


-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Jython-users mailing list
Jython-users <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jython-users



--
"Qui allume sa bougie à la mienne reçoit de la lumière sans me plonger dans l'obscurité…"
' Thomas Jefferson'

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Jython-dev mailing list
Jython-dev <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jython-dev
Jim Baker | 14 Jul 15:29
Favicon

Re: Jython 2.5 alpha 0

to the list

On Mon, Jul 14, 2008 at 3:29 PM, Jim Baker <jbaker <at> zyasoft.com> wrote:
This looks great. Supporting elementtree (as xml.etree) is a key piece we want to see in Jython 2.5. Rewriting it to using SAX is the right approach. The only challenge I have seen in porting code that uses expat is that xml.sax does not include the error reporting functionality seen in Java's org.xml.sax.ext.LexicalHandler and org.xml.sax.ext.DeclHandler. I would guess this accounts for most of the remaining bugs you have.

Ariane Paola was looking at a similar problem in porting genshi, so it's possible that she has worked through these issues now.

So I hope you will be able to contribute this work as a patch so we can add to Jython. 

- Jim

On Sat, Jul 12, 2008 at 8:46 PM, Sébastien Boisgérault <Sebastien.Boisgerault <at> ensmp.fr> wrote:

Hi all,

I've been testing Jython 2.5 alpha 0 on a port of ElementTree 1.3 alpha 3, slightly
adapted for Jython (expat replaced with SAX essentially). The output of the doctests
run is attached: there are only 7 failures out of 343 tests and at a first glance, there
are minor (error messages not being exactly the same, that kind of thing). The 'stable' jython 2.2.1 had 36 errors and one or two months ago, there was still 14 errors, some
of them being (hard) encoding issues.

Consider this as a testimony of the very impressive progress that has been made
in the development of Jython lately. Congratulations to everyone involved !

Cheers,

SB





**********************************************************************
File "/home/boisgera/SANDBOX/ELEMENTREE-ALPHA-1.3a3-20070912-PREVIEW/elementtree-1.3/selftest.py", line 1050, in selftest.bug_200708_version
Failed example:
   parser.version
Expected:
   'Expat 2.0.0'
Got:
   'J2SE 1.6.0'
**********************************************************************
File "/home/boisgera/SANDBOX/ELEMENTREE-ALPHA-1.3a3-20070912-PREVIEW/elementtree-1.3/selftest.py", line 948, in selftest.bug_xmltoolkit39
Failed example:
   tree.attrib
Expected:
   {u'\xe4ttr': u'v\xe4lue'}
Got:
   {'\xe4ttr': 'v\xe4lue'}
**********************************************************************
File "/home/boisgera/SANDBOX/ELEMENTREE-ALPHA-1.3a3-20070912-PREVIEW/elementtree-1.3/selftest.py", line 1040, in selftest.bug_xmltoolkit55
Failed example:
   e = ElementTree.XML("<!DOCTYPE doc SYSTEM 'doc.dtd'><doc>&ldots;&ndots;&rdots;</doc>")
Expected:
   Traceback (most recent call last):
   ParseError: undefined entity &ldots;: line 1, column 36
Got:
   Traceback (most recent call last):
     File "/usr/local/jython2.5a0/Lib/doctest.py", line 1235, in _DocTestRunner__run
       exec compile(example.source, filename, "single",
     File "<doctest selftest.bug_xmltoolkit55[0]>", line 1, in <module>
       e = ElementTree.XML("<!DOCTYPE doc SYSTEM 'doc.dtd'><doc>&ldots;&ndots;&rdots;</doc>")
     File "/home/boisgera/SANDBOX/ELEMENTREE-ALPHA-1.3a3-20070912-PREVIEW/elementtree-1.3/elementtree/ElementTree.py", line 1226, in XML
       return parser.close()
     File "/home/boisgera/SANDBOX/ELEMENTREE-ALPHA-1.3a3-20070912-PREVIEW/elementtree-1.3/elementtree/JythonHotfix.py", line 159, in close
       self.parse(input_source)
     File "/home/boisgera/SANDBOX/ELEMENTREE-ALPHA-1.3a3-20070912-PREVIEW/elementtree-1.3/elementtree/JythonHotfix.py", line 147, in parse
       self._reader.parse(text)
   java.io.FileNotFoundException: java.io.FileNotFoundException: /home/boisgera/SANDBOX/ELEMENTREE-ALPHA-1.3a3-20070912-PREVIEW/elementtree-1.3/doc.dtd (No such file or directory)
**********************************************************************
File "/home/boisgera/SANDBOX/ELEMENTREE-ALPHA-1.3a3-20070912-PREVIEW/elementtree-1.3/selftest.py", line 535, in selftest.entity
Failed example:
   ElementTree.XML("<document>&entity;</document>")
Expected:
   Traceback (most recent call last):
   ParseError: undefined entity: line 1, column 10
Got:
   Traceback (most recent call last):
     File "/usr/local/jython2.5a0/Lib/doctest.py", line 1235, in _DocTestRunner__run
       exec compile(example.source, filename, "single",
     File "<doctest selftest.entity[0]>", line 1, in <module>
       ElementTree.XML("<document>&entity;</document>")
     File "/home/boisgera/SANDBOX/ELEMENTREE-ALPHA-1.3a3-20070912-PREVIEW/elementtree-1.3/elementtree/ElementTree.py", line 1226, in XML
       return parser.close()
     File "/home/boisgera/SANDBOX/ELEMENTREE-ALPHA-1.3a3-20070912-PREVIEW/elementtree-1.3/elementtree/JythonHotfix.py", line 170, in close
       raise error
   ParseError: undefined entity: line 1, column 18
**********************************************************************
File "/home/boisgera/SANDBOX/ELEMENTREE-ALPHA-1.3a3-20070912-PREVIEW/elementtree-1.3/selftest.py", line 539, in selftest.entity
Failed example:
   ElementTree.XML(ENTITY_XML)
Expected:
   Traceback (most recent call last):
   ParseError: undefined entity &entity;: line 5, column 10
Got:
   Traceback (most recent call last):
     File "/usr/local/jython2.5a0/Lib/doctest.py", line 1235, in _DocTestRunner__run
       exec compile(example.source, filename, "single",
     File "<doctest selftest.entity[1]>", line 1, in <module>
       ElementTree.XML(ENTITY_XML)
     File "/home/boisgera/SANDBOX/ELEMENTREE-ALPHA-1.3a3-20070912-PREVIEW/elementtree-1.3/elementtree/ElementTree.py", line 1226, in XML
       return parser.close()
     File "/home/boisgera/SANDBOX/ELEMENTREE-ALPHA-1.3a3-20070912-PREVIEW/elementtree-1.3/elementtree/JythonHotfix.py", line 159, in close
       self.parse(input_source)
     File "/home/boisgera/SANDBOX/ELEMENTREE-ALPHA-1.3a3-20070912-PREVIEW/elementtree-1.3/elementtree/JythonHotfix.py", line 147, in parse
       self._reader.parse(text)
   java.io.FileNotFoundException: java.io.FileNotFoundException: /home/boisgera/SANDBOX/ELEMENTREE-ALPHA-1.3a3-20070912-PREVIEW/elementtree-1.3/user-entities.xml (No such file or directory)
**********************************************************************
File "/home/boisgera/SANDBOX/ELEMENTREE-ALPHA-1.3a3-20070912-PREVIEW/elementtree-1.3/selftest.py", line 553, in selftest.error
Failed example:
   error("<tag>&foo;</tag>").position
Expected:
   (1, 5)
Got:
   (1, 10)
**********************************************************************
File "/home/boisgera/SANDBOX/ELEMENTREE-ALPHA-1.3a3-20070912-PREVIEW/elementtree-1.3/selftest.py", line 555, in selftest.error
Failed example:
   error("foobar<").position
Expected:
   (1, 6)
Got:
   (1, 0)
**********************************************************************
5 items had failures:
  1 of   4 in selftest.bug_200708_version
  1 of  12 in selftest.bug_xmltoolkit39
  1 of   1 in selftest.bug_xmltoolkit55
  2 of   2 in selftest.entity
  2 of   3 in selftest.error
***Test Failed*** 7 failures.
336 tests ok.

-------------------------------------------------------------------------
Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW!
Studies have shown that voting for your favorite open source project,
along with a healthy diet, reduces your potential for chronic lameness
and boredom. Vote Now at http://www.sourceforge.net/community/cca08
_______________________________________________
Jython-dev mailing list
Jython-dev <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jython-dev




--
Jim Baker
jbaker <at> zyasoft.com



--
Jim Baker
jbaker <at> zyasoft.com
-------------------------------------------------------------------------
Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW!
Studies have shown that voting for your favorite open source project,
along with a healthy diet, reduces your potential for chronic lameness
and boredom. Vote Now at http://www.sourceforge.net/community/cca08
_______________________________________________
Jython-dev mailing list
Jython-dev <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jython-dev
Picon

Jython 2.5 alpha 0


Hi all,

I've been testing Jython 2.5 alpha 0 on a port of ElementTree 1.3 alpha 
3, slightly
adapted for Jython (expat replaced with SAX essentially). The output of 
the doctests
run is attached: there are only 7 failures out of 343 tests and at a 
first glance, there
are minor (error messages not being exactly the same, that kind of 
thing). The 'stable' jython 2.2.1 had 36 errors and one or two months 
ago, there was still 14 errors, some
of them being (hard) encoding issues.

Consider this as a testimony of the very impressive progress that has 
been made
in the development of Jython lately. Congratulations to everyone involved !

Cheers,

SB

**********************************************************************
File
"/home/boisgera/SANDBOX/ELEMENTREE-ALPHA-1.3a3-20070912-PREVIEW/elementtree-1.3/selftest.py",
line 1050, in selftest.bug_200708_version
Failed example:
    parser.version
Expected:
    'Expat 2.0.0'
Got:
    'J2SE 1.6.0'
**********************************************************************
File
"/home/boisgera/SANDBOX/ELEMENTREE-ALPHA-1.3a3-20070912-PREVIEW/elementtree-1.3/selftest.py",
line 948, in selftest.bug_xmltoolkit39
Failed example:
    tree.attrib
Expected:
    {u'\xe4ttr': u'v\xe4lue'}
Got:
    {'\xe4ttr': 'v\xe4lue'}
**********************************************************************
File
"/home/boisgera/SANDBOX/ELEMENTREE-ALPHA-1.3a3-20070912-PREVIEW/elementtree-1.3/selftest.py",
line 1040, in selftest.bug_xmltoolkit55
Failed example:
    e = ElementTree.XML("<!DOCTYPE doc SYSTEM 'doc.dtd'><doc>&ldots;&ndots;&rdots;</doc>")
Expected:
    Traceback (most recent call last):
    ParseError: undefined entity &ldots;: line 1, column 36
Got:
    Traceback (most recent call last):
      File "/usr/local/jython2.5a0/Lib/doctest.py", line 1235, in _DocTestRunner__run
        exec compile(example.source, filename, "single",
      File "<doctest selftest.bug_xmltoolkit55[0]>", line 1, in <module>
        e = ElementTree.XML("<!DOCTYPE doc SYSTEM 'doc.dtd'><doc>&ldots;&ndots;&rdots;</doc>")
      File
"/home/boisgera/SANDBOX/ELEMENTREE-ALPHA-1.3a3-20070912-PREVIEW/elementtree-1.3/elementtree/ElementTree.py",
line 1226, in XML
        return parser.close()
      File
"/home/boisgera/SANDBOX/ELEMENTREE-ALPHA-1.3a3-20070912-PREVIEW/elementtree-1.3/elementtree/JythonHotfix.py",
line 159, in close
        self.parse(input_source)
      File
"/home/boisgera/SANDBOX/ELEMENTREE-ALPHA-1.3a3-20070912-PREVIEW/elementtree-1.3/elementtree/JythonHotfix.py",
line 147, in parse
        self._reader.parse(text)
    java.io.FileNotFoundException: java.io.FileNotFoundException:
/home/boisgera/SANDBOX/ELEMENTREE-ALPHA-1.3a3-20070912-PREVIEW/elementtree-1.3/doc.dtd (No
such file or directory)
**********************************************************************
File
"/home/boisgera/SANDBOX/ELEMENTREE-ALPHA-1.3a3-20070912-PREVIEW/elementtree-1.3/selftest.py",
line 535, in selftest.entity
Failed example:
    ElementTree.XML("<document>&entity;</document>")
Expected:
    Traceback (most recent call last):
    ParseError: undefined entity: line 1, column 10
Got:
    Traceback (most recent call last):
      File "/usr/local/jython2.5a0/Lib/doctest.py", line 1235, in _DocTestRunner__run
        exec compile(example.source, filename, "single",
      File "<doctest selftest.entity[0]>", line 1, in <module>
        ElementTree.XML("<document>&entity;</document>")
      File
"/home/boisgera/SANDBOX/ELEMENTREE-ALPHA-1.3a3-20070912-PREVIEW/elementtree-1.3/elementtree/ElementTree.py",
line 1226, in XML
        return parser.close()
      File
"/home/boisgera/SANDBOX/ELEMENTREE-ALPHA-1.3a3-20070912-PREVIEW/elementtree-1.3/elementtree/JythonHotfix.py",
line 170, in close
        raise error
    ParseError: undefined entity: line 1, column 18
**********************************************************************
File
"/home/boisgera/SANDBOX/ELEMENTREE-ALPHA-1.3a3-20070912-PREVIEW/elementtree-1.3/selftest.py",
line 539, in selftest.entity
Failed example:
    ElementTree.XML(ENTITY_XML)
Expected:
    Traceback (most recent call last):
    ParseError: undefined entity &entity;: line 5, column 10
Got:
    Traceback (most recent call last):
      File "/usr/local/jython2.5a0/Lib/doctest.py", line 1235, in _DocTestRunner__run
        exec compile(example.source, filename, "single",
      File "<doctest selftest.entity[1]>", line 1, in <module>
        ElementTree.XML(ENTITY_XML)
      File
"/home/boisgera/SANDBOX/ELEMENTREE-ALPHA-1.3a3-20070912-PREVIEW/elementtree-1.3/elementtree/ElementTree.py",
line 1226, in XML
        return parser.close()
      File
"/home/boisgera/SANDBOX/ELEMENTREE-ALPHA-1.3a3-20070912-PREVIEW/elementtree-1.3/elementtree/JythonHotfix.py",
line 159, in close
        self.parse(input_source)
      File
"/home/boisgera/SANDBOX/ELEMENTREE-ALPHA-1.3a3-20070912-PREVIEW/elementtree-1.3/elementtree/JythonHotfix.py",
line 147, in parse
        self._reader.parse(text)
    java.io.FileNotFoundException: java.io.FileNotFoundException:
/home/boisgera/SANDBOX/ELEMENTREE-ALPHA-1.3a3-20070912-PREVIEW/elementtree-1.3/user-entities.xml
(No such file or directory)
**********************************************************************
File
"/home/boisgera/SANDBOX/ELEMENTREE-ALPHA-1.3a3-20070912-PREVIEW/elementtree-1.3/selftest.py",
line 553, in selftest.error
Failed example:
    error("<tag>&foo;</tag>").position
Expected:
    (1, 5)
Got:
    (1, 10)
**********************************************************************
File
"/home/boisgera/SANDBOX/ELEMENTREE-ALPHA-1.3a3-20070912-PREVIEW/elementtree-1.3/selftest.py",
line 555, in selftest.error
Failed example:
    error("foobar<").position
Expected:
    (1, 6)
Got:
    (1, 0)
**********************************************************************
5 items had failures:
   1 of   4 in selftest.bug_200708_version
   1 of  12 in selftest.bug_xmltoolkit39
   1 of   1 in selftest.bug_xmltoolkit55
   2 of   2 in selftest.entity
   2 of   3 in selftest.error
***Test Failed*** 7 failures.
336 tests ok.
-------------------------------------------------------------------------
Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW!
Studies have shown that voting for your favorite open source project,
along with a healthy diet, reduces your potential for chronic lameness
and boredom. Vote Now at http://www.sourceforge.net/community/cca08
_______________________________________________
Jython-dev mailing list
Jython-dev <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jython-dev
Jython tracker | 11 Jul 18:06
Favicon

Summary of Jython tracker Issues


ACTIVITY SUMMARY (07/04/08 - 07/11/08)
Jython tracker at http://bugs.jython.org/

To view or respond to any of the issues listed below, click on the issue 
number.  Do NOT respond to this message.

  214 open ( +1) /   874 closed ( +0) /  1088 total ( +1)

Open issues with patches:    35

Average duration of open issues: 822 days.
Median duration of open issues: 1120 days.

Open Issues Breakdown
   open   214 ( +1)
pending     0 ( +0)

Issues Created Or Reopened (1)
______________________________

class / function call behaviour (Jython vs. CPython)             07/09/08
       http://bugs.jython.org/issue1067    created  georgyberdyshev

-------------------------------------------------------------------------
Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW!
Studies have shown that voting for your favorite open source project,
along with a healthy diet, reduces your potential for chronic lameness
and boredom. Vote Now at http://www.sourceforge.net/community/cca08
_______________________________________________
Jython-dev mailing list
Jython-dev <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jython-dev
Leo Soto M. | 7 Jul 19:06
Picon

GSoC Weekly Report (#6): Django on Jython

Hi again!

Here is my report of what was done on the past week:

 - Benchmarked and then discarded my "findattr/getattr" change on Jython, after
   discovering that I was introducing a huge performance regression on failed
   lookups.

   - I will try again soon with the approach suggested by Samuele.

 - Improved the Django "get_db_prep_* refactor" patch
   <http://code.djangoproject.com/ticket/7560> following the feedback I got from
   Django devs.

 - Switched to the Jython "asm" branch, where all the jython-2.5 work is being
   done

   - Re-tested and commited the majority of Jython improvements resulted from
     my Django on Jython work so far. Basically, many compatibility issues
     are resolved, notabily __cmp__ on derived types and string formatting.

   - Also helped with enabling utf-8 source encoding, and some parser issues
     with files which doesn't end on a newline character.

   - Current results on the Django test suite:
     <http://dojstatus.leosoto.com/testcollector/48>

Also now that I'm commiting to the Jython subversion repository, I'm changing my
workflow a bit. My "jython.doj" hg repository is being deprecated in favor of a
simpler patch repository. For consistency, I'm doing the same for the
"django.doj" hg repository. URLs will be posted soon.

--

-- 
Leo Soto M.
http://blog.leosoto.com

-------------------------------------------------------------------------
Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW!
Studies have shown that voting for your favorite open source project,
along with a healthy diet, reduces your potential for chronic lameness
and boredom. Vote Now at http://www.sourceforge.net/community/cca08
Jython tracker | 4 Jul 18:08
Favicon

Summary of Jython tracker Issues


ACTIVITY SUMMARY (06/27/08 - 07/04/08)
Jython tracker at http://bugs.jython.org/

To view or respond to any of the issues listed below, click on the issue 
number.  Do NOT respond to this message.

  213 open ( +0) /   874 closed ( +0) /  1087 total ( +0)

Open issues with patches:    35

Average duration of open issues: 819 days.
Median duration of open issues: 1113 days.

Open Issues Breakdown
   open   213 ( +0)
pending     0 ( +0)

Top Issues Most Discussed (1)
_____________________________

  4 String missing rsplit                                             82 days
open    http://bugs.jython.org/issue1023   

-------------------------------------------------------------------------
Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW!
Studies have shown that voting for your favorite open source project,
along with a healthy diet, reduces your potential for chronic lameness
and boredom. Vote Now at http://www.sourceforge.net/community/cca08
_______________________________________________
Jython-dev mailing list
Jython-dev <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jython-dev
Eric Jonas | 1 Jul 17:02
Picon
Favicon

Proper (2.5 svn) way of writing an extension?

So I'm a bit confused on how to get started here, unfortunately -- the
wiki seems to still be stuck in a pre-2.5 world, so is the best way to
start writing a module (given the current jython svn trunk):

Do I use the annotations as described here: 

http://wiki.python.org/jython/PythonTypesInJava

Or, per http://wiki.python.org/jython/JythonModulesInJava

- write a "POJO" (which I assume means Plain Old Java Object)
- vs a subclass of PyObject (which gives me keyword args, i think)

What is the standard way that jython has been implementing/migrating
existing standard library c modules? What would people recommend? 

Thanks, 
		...Eric

-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
Picon

class / function call behaviour (Jython vs. CPython)

Hello,

lately I have been trying to fix a problem of the different
behaviour of CPython and Jython.
At the moment Jython represents several calls to classes
as function calls.

I had to introduce some ugly changes to PyFrame.java,
PySystemState.java, Py.java and imp.java,
having to hook in between the call of the import statement and properly
setting f_locals and f_globals.
This worked so far to pass several unit tests for Zope, but is not the
right solution.

There is real need to fix this issue and I am looking for help
to get some hints on where to look at the Jython code (asm branch).
(TreeBuilder, CodeVisitor, ScopesCompiler, other compiler parts?
CodeReader?)

Here is some output of CPython 2.5 and Jython svn asm branch r4826:

gebe <at> venus:~/work/crash$ python test.py 
class
********************
f_locals:  {'__module__': '__main__', 'classLevelFrameInfo': ('class',
<module '__main__' from 'test.py'>, {...}, {'kind': 'class',
'f_globals': {...}, 'frameInfo': <function frameInfo at 0xb7d2ad84>,
'__builtins__': <module '__builtin__' (built-in)>, 'ClassType': <type
'classobj'>, '__file__': 'test.py', 'module': <module '__main__' from
'test.py'>, 'f_locals': {...}, 'sys': <module 'sys' (built-in)>,
'ClassicClass': <class __main__.ClassicClass at 0xb7d3465c>, '__name__':
'__main__', '__doc__': None}), '__doc__': None}

f_globals:  {'kind': 'class', 'f_globals': {...}, 'frameInfo': <function
frameInfo at 0xb7d2ad84>, '__builtins__': <module
'__builtin__' (built-in)>, 'ClassType': <type 'classobj'>, '__file__':
'test.py', 'module': <module '__main__' from 'test.py'>, 'f_locals':
{'__module__': '__main__', 'classLevelFrameInfo': ('class', <module
'__main__' from 'test.py'>, {...}, {...}), '__doc__': None}, 'sys':
<module 'sys' (built-in)>, 'ClassicClass': <class __main__.ClassicClass
at 0xb7d3465c>, '__name__': '__main__', '__doc__': None}

gebe <at> venus:~/work/crash$ jython25 test.py
function call
********************
f_locals:  {'__doc__': None, '__module__': '__main__',
'classLevelFrameInfo': ('function call', <module '__main__' from
'test.py'>, {...}, {'ClassicClass': <class __main__.ClassicClass at 1>,
'sys': sys module, '__file__': 'test.py', '__doc__': None, 'f_globals':
{...}, 'frameInfo': <function frameInfo at 2>, 'kind': 'function call',
'__name__': '__main__', 'f_locals': {...}, 'ClassType': <type 'class'>,
'module': <module '__main__' from 'test.py'>})}

f_globals:  {'ClassicClass': <class __main__.ClassicClass at 1>, 'sys':
sys module, '__file__': 'test.py', '__doc__': None, 'f_globals': {...},
'frameInfo': <function frameInfo at 2>, 'kind': 'function call',
'__name__': '__main__', 'f_locals': {'__doc__': None, '__module__':
'__main__', 'classLevelFrameInfo': ('function call', <module '__main__'
from 'test.py'>, {...}, {...})}, 'ClassType': <type 'class'>, 'module':
<module '__main__' from 'test.py'>}

The code is a modified version of the parts for testing included in
zope.interface:

gebe <at> venus:~/work/crash$ cat test.py
from myimport import *

from types import ClassType

class ClassicClass:
    classLevelFrameInfo = frameInfo(sys._getframe())

kind, module, f_locals, f_globals = ClassicClass.classLevelFrameInfo

print kind
print "*" * 20
print "f_locals: ", f_locals
print
print "f_globals: ", f_globals

--------------------------------------------------

gebe <at> venus:~/work/crash$ cat myimport.py
import sys

def frameInfo(frame):
    f_locals = frame.f_locals
    f_globals = frame.f_globals

    sameNamespace = f_locals is f_globals
    hasModule = '__module__' in f_locals
    hasName = '__name__' in f_globals

    sameName = hasModule and hasName
    sameName =sameName and f_globals['__name__']==f_locals['__module__']

    module = hasName and sys.modules.get(f_globals['__name__']) or None

    namespaceIsModule = module and module.__dict__ is f_globals

    if not namespaceIsModule:
        kind = "exec"
    elif sameNamespace and not hasModule:
        kind = "module"
    elif sameName and not sameNamespace:
        kind = "class"
    elif not sameNamespace:
        kind = "function call"

    else:
        kind = "unknown"

    return kind, module, f_locals, f_globals

Thanks in advance!

Kind regards, Georgy Berdyshev

--

-- 
Georgy Berdyshev - Георгий Бердышев

GPG key: 830F68C5
Fingerprint: 0379 ED5A BEE5 65A8 7BD5 31E7 F5B4 1EC7 830F 68C5

-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
Jython-dev mailing list
Jython-dev <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jython-dev
Picon

Zope on Jython (GSoC status update)

Hello,

here is a short update of the current work on porting Zope to Jython.

So far the following parts are working:
-zope.hookable
-(zope.app.debug)
-zope.i18nmessageid
-zope.app.exception
-zope.interface
-zope.component
-zope.configuration
-zope.modulealias
-zope.deferredimport
-(zope.proxy)
-zope.deprecation
-zope.schema
-zc.buildout
-zope.event
-zope.size
-zope.exceptions
-zope.testing
-ZConfig
-zdaemon
-bootstrap.py

changes to Jython:
- "-m" implementation (for Zope bootstrap.py)
- implemented some missing parts (like rsplit) for strings
- fixes to f_locals, f_globals for frames (was different to CPython),
still needs improvements

At the moment I am decreasing test errors (doctest, unittest) for
several components.
With the fix to f_locals  / f_globals many of the tests will pass.

I am going to change my work base now and use the the asm branch, as it
seems more stable and provides the
CPython 2.5 library.

Many of the fixes done for the tests for Zope components were also
failing on CPython 2.4 / 2.5.
The work also improves Zope to function on CPython 2.5.

The so far, working components represent a good part of "the solid
ground" of Zope, which are used by many other components.
The future work will be based on getting the tests pass and also
implementing missing C parts in Java.
Many of the tests show several missing parts in the Python language
implementation / behaviour (available in CPython), which will have to be
fixed inside of Jython.

Kind regards, Georgy Berdyshev

--

-- 
Georgy Berdyshev - Георгий Бердышев

GPG key: 830F68C5
Fingerprint: 0379 ED5A BEE5 65A8 7BD5 31E7 F5B4 1EC7 830F 68C5

-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
Jython-dev mailing list
Jython-dev <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jython-dev

Gmane