From mboxrd@z Thu Jan 1 00:00:00 1970 From: Cyril Roelandt Subject: bug#22533: Non-determinism in python-3 ".pyc" bytecode Date: Wed, 30 Mar 2016 01:11:47 +0200 Message-ID: <56FB0BB3.5040303@gmail.com> References: <20160202051544.GA11744@jasmine> <87powezvyo.fsf@gnu.org> <20160204231708.GA1297@jasmine> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------060100070105040008030705" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:51131) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1al2or-0003tp-Th for bug-guix@gnu.org; Tue, 29 Mar 2016 19:13:06 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1al2oo-0000Xt-M7 for bug-guix@gnu.org; Tue, 29 Mar 2016 19:13:05 -0400 Received: from debbugs.gnu.org ([208.118.235.43]:47100) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1al2oo-0000Xp-JY for bug-guix@gnu.org; Tue, 29 Mar 2016 19:13:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1al2oo-0007R1-GH for bug-guix@gnu.org; Tue, 29 Mar 2016 19:13:02 -0400 Sender: "Debbugs-submit" Resent-Message-ID: Received: from eggs.gnu.org ([2001:4830:134:3::10]:50918) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1al2ni-0003na-Ex for bug-guix@gnu.org; Tue, 29 Mar 2016 19:11:55 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1al2nf-00087S-9N for bug-guix@gnu.org; Tue, 29 Mar 2016 19:11:54 -0400 Received: from mail-wm0-x22c.google.com ([2a00:1450:400c:c09::22c]:34838) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1al2nf-00087K-2H for bug-guix@gnu.org; Tue, 29 Mar 2016 19:11:51 -0400 Received: by mail-wm0-x22c.google.com with SMTP id 191so68952326wmq.0 for ; Tue, 29 Mar 2016 16:11:50 -0700 (PDT) Received: from [192.168.0.10] (tal33-3-82-233-82-24.fbx.proxad.net. [82.233.82.24]) by smtp.googlemail.com with ESMTPSA id w184sm1407375wmb.1.2016.03.29.16.11.48 for (version=TLSv1/SSLv3 cipher=OTHER); Tue, 29 Mar 2016 16:11:49 -0700 (PDT) In-Reply-To: <20160204231708.GA1297@jasmine> List-Id: Bug reports for GNU Guix List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-guix-bounces+gcggb-bug-guix=m.gmane.org@gnu.org Sender: bug-guix-bounces+gcggb-bug-guix=m.gmane.org@gnu.org To: 22533@debbugs.gnu.org This is a multi-part message in MIME format. --------------060100070105040008030705 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 8bit Here is a version of the patch that works with the upstream Python, but that I cannot get to work with our Guix recipe. Could you test it and tell me what you think? I intend to push this to CPython. Cyril. --------------060100070105040008030705 Content-Type: text/x-diff; name="upstream.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="upstream.patch" diff --git a/Lib/importlib/_bootstrap.py b/Lib/importlib/_bootstrap.py index c4ee41a..d9885c9 100644 --- Lib/importlib/_bootstrap.py +++ Lib/importlib/_bootstrap.py @@ -1443,7 +1443,8 @@ class SourceLoader(_LoaderBasics): Implementing this method allows the loader to read bytecode file= s. Raises IOError when the path cannot be handled. """ - return {'mtime': self.path_mtime(path)} + return {'mtime': float(_os.environ.get(b'SOURCE_DATE_EPOCH', + st.st_mtime))} =20 def _cache_bytecode(self, source_path, cache_path, data): """Optional method which writes data (bytes) to a file path (a s= tr). @@ -1580,7 +1581,10 @@ class SourceFileLoader(FileLoader, SourceLoader): def path_stats(self, path): """Return the metadata for the path.""" st =3D _path_stat(path) - return {'mtime': st.st_mtime, 'size': st.st_size} + return { + 'mtime': float(_os.environ.get(b'SOURCE_DATE_EPOCH', st.st_= mtime)), + 'size': st.st_size + } =20 def _cache_bytecode(self, source_path, bytecode_path, data): # Adapt between the two APIs --------------060100070105040008030705--