Discussion:
[jira] [Created] (PYLUCENE-36) Python exception when handling a Java error
Paulo Villegas (JIRA)
2017-05-22 18:32:04 UTC
Permalink
Paulo Villegas created PYLUCENE-36:
--------------------------------------

Summary: Python exception when handling a Java error
Key: PYLUCENE-36
URL: https://issues.apache.org/jira/browse/PYLUCENE-36
Project: PyLucene
Issue Type: Bug
Environment: Python 3.5, Ubuntu 16.04, Java 8
Reporter: Paulo Villegas
Attachments: pylucene-6.5.0-py3.5.patch

When handling a Java exception via the {{JavaError}} class, Python 3.5 generates an exception due to the call to {{unicode}} (which does not exist in Python 3), hence masking the actual Java exception with a Python _NameError_ exception.

I guess this is a consequence of PYLUCENE-35. That one fixed the problem with Unicode characters in Java exceptions for Python 2, but it shouldn't be applied to Python 3 (since in Python 3 the {{str}} type *is* natively Unicode).

The attached small patch (applied only to the Python 3 branch) fixes it for me.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)
Andi Vajda (JIRA)
2017-05-22 20:33:04 UTC
Permalink
[ https://issues.apache.org/jira/browse/PYLUCENE-36?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Andi Vajda resolved PYLUCENE-36.
--------------------------------
Resolution: Fixed

merged, thanks !
Post by Paulo Villegas (JIRA)
Python exception when handling a Java error
-------------------------------------------
Key: PYLUCENE-36
URL: https://issues.apache.org/jira/browse/PYLUCENE-36
Project: PyLucene
Issue Type: Bug
Environment: Python 3.5, Ubuntu 16.04, Java 8
Reporter: Paulo Villegas
Attachments: pylucene-6.5.0-py3.5.patch
When handling a Java exception via the {{JavaError}} class, Python 3.5 generates an exception due to the call to {{unicode}} (which does not exist in Python 3), hence masking the actual Java exception with a Python _NameError_ exception.
I guess this is a consequence of PYLUCENE-35. That one fixed the problem with Unicode characters in Java exceptions for Python 2, but it shouldn't be applied to Python 3 (since in Python 3 the {{str}} type *is* natively Unicode).
The attached small patch (applied only to the Python 3 branch) fixes it for me.
--
This message was sent by Atlassian JIRA
(v6.3.15#6346)
Andi Vajda (JIRA)
2017-05-22 20:33:04 UTC
Permalink
[ https://issues.apache.org/jira/browse/PYLUCENE-36?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16020146#comment-16020146 ]

Andi Vajda commented on PYLUCENE-36:
------------------------------------

Thank you for your patch, I just integrated it !
Post by Paulo Villegas (JIRA)
Python exception when handling a Java error
-------------------------------------------
Key: PYLUCENE-36
URL: https://issues.apache.org/jira/browse/PYLUCENE-36
Project: PyLucene
Issue Type: Bug
Environment: Python 3.5, Ubuntu 16.04, Java 8
Reporter: Paulo Villegas
Attachments: pylucene-6.5.0-py3.5.patch
When handling a Java exception via the {{JavaError}} class, Python 3.5 generates an exception due to the call to {{unicode}} (which does not exist in Python 3), hence masking the actual Java exception with a Python _NameError_ exception.
I guess this is a consequence of PYLUCENE-35. That one fixed the problem with Unicode characters in Java exceptions for Python 2, but it shouldn't be applied to Python 3 (since in Python 3 the {{str}} type *is* natively Unicode).
The attached small patch (applied only to the Python 3 branch) fixes it for me.
--
This message was sent by Atlassian JIRA
(v6.3.15#6346)
Patrick J. McNerthney (JIRA)
2017-06-27 02:17:02 UTC
Permalink
[ https://issues.apache.org/jira/browse/PYLUCENE-36?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16064136#comment-16064136 ]

Patrick J. McNerthney commented on PYLUCENE-36:
-----------------------------------------------

A nit-pick on the Python 3 purity of the generated code. The u prefix on string constants is only supported to make it easy for the same code to run in both Python 2 and 3. Since this is generating Python 3 specific code, the changed line should remove the u"..." string constants, resulting in:

{{
line(out, 2, 'return "\\n".join((str(super(JavaError, self)), " Java stacktrace:", str(writer)))')
}}
Post by Paulo Villegas (JIRA)
Python exception when handling a Java error
-------------------------------------------
Key: PYLUCENE-36
URL: https://issues.apache.org/jira/browse/PYLUCENE-36
Project: PyLucene
Issue Type: Bug
Environment: Python 3.5, Ubuntu 16.04, Java 8
Reporter: Paulo Villegas
Attachments: pylucene-6.5.0-py3.5.patch
When handling a Java exception via the {{JavaError}} class, Python 3.5 generates an exception due to the call to {{unicode}} (which does not exist in Python 3), hence masking the actual Java exception with a Python _NameError_ exception.
I guess this is a consequence of PYLUCENE-35. That one fixed the problem with Unicode characters in Java exceptions for Python 2, but it shouldn't be applied to Python 3 (since in Python 3 the {{str}} type *is* natively Unicode).
The attached small patch (applied only to the Python 3 branch) fixes it for me.
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)
Patrick J. McNerthney (JIRA)
2017-06-27 02:18:00 UTC
Permalink
[ https://issues.apache.org/jira/browse/PYLUCENE-36?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16064136#comment-16064136 ]

Patrick J. McNerthney edited comment on PYLUCENE-36 at 6/27/17 2:17 AM:
------------------------------------------------------------------------

A nit-pick on the Python 3 purity of the generated code. The u prefix on string constants is only supported to make it easy for the same code to run in both Python 2 and 3. Since this is generating Python 3 specific code, the changed line should remove the u"..." string constants, resulting in:

{noformat}
line(out, 2, 'return "\\n".join((str(super(JavaError, self)), " Java stacktrace:", str(writer)))')
{noformat}



was (Author: olindaspider):
A nit-pick on the Python 3 purity of the generated code. The u prefix on string constants is only supported to make it easy for the same code to run in both Python 2 and 3. Since this is generating Python 3 specific code, the changed line should remove the u"..." string constants, resulting in:

{{
line(out, 2, 'return "\\n".join((str(super(JavaError, self)), " Java stacktrace:", str(writer)))')
}}
Post by Paulo Villegas (JIRA)
Python exception when handling a Java error
-------------------------------------------
Key: PYLUCENE-36
URL: https://issues.apache.org/jira/browse/PYLUCENE-36
Project: PyLucene
Issue Type: Bug
Environment: Python 3.5, Ubuntu 16.04, Java 8
Reporter: Paulo Villegas
Attachments: pylucene-6.5.0-py3.5.patch
When handling a Java exception via the {{JavaError}} class, Python 3.5 generates an exception due to the call to {{unicode}} (which does not exist in Python 3), hence masking the actual Java exception with a Python _NameError_ exception.
I guess this is a consequence of PYLUCENE-35. That one fixed the problem with Unicode characters in Java exceptions for Python 2, but it shouldn't be applied to Python 3 (since in Python 3 the {{str}} type *is* natively Unicode).
The attached small patch (applied only to the Python 3 branch) fixes it for me.
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)
Patrick J. McNerthney (JIRA)
2017-06-27 02:23:06 UTC
Permalink
[ https://issues.apache.org/jira/browse/PYLUCENE-36?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16064136#comment-16064136 ]

Patrick J. McNerthney edited comment on PYLUCENE-36 at 6/27/17 2:22 AM:
------------------------------------------------------------------------

A nit-pick on the Python 3 purity of the generated code. The u prefix on string constants is only supported in Python 3 to make it easy for the same code to run in both Python 2 and 3. Since this is generating Python 3 specific code, the changed line should remove the u"..." string constants, resulting in:

{noformat}
line(out, 2, 'return "\\n".join((str(super(JavaError, self)), " Java stacktrace:", str(writer)))')
{noformat}



was (Author: olindaspider):
A nit-pick on the Python 3 purity of the generated code. The u prefix on string constants is only supported to make it easy for the same code to run in both Python 2 and 3. Since this is generating Python 3 specific code, the changed line should remove the u"..." string constants, resulting in:

{noformat}
line(out, 2, 'return "\\n".join((str(super(JavaError, self)), " Java stacktrace:", str(writer)))')
{noformat}
Post by Paulo Villegas (JIRA)
Python exception when handling a Java error
-------------------------------------------
Key: PYLUCENE-36
URL: https://issues.apache.org/jira/browse/PYLUCENE-36
Project: PyLucene
Issue Type: Bug
Environment: Python 3.5, Ubuntu 16.04, Java 8
Reporter: Paulo Villegas
Attachments: pylucene-6.5.0-py3.5.patch
When handling a Java exception via the {{JavaError}} class, Python 3.5 generates an exception due to the call to {{unicode}} (which does not exist in Python 3), hence masking the actual Java exception with a Python _NameError_ exception.
I guess this is a consequence of PYLUCENE-35. That one fixed the problem with Unicode characters in Java exceptions for Python 2, but it shouldn't be applied to Python 3 (since in Python 3 the {{str}} type *is* natively Unicode).
The attached small patch (applied only to the Python 3 branch) fixes it for me.
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)
Andi Vajda (JIRA)
2017-06-27 16:57:00 UTC
Permalink
[ https://issues.apache.org/jira/browse/PYLUCENE-36?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16065129#comment-16065129 ]

Andi Vajda commented on PYLUCENE-36:
------------------------------------

Done.
Post by Paulo Villegas (JIRA)
Python exception when handling a Java error
-------------------------------------------
Key: PYLUCENE-36
URL: https://issues.apache.org/jira/browse/PYLUCENE-36
Project: PyLucene
Issue Type: Bug
Environment: Python 3.5, Ubuntu 16.04, Java 8
Reporter: Paulo Villegas
Attachments: pylucene-6.5.0-py3.5.patch
When handling a Java exception via the {{JavaError}} class, Python 3.5 generates an exception due to the call to {{unicode}} (which does not exist in Python 3), hence masking the actual Java exception with a Python _NameError_ exception.
I guess this is a consequence of PYLUCENE-35. That one fixed the problem with Unicode characters in Java exceptions for Python 2, but it shouldn't be applied to Python 3 (since in Python 3 the {{str}} type *is* natively Unicode).
The attached small patch (applied only to the Python 3 branch) fixes it for me.
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Loading...