From dev-return-38800-archive-asf-public=cust-asf.ponee.io@subversion.apache.org Thu Dec 27 20:10:00 2018 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx-eu-01.ponee.io (Postfix) with SMTP id 19740180625 for ; Thu, 27 Dec 2018 20:09:59 +0100 (CET) Received: (qmail 47616 invoked by uid 500); 27 Dec 2018 19:09:59 -0000 Mailing-List: contact dev-help@subversion.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Delivered-To: mailing list dev@subversion.apache.org Received: (qmail 47606 invoked by uid 99); 27 Dec 2018 19:09:58 -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; Thu, 27 Dec 2018 19:09:58 +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 1C79BC1EAE for ; Thu, 27 Dec 2018 19:09:58 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd4-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 0 X-Spam-Level: X-Spam-Status: No, score=0 tagged_above=-999 required=6.31 tests=[HEADER_FROM_DIFFERENT_DOMAINS=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001] 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 o9dfODVizUeA for ; Thu, 27 Dec 2018 19:09:54 +0000 (UTC) Received: from mail-io1-f67.google.com (mail-io1-f67.google.com [209.85.166.67]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with ESMTPS id 187BA5FB31 for ; Thu, 27 Dec 2018 19:09:54 +0000 (UTC) Received: by mail-io1-f67.google.com with SMTP id x6so15225109ioa.9 for ; Thu, 27 Dec 2018 11:09:54 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:subject:to:cc:references:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=DHOkrtykUv0xi09/VsuCmiibYr0pGsKjf/4IyTgfWWg=; b=cCP5epwHZXZ7p4vq3hQW4DVM3Gfym4WhOl9lGpjVcdjztyfxsfwd/wB1ZJ1cYiY8h7 Ni/wlzsVOlMJcEWpadiZAydBV0U62qiSEMs4xW8vpXVuyWkfMi/k04kSnWPTExBwkBQN /NYCcTDV7ZaENBH6UL5TBgZ1qIKcm6017OTHeBXS6w0iUpZmpAiXNWVIv3b9WTNjUj/C 82TVROL8ewHKkckWAhrgS2nT0lNJTL6IM9nWxf4yL3dvDr/DOdf2NJYEefsKqsWGepZB ZxLZ9Ksa2ds8qAN0NBiWGvDSgYAzCcN3QBeuz+60JT4L6cZRp4sT1yP5H/s6KpafTjAy /O6Q== X-Gm-Message-State: AJcUukeXk7zdWeYFv+YLWxC0wzGqB3lGvcPteZksMDg7yellABq7mwkZ 6c9c+tIFsHZVuixijyax/ia+JhlioOZUhA== X-Google-Smtp-Source: ALg8bN7JZZPg75WiDwI5dRLXsdZhLEOoGDIzWBzFky6OssPDODRGdcBvY9TdPtOPbs76ZXJ6KDMqew== X-Received: by 2002:a5d:84c1:: with SMTP id z1mr16146410ior.277.1545937786912; Thu, 27 Dec 2018 11:09:46 -0800 (PST) Received: from [10.10.10.179] (cpe-65-190-129-191.nc.res.rr.com. [65.190.129.191]) by smtp.gmail.com with ESMTPSA id m20sm16610012itm.29.2018.12.27.11.09.45 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 27 Dec 2018 11:09:45 -0800 (PST) From: Troy Curtis Subject: Re: [swig-py3][patch] interfacing bytes object instead of str To: Yasuhito FUTATSUKI Cc: Daniel Shahaf , Subversion Development , futatuki@yf.bsdclub.org References: <1542848250.1963069.1585127856.0D550264@webmail.messagingengine.com> <1542939701.3975740.1586165808.71DB1FCF@webmail.messagingengine.com> <20181123085747.hxlyh2dyc5i6sbwr@tarpaulin.shahaf.local2> <5eb61bdf-be4b-a854-37a3-ab802b0cc0f1@poem.co.jp> <20181128154039.76ksvew7iybufobo@tarpaulin.shahaf.local2> <1544977683.820108.1610663952.7D9615EE@webmail.messagingengine.com> <12cc6d46-c449-3316-a3a2-5cbd6567085f@poem.co.jp> <1352e713-5442-9f49-f133-7acceee828d5@troycurtisjr.com> Message-ID: <8f98f1d1-26af-d822-04ad-6bb51b1c3e3d@apache.org> Date: Thu, 27 Dec 2018 14:09:44 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.3.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit On 12/27/18 12:42 PM, Yasuhito FUTATSUKI wrote: > On 12/27/18 1:01 PM, Troy Curtis wrote: >  > The only real functionality changes I'm concerned with on the > changes are dropping str() conversion on a couple of the API inputs > since previously providing any object with a suitable __str__ method > would work, but would now be broken. But a simple way of supporting Py2 > and Py3 isn't a "gimme", so didn't want to block this patch on that. > > I see. So I've revise it and str/bytes conversion in unit tests as a first > step of followup to r1849784. Oh my, so I've been silly having you look at this. I just realized that both usages of dropping str() were within the tests! SMH! Since those usages are completely internal, there is no danger of being provided some other value. I apologize for the misdirection. > > [in subversion/bindings/swig/python/tests] > > * client.py (SubversionClientTestCase.test_update4): not to encode >  os.path.sep if it is already bytes object > > * core.py (SubversionCoreTestCase.test_stream_write): not to encode >  fname if it is already bytes object > > * delta.py (DeltaTestCase.testTxWindowHandler_stream_IF, >  DeltaTestCase.testTxWindowHandler_Stream_IF): not to encode fname if it >  is already bytes object > > * fs.py (SubversionFSTestCase.setUp): not to encode self.tmpfile if it >  is already bytes object > > * trac/versioncontrol/main.py (Node.__init__): revise change to strip >  str() on r1849784; if path is already bytes, use it for self.path. >  othewise ensure self.path is str, and if it is not bytes (i.e. in case >  of py3), encode it to bytes > > * trac/versioncontrol/svn_fs.py (SubversionNode.__init__): don't use >  IS_PY3 condition, just store a unicode string in the exception object. >  - remove unnecessary variable IS_PY3 and therefore unnecessary import >   of sys module >  - (SubversionNode.getproperties): revise change to strip str() on >   r1849784; if value is already bytes, use it for prop[name].  othewise >   ensure value is str, and if it is not bytes (i.e. in case of py3), >   encode it to bytes for consistency of the type of prop[name] > > * utils.py (Temper.alloc_empty_dir, Temper.alloc_empty_repo): ensure >  suffix arg for tempfile.mkdtemp() is unicode (for py3 < 3.5) > > Cheers, LGTM, committed as r1849804, but without the unnecessary gymnastics to continue supporting str() in those two cases mentioned above. I also tweaked the log message to use complete sentences (and removed references to the code that I didn't include). Troy