[Lldb-commits] [PATCH] D14453: Python 3 - Fix some portability issues with class / instance attributes
Zachary Turner via lldb-commits
lldb-commits at lists.llvm.org
Fri Nov 6 10:24:53 PST 2015
zturner created this revision.
zturner added reviewers: tfiala, labath, tberghammer.
zturner added a subscriber: lldb-commits.
TBH I'm honestly not sure what the problem was before, or why this fixes
it. But what I can tell from debugging is that under Py3,
`sortMethodsUsing` is treated as a class attribute, but it was being
accessed as `self.sortMethodsUsing`. What the full implications of this
are I don't quite know, but the symptom here was that the value we were
assigning to it -- the global lambda `cmp_` -- was being treated as a
bound method instead of a global method. So it was expecting to be called
with a `self` argument, and I got an exception saying the method expected 3
arguments but received 2.
Why exactly this happens in Python 3, and why exactly this *doesn't*
happen in Python 2, even though the syntax was identical in both cases
are not clear to me.
http://reviews.llvm.org/D14453
Files:
third_party/Python/module/unittest2/unittest2/__init__.py
third_party/Python/module/unittest2/unittest2/loader.py
third_party/Python/module/unittest2/unittest2/test/test_loader.py
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D14453.39555.patch
Type: text/x-patch
Size: 6558 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20151106/387e0d91/attachment.bin>
More information about the lldb-commits
mailing list