Patchwork [1,of,4] py3: replace a StandardError reference

login
register
mail settings
Submitter Matt Harbison
Date Sept. 27, 2018, 3:12 a.m.
Message ID <88db05d80c8b83808618.1538017973@Envy>
Download mbox | patch
Permalink /patch/35128/
State Accepted
Headers show

Comments

Matt Harbison - Sept. 27, 2018, 3:12 a.m.
# HG changeset patch
# User Matt Harbison <matt_harbison@yahoo.com>
# Date 1538009368 14400
#      Wed Sep 26 20:49:28 2018 -0400
# Node ID 88db05d80c8b8380861864e922ebea7567f372c2
# Parent  6037974f8abac9b5299eb6d18760c39b191d6ad5
py3: replace a StandardError reference

This doesn't exist on py3, and the standard way of handling this seems to be to
catch both exceptions.

Patch

diff --git a/hgext/fastannotate/__init__.py b/hgext/fastannotate/__init__.py
--- a/hgext/fastannotate/__init__.py
+++ b/hgext/fastannotate/__init__.py
@@ -155,7 +155,7 @@  def _flockavailable():
     try:
         import fcntl
         fcntl.flock
-    except StandardError:
+    except (AttributeError, ImportError):
         return False
     else:
         return True