This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author amc1
Recipients amc1, ggenellina
Date 2008-12-18.01:43:42
SpamBayes Score 5.217263e-08
Marked as misclassified No
Message-id <1229564624.92.0.279833396059.issue4643@psf.upfronthosting.co.za>
In-reply-to
Content
In terms of patching scanvars, I came up with the following solution:

ORIGINAL:
if parent is not __UNDEF__:
    value = getattr(parent, token, __UNDEF__)
    vars.append((prefix + token, prefix, value))

SOLUTION:
if parent is not __UNDEF__:
    try:
        value = getattr(parent, token, __UNDEF__)
    except Exception:
        value = __UNDEF__
    vars.append((prefix + token, prefix, value))

I think this makes the most sense - it requires a small change, and it
won't have any strange side effect. One slightly undesirable aspect is
that for an attribute value which could not be determined (due to this
problem), it will say that it was "undefined", which isn't entirely
accurate.

My initial patch changed value to be a string to be "could not determine
value", but if the line of code looked like this:
    print 'B:', weird.b.upper()

Then for something which shouldn't work, it would determine that the
value of weird.b.upper is the string method - which isn't what we're after.

So I would recommend my original patch (as described above) as the best
solution.
History
Date User Action Args
2008-12-18 01:43:45amc1setrecipients: + amc1, ggenellina
2008-12-18 01:43:44amc1setmessageid: <1229564624.92.0.279833396059.issue4643@psf.upfronthosting.co.za>
2008-12-18 01:43:44amc1linkissue4643 messages
2008-12-18 01:43:42amc1create