Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 545B1200CC5 for ; Tue, 27 Jun 2017 04:17:09 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 489E8160BDE; Tue, 27 Jun 2017 02:17:09 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 8DB89160BDA for ; Tue, 27 Jun 2017 04:17:08 +0200 (CEST) Received: (qmail 53558 invoked by uid 500); 27 Jun 2017 02:17:07 -0000 Mailing-List: contact pylucene-dev-help@lucene.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: pylucene-dev@lucene.apache.org Delivered-To: mailing list pylucene-dev@lucene.apache.org Received: (qmail 53547 invoked by uid 99); 27 Jun 2017 02:17:07 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd4-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 27 Jun 2017 02:17:07 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd4-us-west.apache.org (ASF Mail Server at spamd4-us-west.apache.org) with ESMTP id 53FE6C028B for ; Tue, 27 Jun 2017 02:17:07 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd4-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -99.202 X-Spam-Level: X-Spam-Status: No, score=-99.202 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, RP_MATCHES_RCVD=-0.001, SPF_PASS=-0.001, USER_IN_WHITELIST=-100] autolearn=disabled Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd4-us-west.apache.org [10.40.0.11]) (amavisd-new, port 10024) with ESMTP id PCGTWrcNaUkD for ; Tue, 27 Jun 2017 02:17:06 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with ESMTP id 528DC5F4EC for ; Tue, 27 Jun 2017 02:17:06 +0000 (UTC) Received: from jira-lw-us.apache.org (unknown [207.244.88.139]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id D591BE0C1D for ; Tue, 27 Jun 2017 02:17:04 +0000 (UTC) Received: from jira-lw-us.apache.org (localhost [127.0.0.1]) by jira-lw-us.apache.org (ASF Mail Server at jira-lw-us.apache.org) with ESMTP id 88EEA24124 for ; Tue, 27 Jun 2017 02:17:02 +0000 (UTC) Date: Tue, 27 Jun 2017 02:17:02 +0000 (UTC) From: "Patrick J. McNerthney (JIRA)" To: pylucene-dev@lucene.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (PYLUCENE-36) Python exception when handling a Java error MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Tue, 27 Jun 2017 02:17:09 -0000 [ 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)))') }} > 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)