Gentoo Archives: gentoo-portage-dev

From: Zac Medico <zmedico@g.o>
To: gentoo-portage-dev@l.g.o, "Michał Górny" <mgorny@g.o>
Subject: Re: [gentoo-portage-dev] [PATCH] Do not enable optimizations by default to work-around pycparser issue
Date: Sat, 02 Sep 2017 19:19:32
Message-Id: 396c44e1-62f1-11da-a8d6-a9b71c3e466c@gentoo.org
In Reply to: [gentoo-portage-dev] [PATCH] Do not enable optimizations by default to work-around pycparser issue by "Michał Górny"
1 On 09/02/2017 10:46 AM, Michał Górny wrote:
2 > dev-python/pycparser-2.18+ exposes a design flaw in dev-python/ply that
3 > makes it unable to work with -OO code. Remove the optimizations from
4 > Portage shebangs to prevent triggering the issue until we find a proper
5 > solution for it.
6 >
7 > Bug: https://bugs.gentoo.org/628386
8 > ---
9 > bin/clean_locks | 2 +-
10 > bin/dispatch-conf | 2 +-
11 > bin/ebuild | 2 +-
12 > bin/emaint | 2 +-
13 > bin/env-update | 2 +-
14 > bin/portageq | 2 +-
15 > tabcheck.py | 2 +-
16 > 7 files changed, 7 insertions(+), 7 deletions(-)
17 >
18 > diff --git a/bin/clean_locks b/bin/clean_locks
19 > index 13af06197..fb245972f 100755
20 > --- a/bin/clean_locks
21 > +++ b/bin/clean_locks
22 > @@ -1,4 +1,4 @@
23 > -#!/usr/bin/python -bO
24 > +#!/usr/bin/python -b
25
26 The diff shows -O, but the commit messages says -OO, so which one is it really?
27
28 Are we sure that it's worth it to load all of the __doc__ strings into
29 memory, given that we have alternative implementations for everything
30 that pycrypto provides?
31
32 For the record, I measure an increase of from 30248K to 31504K for -OO vs without when
33 importing all portage modules, tested as follows:
34
35 $ python3.6 -OO pym/portage/tests/runTests.py pym/portage/tests/lint/test_import_modules.py
36 testImportModules (portage.tests.lint.test_import_modules.ImportModulesTestCase) ... 30248
37
38 $ python3.6 -O pym/portage/tests/runTests.py pym/portage/tests/lint/test_import_modules.py
39 testImportModules (portage.tests.lint.test_import_modules.ImportModulesTestCase) ... 31468
40
41 $ python3.6 pym/portage/tests/runTests.py pym/portage/tests/lint/test_import_modules.py
42 testImportModules (portage.tests.lint.test_import_modules.ImportModulesTestCase) ... 31504
43
44 Using this patch:
45
46 diff --git a/pym/portage/tests/lint/test_import_modules.py b/pym/portage/tests/lint/test_import_modules.py
47 index fcdcb3b33..6350197eb 100644
48 --- a/pym/portage/tests/lint/test_import_modules.py
49 +++ b/pym/portage/tests/lint/test_import_modules.py
50 @@ -2,6 +2,7 @@
51 # Distributed under the terms of the GNU General Public License v2
52
53 from itertools import chain
54 +import resource
55
56 from portage.const import PORTAGE_PYM_PATH, PORTAGE_PYM_PACKAGES
57 from portage.tests import TestCase
58 @@ -24,6 +25,7 @@ class ImportModulesTestCase(TestCase):
59 if mod not in expected_failures:
60 self.assertTrue(False, "failed to import '%s': %s" % (mod, e))
61 del e
62 + print(resource.getrusage(resource.RUSAGE_SELF).ru_maxrss)
63
64 def _iter_modules(self, base_dir):
65 for parent, dirs, files in os.walk(base_dir):
66
67 --
68 Thanks,
69 Zac

Replies