On Thu, 2013-02-21 at 08:01 -0500, Chris Lumens wrote:
> diff --git a/anaconda b/anaconda
> index 0e0fdba..0eb90c4 100755
> --- a/anaconda
> +++ b/anaconda
> @@ -31,6 +31,7 @@
> # This toplevel file is a little messy at the moment...
>
> import atexit, sys, os, re, time, subprocess
> +import threading
> from tempfile import mkstemp
> # keep up with process ID of the window manager if we start it
> wm_pid = None
> @@ -963,9 +964,10 @@ if __name__ == "__main__":
> # sets yum's multilib_policy to "all" (as opposed to
"best")
> ksdata.packages.multiLib = opts.multiLib
>
> + cur_thread_id = threading.current_thread().ident
> from pyanaconda import exception
> # comment out the next line to make exceptions non-fatal
> - anaconda.mehConfig = exception.initExceptionHandling(anaconda)
> + anaconda.mehConfig = exception.initExceptionHandling(anaconda, cur_thread_id)
>
> # add our own additional signal handlers
> signal.signal(signal.SIGUSR1, lambda signum, frame:
Relying on thread ID kind of concerns me, given the following from the
python docs:
Thread identifiers may be recycled when a thread exits and another
thread is created. The identifier is available even after the thread
has exited.
However in this one case (the main thread), I think we can get away with
it. This was one reason why I added the ThreadManager object, to be
able to reference via name instead of ID.
Yeah I don't like it much too, but I
guess for the main thread it should
be okay.
> - def handleException(self, (ty, value, tb), obj):
> + def run_handleException(self, args_tuple):
> + """
> + Helper method with one argument only so that it can be registered
> + with GLib.idle_add() to run on idle or called from a handler.
>
> - def run_handleException_on_idle(args_tuple):
> - """
> - Helper function with one argument only so that it can be registered
> - with GLib.idle_add() to run on idle.
> + @param args_tuple: ((ty, value, tb), obj)
>
> - @param args_tuple: ((ty, value, tb), obj)
> + """
We've now got so much shipping around of (ty, val, tb) and then
sometimes obj that I wonder if we should just go ahead and pack them up
into something more handy. A NamedTuple
(
http://docs.python.org/2/library/collections.html#collections.namedtuple)
might be just the thing to use.
That's a neat idea! I'll change this also
in python-meh and send patches
for both. The anacoda part can be then squashed with this patch.
--
Vratislav Podzimek
Anaconda Rider | Red Hat, Inc. | Brno - Czech Republic