Patchwork [2,of,7] pycompat: fix demand import handling of Queue

login
register
mail settings
Submitter timeless@mozdev.org
Date April 8, 2016, 4:22 p.m.
Message ID <295d79e7d8dd3da8e9ce.1460132566@waste.org>
Download mbox | patch
Permalink /patch/14439/
State Accepted
Headers show

Comments

timeless@mozdev.org - April 8, 2016, 4:22 p.m.
# HG changeset patch
# User timeless <timeless@mozdev.org>
# Date 1460124185 0
#      Fri Apr 08 14:03:05 2016 +0000
# Node ID 295d79e7d8dd3da8e9ce33611916574d7ddc0ad8
# Parent  b4f3a8a501aa6134f5ef33fd5281cc731e18c0ad
pycompat: fix demand import handling of Queue

When demandimport is enabled, simply importing a non existent module does
not trigger ImportError, a property access is necessary.

Patch

diff --git a/mercurial/pycompat.py b/mercurial/pycompat.py
--- a/mercurial/pycompat.py
+++ b/mercurial/pycompat.py
@@ -12,6 +12,7 @@ 
 
 try:
     import Queue as _queue
+    _queue.Queue
 except ImportError:
     import queue as _queue
 empty = _queue.Empty