Gentoo Archives: gentoo-portage-dev

From: "Michał Górny" <mgorny@g.o>
To: gentoo-portage-dev@l.g.o
Subject: Re: [gentoo-portage-dev] [PATCH] Do not enable optimizations by default to work-around pycparser issue
Date: Sat, 02 Sep 2017 21:36:42
Message-Id: 1504388196.13997.8.camel@gentoo.org
In Reply to: Re: [gentoo-portage-dev] [PATCH] Do not enable optimizations by default to work-around pycparser issue by "Michał Górny"
1 W dniu sob, 02.09.2017 o godzinie 23∶05 +0200, użytkownik Michał Górny
2 napisał:
3 > W dniu sob, 02.09.2017 o godzinie 12∶19 -0700, użytkownik Zac Medico
4 > napisał:
5 > > On 09/02/2017 10:46 AM, Michał Górny wrote:
6 > > > dev-python/pycparser-2.18+ exposes a design flaw in dev-python/ply that
7 > > > makes it unable to work with -OO code. Remove the optimizations from
8 > > > Portage shebangs to prevent triggering the issue until we find a proper
9 > > > solution for it.
10 > > >
11 > > > Bug: https://bugs.gentoo.org/628386
12 > > > ---
13 > > > bin/clean_locks | 2 +-
14 > > > bin/dispatch-conf | 2 +-
15 > > > bin/ebuild | 2 +-
16 > > > bin/emaint | 2 +-
17 > > > bin/env-update | 2 +-
18 > > > bin/portageq | 2 +-
19 > > > tabcheck.py | 2 +-
20 > > > 7 files changed, 7 insertions(+), 7 deletions(-)
21 > > >
22 > > > diff --git a/bin/clean_locks b/bin/clean_locks
23 > > > index 13af06197..fb245972f 100755
24 > > > --- a/bin/clean_locks
25 > > > +++ b/bin/clean_locks
26 > > > @@ -1,4 +1,4 @@
27 > > > -#!/usr/bin/python -bO
28 > > > +#!/usr/bin/python -b
29 > >
30 > > The diff shows -O, but the commit messages says -OO, so which one is it really?
31 >
32 > Yes, it's a curious problem. -OO is the one breaking it but py<3.5 seems
33 > to be happy to load -OO files with -O:
34 >
35 > $ python2.7 -O -c 'import pycparser; print(pycparser.__file__)'
36 > /usr/lib64/python2.7/site-packages/pycparser/c_parser.py:20: RuntimeWarning: parsing methods must have __doc__ for pycparser to work properly
37 > class CParser(PLYParser):
38 > /usr/lib64/python2.7/site-packages/pycparser/__init__.pyo
39 >
40 > $ python3.4 -O -c 'import pycparser; print(pycparser.__cached__)'
41 > /usr/lib64/python3.4/site-packages/pycparser/c_parser.py:20: RuntimeWarning: parsing methods must have __doc__ for pycparser to work properly
42 > class CParser(PLYParser):
43 > /usr/lib64/python3.4/site-packages/pycparser/__pycache__/__init__.cpython-34.pyo
44 >
45 > This doesn't seem to be the case anymore for py3.5+:
46 >
47 > $ python3.5 -O -c 'import pycparser; print(pycparser.__cached__)'
48 > /usr/lib64/python3.5/site-packages/pycparser/__pycache__/__init__.cpython-35.opt-1.pyc
49
50 My roundabout thinking here was really silly. I was mistaking -O/-OO for
51 .pyc/.pyo. For the record, the correct explanation:
52
53 Python < 3.5 supports only either -O or -OO, and compiles both levels to
54 the same .pyo files. So if we compiled the relevant packages with -OO,
55 then -O implicitly meant -OO.
56
57 --
58 Best regards,
59 Michał Górny