Gentoo Archives: gentoo-portage-dev

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