[ grinder-Bugs-2911790 ] HTTP filter generates invalid Jython code for Jython > 2.5.0
"SourceForge.net" <[email protected]>
| Newsgroups | gmane.comp.java.grinder.devel |
|---|---|
| Message-ID | <[email protected]> |
Bugs item #2911790, was opened at 2009-12-10 04:38
Message generated for change (Comment added) made by philipa
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=118598&aid=2911790&group_id=18598
Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: HTTP Plugin
Group: None
Status: Open
Resolution: None
Priority: 7
Private: No
Submitted By: Nobody/Anonymous (nobody)
Assigned to: Philip Aston (philipa)
Summary: HTTP filter generates invalid Jython code for Jython > 2.5.0
Initial Comment:
Hi,
The HTTP filter of TCPProxy in Grinder 3.3 generates codes that look like:
headers0= \
( NVPair('Accept', '*/*'), )
This code does not work with Jython > 2.5.0 because tuples in Python are immutable,
which in turn means values in a tuple must also be immutable.
Using lists instead of tuples resolves this issue; the result will look like:
headers0= \
[ NVPair('Accept', '*/*'), ]
----------------------------------------------------------------------
>Comment By: Philip Aston (philipa)
Date: 2009-12-23 14:15
Message:
Having searched around, this appears to be a deliberate change in behaviour
in 2.5.
See http://bugs.jython.org/issue1345 and
http://wiki.python.org/jython/UserGuide#tuples
Consequently, I will alter the TCPProxy filter to generate lists instead
of tuples.
----------------------------------------------------------------------
Comment By: Nobody/Anonymous (nobody)
Date: 2009-12-17 00:08
Message:
> Please confirm.
Exactly.. Sorry for my wrong analysis.
----------------------------------------------------------------------
Comment By: Philip Aston (philipa)
Date: 2009-12-10 22:37
Message:
Generated scripts fail under 2.5, and the workaround works, but not for the
reason suggested in the Details field. It is fine for a Python tuple to
contain a mutable value.
The code quoted in the Details works fine under 2.5. I think the bit of
the script you meant to quote was in fact something like...
connectionDefaults.defaultHeaders =\
( NVPair('Accept-Language', 'en-gb,en;q=0.5'),
NVPair('User-Agent', 'Mozilla/5.0 (X11; U; Linux i686; en-GB;
rv:1.9.0.15) Gecko/2009102815 Ubuntu/9.04 (jaunty) Firefox/3.0.15'), )
Please confirm.
Jython 2.5 has problems in mapping tuples to the Java arrays when the
attribute syntatic sugar is used in place of a setter. On the other hand,
this works:
connectionDefaults.setDefaultHeaders(
( NVPair('Accept-Language', 'en-gb,en;q=0.5'),
NVPair('User-Agent', 'Mozilla/5.0 (X11; U; Linux i686; en-GB;
rv:1.9.0.15) Gecko/2009102815 Ubuntu/9.04 (jaunty) Firefox/3.0.15'), ))
I've done a quick query against the Jython bug database and found nothing.
We need to contact the Jythonista's and see whether they can explain
whether this change in behaviour from 2.2.1 is by design or not.
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=118598&aid=2911790&group_id=18598
------------------------------------------------------------------------------
This SF.Net email is sponsored by the Verizon Developer Community
Take advantage of Verizon's best-in-class app development support
A streamlined, 14 day to market process makes app distribution fast and easy
Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev