Re: [PATCH 5/7] py3k: the basestring and unicode types are removed in python 3
authorSebastian Spaeth <Sebastian@SSpaeth.de>
Mon, 2 Jan 2012 15:15:58 +0000 (16:15 +0100)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:41:33 +0000 (09:41 -0800)
0b/341e015fdbcfe52d48efaa0d18a2374f66bd80 [new file with mode: 0644]

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