Issue2423
Created on 2015-11-10.15:16:21 by rhpatrick, last changed 2016-01-13.22:56:41 by zyasoft.
File name |
Uploaded |
Description |
Edit |
Remove |
jython_bug.py
|
rhpatrick,
2015-11-10.15:16:21
|
Stupid little reproducer that takes a filename as an argument. |
|
|
msg10448 (view) |
Author: Robert Patrick (rhpatrick) |
Date: 2015-11-10.15:16:21 |
|
The behavior of jarray.array() has changed between Jython 2.2.x and 2.7 and is breaking existing scripts. I am attaching a simple reproducer that runs perfecting in Jython 2.2.x but fails in 2.7 with the following error:
TypeError: getDeclaredMethod(): 2nd arg can't be coerced to java.lang.Class[]
One thing I noted was that type() returns different results on the return value of jarray.array(). In Jython 2.2.x, it returns "<type 'array'>" while in 2.7 it returns "<type 'array.array'>".
|
msg10588 (view) |
Author: Jim Baker (zyasoft) |
Date: 2016-01-05.05:06:41 |
|
As of Jython 2.5, we unified the jarray and array modules. So that's why you get <type 'array.array'> - it's the same as in CPython:
$ python
Python 2.7.10 (v2.7.10:15c95b7d81dc, May 23 2015, 09:33:12)
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from array import array
>>> x = array('b', 'foo')
>>> x
array('b', [102, 111, 111])
>>> type(x)
<type 'array.array'>
I wonder if the underlying problem is supporting vararg-style methods like getDeclaredMethod. Note that you change your script like so and it works:
method = javaURLClassLoader.getDeclaredMethod('addURL', [javaURL])
Also this is an easier setup than using array/jarray.
But we should still look at the conversion to Java for such vararg support for array objects - that should work. The starting point would be the changes for #1615.
|
msg10589 (view) |
Author: Robert Patrick (rhpatrick) |
Date: 2016-01-05.22:05:37 |
|
My challenge is that we have tens of thousands of customers with who knows how many existing scripts that have been working for years (not sure how many are using jarray.array()). We are upgrading to Jython 2.7 but cannot very well tell all of these customers to go change their scripts to support the new version of Jython we are using.
|
msg10592 (view) |
Author: Jim Baker (zyasoft) |
Date: 2016-01-06.18:58:46 |
|
Related to #1780 (possibly a duplicate)
|
msg10595 (view) |
Author: Jim Baker (zyasoft) |
Date: 2016-01-06.21:43:30 |
|
Fixed as of https://hg.python.org/jython/rev/49d498968f34
|
|
Date |
User |
Action |
Args |
2016-01-13 22:56:41 | zyasoft | set | status: pending -> closed |
2016-01-06 21:43:30 | zyasoft | set | status: open -> pending assignee: zyasoft resolution: fixed messages:
+ msg10595 milestone: Jython 2.7.1 |
2016-01-06 18:58:46 | zyasoft | set | messages:
+ msg10592 |
2016-01-05 22:05:37 | rhpatrick | set | messages:
+ msg10589 |
2016-01-05 05:06:42 | zyasoft | set | nosy:
+ zyasoft messages:
+ msg10588 |
2015-11-10 15:16:22 | rhpatrick | create | |
|