kastiglione added inline comments.
================
Comment at: lldb/examples/python/crashlog.py:422-425
+ # When `__new__` is overriden, if the returned type is the same
+ # as the class type, or related to it, the `__init__` method is
+ # automatically called after `__new__`. If the return type is not
+ # related, then the `__init__` method is not called.
----------------
Is this comment needed (maybe it was in an earlier draft)? The body of the
function isn't calling init, so it might be fine to not have it.
================
Comment at: lldb/examples/python/crashlog.py:434
except CrashLogFormatException:
- return TextCrashLogParser(debugger, path, verbose).parse()
+ return object().__new__(TextCrashLogParser)
----------------
I have not seen the `object().__new__(SomeClass)` syntax. Why is it being used
for `TextCrashLogParser` but not `JSONCrashLogParser`? Also, `__new__` is a
static method, could it be `object.__new__(...)`? Or is there a subtly that
requires an `object` instance? Somewhat related, would it be better to say
`super().__new__(...)`?
Also: one class construction explicitly forwards the arguments, the other does
not. Is there a reason both aren't implicit (or both explicit)?
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D131085/new/
https://reviews.llvm.org/D131085
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits