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:13:24 +0200 Message-ID: <56FB0C14.9010909@gmail.com> References: <20160202051544.GA11744@jasmine> <87powezvyo.fsf@gnu.org> <20160204231708.GA1297@jasmine> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------030500010504060804020309" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:51452) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1al2pp-00045I-7y for bug-guix@gnu.org; Tue, 29 Mar 2016 19:14:06 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1al2pm-0000tN-2S for bug-guix@gnu.org; Tue, 29 Mar 2016 19:14:05 -0400 Received: from debbugs.gnu.org ([208.118.235.43]:47104) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1al2pl-0000tJ-VJ for bug-guix@gnu.org; Tue, 29 Mar 2016 19:14:01 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1al2pl-0007Sn-Rv for bug-guix@gnu.org; Tue, 29 Mar 2016 19:14:01 -0400 Sender: "Debbugs-submit" Resent-Message-ID: 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: Leo Famulari , Ludovic =?UTF-8?Q?Court=C3=A8s?= Cc: 22533@debbugs.gnu.org This is a multi-part message in MIME format. --------------030500010504060804020309 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit 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. --------------030500010504060804020309 Content-Type: text/x-diff; name="upstream.patch" Content-Transfer-Encoding: 7bit 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 files. 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))} def _cache_bytecode(self, source_path, cache_path, data): """Optional method which writes data (bytes) to a file path (a str). @@ -1580,7 +1581,10 @@ class SourceFileLoader(FileLoader, SourceLoader): def path_stats(self, path): """Return the metadata for the path.""" st = _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 + } def _cache_bytecode(self, source_path, bytecode_path, data): # Adapt between the two APIs --------------030500010504060804020309--