Gentoo Archives: gentoo-portage-dev

From: Zac Medico <zmedico@g.o>
To: gentoo-portage-dev@l.g.o
Subject: Re: [gentoo-portage-dev] [PATCH] repoman: Add file encoding sheband for py-2.7 compatibility
Date: Sat, 03 Oct 2015 17:19:50
Message-Id: 56100E2D.4030609@gentoo.org
In Reply to: [gentoo-portage-dev] [PATCH] repoman: Add file encoding sheband for py-2.7 compatibility by Brian Dolbec
1 On 10/03/2015 09:08 AM, Brian Dolbec wrote:
2 > From 841660a8064012b734b5c62e1c1e3e1132403d5c Mon Sep 17 00:00:00 2001
3 > From: Brian Dolbec <dolsen@g.o>
4 > Date: Sat, 3 Oct 2015 08:57:55 -0700
5 > Subject: [PATCH] repoman: Add file encoding sheband for py-2.7 compatibility
6 > (bug 562108)
7 >
8 > This makes python treat all string declarations as unicode strings.
9 > This prevents errors like getting an unicode string via the command line and it being
10 > added to an ascii string.
11 >
12 > X-Gentoo-bug: 562108
13 > X-Gentoo-bug-url: https://bugs.gentoo.org/show_bug.cgi?id=562108
14 > ---
15
16 I don't have anything against adding these unicode shebangs, but they
17 won't fix the problem, because they only change the interpreted encoding
18 of literals embedded in python files. Under python2, that means the
19 literals are still plain bytes, just with a different encoding. You have
20 to use 'from __future__ import unicode_literals' if you really want
21 string literals to behave as unicode strings.
22 --
23 Thanks,
24 Zac

Replies