Patchwork dispatch: disable demandimport when invoking the debugger

login
register
mail settings
Submitter Jordi Gutiérrez Hermoso
Date Sept. 10, 2015, 1:31 p.m.
Message ID <4db58521c46a1202b058.1441891891@Iris>
Download mbox | patch
Permalink /patch/10459/
State Accepted
Headers show

Comments

Jordi Gutiérrez Hermoso - Sept. 10, 2015, 1:31 p.m.
# HG changeset patch
# User Jordi Gutiérrez Hermoso <jordigh@octave.org>
# Date 1441891810 14400
#      Thu Sep 10 09:30:10 2015 -0400
# Node ID 4db58521c46a1202b058a1a5c1e26d491c108188
# Parent  ea489d94e1dc1fc3dc1dcbef1c86c18c49605ed1
dispatch: disable demandimport when invoking the debugger

Turns out that demandimport confuses pudb, which does some pretty
complicated imports. I think it's reasonable to disable demandimport
here.
Augie Fackler - Sept. 10, 2015, 1:43 p.m.
On Thu, Sep 10, 2015 at 09:31:31AM -0400, Jordi Gutiérrez Hermoso wrote:
> # HG changeset patch
> # User Jordi Gutiérrez Hermoso <jordigh@octave.org>
> # Date 1441891810 14400
> #      Thu Sep 10 09:30:10 2015 -0400
> # Node ID 4db58521c46a1202b058a1a5c1e26d491c108188
> # Parent  ea489d94e1dc1fc3dc1dcbef1c86c18c49605ed1
> dispatch: disable demandimport when invoking the debugger

Yeah, that sounds smart. Queued, thanks.

>
> Turns out that demandimport confuses pudb, which does some pretty
> complicated imports. I think it's reasonable to disable demandimport
> here.
>
> diff --git a/mercurial/dispatch.py b/mercurial/dispatch.py
> --- a/mercurial/dispatch.py
> +++ b/mercurial/dispatch.py
> @@ -181,8 +181,8 @@ def _runcatch(req):
>                      debugtrace[debugger] == debugtrace['pdb']):
>                      ui.warn(_("%s debugger specified "
>                                "but its module was not found\n") % debugger)
> -
> -                debugtrace[debugger]()
> +                with demandimport.disabled():
> +                    debugtrace[debugger]()
>              try:
>                  return _dispatch(req)
>              finally:
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@selenic.com
> https://selenic.com/mailman/listinfo/mercurial-devel

Patch

diff --git a/mercurial/dispatch.py b/mercurial/dispatch.py
--- a/mercurial/dispatch.py
+++ b/mercurial/dispatch.py
@@ -181,8 +181,8 @@  def _runcatch(req):
                     debugtrace[debugger] == debugtrace['pdb']):
                     ui.warn(_("%s debugger specified "
                               "but its module was not found\n") % debugger)
-
-                debugtrace[debugger]()
+                with demandimport.disabled():
+                    debugtrace[debugger]()
             try:
                 return _dispatch(req)
             finally: