Re: [PATCH] Fix execution of when executing via "python -m xxx meld"



On 11 April 2012 16:48, Peter Tyser <ptyser gmail com> wrote:
> Previously Meld would fail if python was invoked with other modules
> called out on the command line.  For example if using the "trace"
> module:
<snip>

This looks like a problem that's specific to certain modules... maybe
just those using runpy? I know, for example, that (c)profile works
fine as I use it all the time.

For that matter, I can't get your test case to fail on my machine
running 2.7. I see that some additions were made to runpy that look
like they're aimed at addressing this kind of case, so I'm guessing
it's just the python version at work here.

> bin/meld previously used the "__file__" variable to find out where the
> meld source was located.  However when using the "-m" parameter to
> Python, the "__file__" variable would point to Python's module loader
> "runpy" which resulted in the above error.  Using argv[0] to determine
> Meld's location should be more flexible and fixes the error.

I'm not a fan of the argv[0] thing to be honest. Using __file__ feels
like the Right Way to do it, and absent evidence to the contrary I'd
like to stick to it. I might be open to adding a runpy-specific
workaround, but given that this is only a problem for some modules and
it doesn't even seem to be a problem from 2.7 on, I'm not convinced
that it's worth it.

For what it's worth, I'm considering 2.7 feature use to be fair game
from 1.7.0 on, so this would have to be cherry-picked onto a 1.6
branch (and yes, there might actually be releases from a stable
branch! maybe).

cheers,
Kai


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]