You are viewing a plain text version of this content. The canonical link for it is here.
Posted to pylucene-dev@lucene.apache.org by "Andi Vajda (JIRA)" <ji...@apache.org> on 2018/03/19 20:21:00 UTC

[jira] [Commented] (PYLUCENE-41) JArray type issue

    [ https://issues.apache.org/jira/browse/PYLUCENE-41?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16405374#comment-16405374 ] 

Andi Vajda commented on PYLUCENE-41:
------------------------------------

The bug is not with creating the JArray('double')([1.0, 2.0]) array. This works with both python 2 and 3.

What is not working in jcc on python 3 is setting this array into the other array you created:

    >>> a=JArray('object')(5)
    >>> a[0] = JArray('double')([1.0, 2.0])
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: JArray<double>[1.0, 2.0]

Nor does casting it to Object work:

    >>> from java.lang import Object
    >>> JArray('double')([1.0, 2.0]).cast_(Object)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: <class 'Object'>

This all seems to work fine in python 2, however.

 

> JArray type issue
> -----------------
>
>                 Key: PYLUCENE-41
>                 URL: https://issues.apache.org/jira/browse/PYLUCENE-41
>             Project: PyLucene
>          Issue Type: Bug
>         Environment: windows 7, python 3
>            Reporter: Petrus Hyvönen
>            Priority: Major
>
> Hi,
>  
> In JCC 3.0 release version and early(2.7) it is possible to make a double array by:
>  
> {{mask = JArray('object')(5)}}
> {{for i in range(5)}}
>  {{    mask[i] = JArray('double')([1.0, 2.0])}}
> It gives in the <=3.0 following type of 'mask'
> JArray<object>[<Object: [D@3967e60c>, <Object: [D@60d8c9b7>, ...
> for svn version it gives a 'TypeError: JArray<double>[1.0, 2.0]' in the assignment to mask[i]
>  
> Not sure this is a bug or a change of how to do things.
> Best Regards
> /Petrus
>  
>  



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)