Return-Path: X-Original-To: notmuch@notmuchmail.org Delivered-To: notmuch@notmuchmail.org Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id B69C3429E21 for ; Mon, 2 Jan 2012 07:16:04 -0800 (PST) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: -0.09 X-Spam-Level: X-Spam-Status: No, score=-0.09 tagged_above=-999 required=5 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, T_MIME_NO_TEXT=0.01] autolearn=disabled Received: from olra.theworths.org ([127.0.0.1]) by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id elfSz+hsIhdd for ; Mon, 2 Jan 2012 07:16:04 -0800 (PST) Received: from homiemail-a19.g.dreamhost.com (mailbigip.dreamhost.com [208.97.132.5]) by olra.theworths.org (Postfix) with ESMTP id 3D0F1431FD0 for ; Mon, 2 Jan 2012 07:16:04 -0800 (PST) Received: from homiemail-a19.g.dreamhost.com (localhost [127.0.0.1]) by homiemail-a19.g.dreamhost.com (Postfix) with ESMTP id 90228604078; Mon, 2 Jan 2012 07:16:03 -0800 (PST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=SSpaeth.de; h=from:to:subject :in-reply-to:references:date:message-id:mime-version: content-type; q=dns; s=sspaeth.de; b=B5le8+4IYFdg53fAya3npDWPGHX /yn2YIp0qh3qZmQBQRc5dAsKDjj9REKHhtlkGSTC3G+/93k05c54ToPJUNPR9SLY n4n1RU8KNBo0H1j899H0ZSCNr30jDYWiulAFNJ2cCa+HpFW5scaPzPLd16a9ypLu n1oGsiPmkvcVMNPI= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=SSpaeth.de; h=from:to :subject:in-reply-to:references:date:message-id:mime-version: content-type; s=sspaeth.de; bh=YGlxQQ1wThvp91MrqIyDN36ZNJg=; b=I lTfynGpVTsUbouy5HhOkq2LB5gDn4EV7ijamuWre2pYyuse6vPDr/pz0aVUOW8oo 9Zo2uz/xwr/KhtOdh5AIJaq3uydSv7XYrrDIL9I+RPSsEspuXTRWYKX1AwjtRiPd UsKQEusGUXCWBQq/nQXDcC9yg29g38jys46VgsO/cA= Received: from spaetzbook.sspaeth.de (unknown [176.46.227.178]) (Authenticated sender: fax@sspaeth.de) by homiemail-a19.g.dreamhost.com (Postfix) with ESMTPA id E603B604061; Mon, 2 Jan 2012 07:16:01 -0800 (PST) Received: by spaetzbook.sspaeth.de (sSMTP sendmail emulation); Mon, 02 Jan 2012 16:15:59 +0100 From: Sebastian Spaeth To: Justus Winter <4winter@informatik.uni-hamburg.de>, notmuch@notmuchmail.org Subject: Re: [PATCH 5/7] py3k: the basestring and unicode types are removed in python 3 In-Reply-To: <1323860305-15802-6-git-send-email-4winter@informatik.uni-hamburg.de> References: <1323860305-15802-1-git-send-email-4winter@informatik.uni-hamburg.de> <1323860305-15802-6-git-send-email-4winter@informatik.uni-hamburg.de> User-Agent: Notmuch/0.10+58~g935365d (http://notmuchmail.org) Emacs/23.3.1 (x86_64-pc-linux-gnu) Date: Mon, 02 Jan 2012 16:15:58 +0100 Message-ID: <87hb0ekudt.fsf@SSpaeth.de> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha1; protocol="application/pgp-signature" X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Jan 2012 15:16:04 -0000 --=-=-= Content-Transfer-Encoding: quoted-printable Happy new year. Pushed patches 1-4 of this series so far. Looking fine, but ugh, the below seems like a rather ugly hack in a function that is probably called quite often. Isn't there a more pretty variant avoiding these sys.version_info checks all over the place? > @@ -200,9 +201,9 @@ def _str(value): >=20=20 > C++ code expects strings to be well formatted and > unicode strings to have no null bytes.""" > - if not isinstance(value, basestring): > + if not isinstance(value, basestring if sys.version_info[0] =3D=3D 2 = else str): > raise TypeError("Expected str or unicode, got %s" % str(type(val= ue))) > - if isinstance(value, unicode): > + if sys.version_info[0] =3D=3D 3 or isinstance(value, unicode): > return value.encode('UTF-8') > return value --=-=-= Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (GNU/Linux) iEYEARECAAYFAk8Byi4ACgkQVYX1jMgnoGK4SACfd/8d+iAeYWWFclRaKC4jfq7j BcEAn3K/dWWTo9iumTX5NjnO4XPLBdCB =XUSg -----END PGP SIGNATURE----- --=-=-=--