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 1B2132007D0 for ; Tue, 10 May 2016 21:12:04 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 1927616098A; Tue, 10 May 2016 19:12:04 +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 5F08D160877 for ; Tue, 10 May 2016 21:12:03 +0200 (CEST) Received: (qmail 41273 invoked by uid 500); 10 May 2016 19:12:02 -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 41263 invoked by uid 99); 10 May 2016 19:12:02 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd3-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 10 May 2016 19:12:02 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd3-us-west.apache.org (ASF Mail Server at spamd3-us-west.apache.org) with ESMTP id 9EEC0180547 for ; Tue, 10 May 2016 19:12:01 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd3-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -0.701 X-Spam-Level: X-Spam-Status: No, score=-0.701 tagged_above=-999 required=6.31 tests=[RCVD_IN_DNSWL_LOW=-0.7, SPF_PASS=-0.001] autolearn=disabled Received: from mx2-lw-us.apache.org ([10.40.0.8]) by localhost (spamd3-us-west.apache.org [10.40.0.10]) (amavisd-new, port 10024) with ESMTP id jkjBTrExB0Zr for ; Tue, 10 May 2016 19:11:59 +0000 (UTC) Received: from mail37c50.megamailservers.eu (mail230c50.megamailservers.eu [91.136.10.240]) by mx2-lw-us.apache.org (ASF Mail Server at mx2-lw-us.apache.org) with ESMTPS id 35A0D5F19B for ; Tue, 10 May 2016 19:11:59 +0000 (UTC) X-Authenticated-User: stefanfuhrmann.alice-dsl.de Received: from [10.22.23.174] (216-123-155-195.dedicated.allstream.net [216.123.155.195]) (authenticated bits=0) by mail37c50.megamailservers.eu (8.14.9/8.13.1) with ESMTP id u4AJBo76029720 for ; Tue, 10 May 2016 19:11:52 +0000 Subject: Re: svn commit: r1743195 - /subversion/trunk/subversion/tests/cmdline/svntest/main.py To: dev@subversion.apache.org References: <20160510142957.39F873A0216@svn01-us-west.apache.org> <5731F167.5000903@apache.org> From: Stefan Fuhrmann Message-ID: <57323275.3020309@alice-dsl.de> Date: Tue, 10 May 2016 21:11:49 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.7.2 MIME-Version: 1.0 In-Reply-To: <5731F167.5000903@apache.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-CTCH-RefID: str=0001.0A0B0205.57323278.00F4,ss=1,re=0.000,recu=0.000,reip=0.000,cl=1,cld=1,fgs=0 X-CTCH-VOD: Unknown X-CTCH-Spam: Unknown X-CTCH-Score: 0.000 X-CTCH-Rules: X-CTCH-Flags: 0 X-CTCH-ScoreCust: 0.000 X-CSC: 0 X-CHA: v=2.1 cv=C+XQl2/+ c=1 sm=1 tr=0 a=Gik9Z2Jnc5xJWjXDktFmfQ==:117 a=Gik9Z2Jnc5xJWjXDktFmfQ==:17 a=L9H7d07YOLsA:10 a=9cW_t1CCXrUA:10 a=s5jvgZ67dGcA:10 a=IkcTkHD0fZMA:10 a=MKtGQD3n3ToA:10 a=1oJP67jkp3AA:10 a=ZZnuYtJkoWoA:10 a=_DCmGSNqkacA:10 a=mV9VRH-2AAAA:8 a=FatMUXqTfv7Bo7mZQDEA:9 a=QEXdDO2ut3YA:10 a=BYZmueQyWBbq8FANvIHb:22 archived-at: Tue, 10 May 2016 19:12:04 -0000 On 10.05.2016 16:34, Branko Čibej wrote: > On 10.05.2016 16:29, stefan2@apache.org wrote: >> Author: stefan2 >> Date: Tue May 10 14:29:56 2016 >> New Revision: 1743195 >> >> URL: http://svn.apache.org/viewvc?rev=1743195&view=rev >> Log: >> Follow-up to r1743183: Unbreak FSFS svnadmin tests. >> >> * subversion/tests/cmdline/svntest/main.py >> (ensure_list): Converting strings and bytes to lists is a special case. >> Before that, each "element" in them would become a separate >> list element. >> >> Modified: >> subversion/trunk/subversion/tests/cmdline/svntest/main.py >> >> Modified: subversion/trunk/subversion/tests/cmdline/svntest/main.py >> URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/svntest/main.py?rev=1743195&r1=1743194&r2=1743195&view=diff >> ============================================================================== >> --- subversion/trunk/subversion/tests/cmdline/svntest/main.py (original) >> +++ subversion/trunk/subversion/tests/cmdline/svntest/main.py Tue May 10 14:29:56 2016 >> @@ -379,6 +379,8 @@ def ensure_list(item): >> "If ITEM is not already a list, convert it to a list." >> if isinstance(item, list): >> return item >> + elif isinstance(item, bytes) or isinstance(item, str): >> + return [ item ] >> else: >> return list(item) > > I think this is overkill and possibly wrong (and may have been wrong > before, too); the code should probably just be: > > if isinstance(item, list): > return item > else: > return [item] > > > There's no reason to have a third option, unless you also want to > convert tuples to lists — but in that case I'd prefer to have an > explicit check for 'isinstance(item, tuple)' instead of explicit checks > for strings and byte sequences. The list construction is there to convert from iterators (e.g. map, filter) to "proper" lists in Python 3. The strings special case is mainly carried over from various local incarnations of that logic. Is there a base class for iterators which is also known to Python 2 (doesn't need to be used there) ? -- Stefan^2.