tag 418108 patch thanks Forwarding to the bug tracker... thanks!
---------- Forwarded Message ----------
Subject: Bug#418108: python-central: UnboundLocalError: local
variable 'config' referenced before assignment
Date: Saturday 07 April 2007 08:04
From: [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Mr. Landaker,
I am not registered with the debian bugs list, but I think that I found a
fix for the below referenced bug if you want to relay that to the package
maintainers:
Wesley J. Landaker wrote:
> Package: python-central
> Version: 0.5.13
> Severity: serious
>
> Trying to upgrade fails. Trying to rerun looks like this:
>
> # dpkg --configure -a
> Setting up python2.4-minimal (2.4.4-3) ...
> Linking and byte-compiling packages for runtime python2.4...
> Traceback (most recent call last):
> File "/usr/bin/pycentral", line 1373, in ?
> main()
> File "/usr/bin/pycentral", line 1363, in main
> if action.check_args(global_options):
> File "/usr/bin/pycentral", line 971, in check_args
> for rt in get_installed_runtimes():
> File "/usr/bin/pycentral", line 196, in get_installed_runtimes
> supported = pyversions.supported_versions()
> File "/usr/share/pycentral-data/pyversions.py", line 98, in
> supported_versions
> value = read_default('supported-versions')
> File "/usr/share/pycentral-data/pyversions.py", line 22, in
> read_default value = config.get('DEFAULT', name)
> UnboundLocalError: local variable 'config' referenced before assignment
Quoted from:
http://www.nabble.com/Bug-418108%3A-python-central%3A-UnboundLocalError%3A-
local-variable-%27config%27-referenced-before-assignment-tf3539046.html#a98
79270
The following patch should work:
--- pyversions.py 2007-04-07 09:58:05.000000000 -0400
+++ pyversions-fixed.py 2007-04-07 09:58:42.000000000 -0400
@@ -19,7 +19,7 @@
_defaults = config
if _defaults and name:
try:
- value = config.get('DEFAULT', name)
+ value = _defaults.get('DEFAULT', name)
except NoOptionError:
raise ValueError
return value
The problem is that a previous invocation of read_default set the global
variable `_defaults' which caused the second invocation of read_default to
bypass the setting of the local variable `config'. Clearly the intent was
for the global `_defaults' to hold a reference to the `config' object
generated in the original run, but somehow the local `config' was used
instead.
Regards,
Ryan Van Wagoner
-------------------------------------------------------
--
Wesley J. Landaker <[EMAIL PROTECTED]> <xmpp:[EMAIL PROTECTED]>
OpenPGP FP: 4135 2A3B 4726 ACC5 9094 0097 F0A9 8A4C 4CD6 E3D2
pgpwFc9t6s4xm.pgp
Description: PGP signature

