From edfd7cd8dadab055dc1c3585bdaa97752c450d05 Mon Sep 17 00:00:00 2001 From: Aaron Gable Date: Tue, 14 Mar 2017 17:01:33 -0700 Subject: [PATCH] Workaround Python Issue 26083 in upload.py This issue is fixed in Python 2.7.12, but we don't guarantee that we use that version everywhere. The root issue is that, on certain platforms (e.g. Mac), the exception indicating that the underlying command (e.g. 'hg') was not found is too large, and loading the pickle representing the exception fails. This CL catches this specific exception and treats it identically to the OS properly raising a 'command not found' code. BUG=699173 Change-Id: I0483ab0d1d0b6a3dfcfd26f2d9644817b5b5284f Reviewed-on: https://chromium-review.googlesource.com/455537 Reviewed-by: Andrii Shyshkalov Commit-Queue: Aaron Gable --- third_party/upload.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/third_party/upload.py b/third_party/upload.py index 94935bf40..d48cb5dc1 100755 --- a/third_party/upload.py +++ b/third_party/upload.py @@ -2157,6 +2157,10 @@ def GuessVCSName(options): except OSError as e: if e.errno != errno.ENOENT: # command not found code raise + except ValueError as e: + # Workaround for https://bugs.python.org/issue26083 + if e.message != "insecure string pickle": + raise # Mercurial has a command to get the base directory of a repository # Try running it, but don't die if we don't have hg installed.