[Lldb-commits] [lldb] r162228 - in /lldb/trunk: scripts/Python/python-typemaps.swig test/python_api/default-constructor/sb_debugger.py
Johnny Chen
johnny.chen at apple.com
Mon Aug 20 15:32:45 PDT 2012
I think that's a good point.
Thanks.
On Aug 20, 2012, at 3:29 PM, Filipe Cabecinhas <filcab at gmail.com> wrote:
> Thanks.
> Do you think it would be better to never error out when None was passed, like other functions?
>
> Regards,
>
> Filipe
>
> P.S: I really don't like to make error information disappear, but it seems to be what many people that use Python do…
>
>
> On Monday, August 20, 2012 at 10:16 PM, Johnny Chen wrote:
>
>> Author: johnny
>> Date: Mon Aug 20 16:16:02 2012
>> New Revision: 162228
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=162228&view=rev
>> Log:
>> Fix a crash (_wrap_SBDebugger_SetInputFileHandle -> PyString_AsString) running the test suite.
>> Also modify the boundary condition test case SBDebugger.DispatchInput(None) to be wrapped inside a try-except clause for now.
>>
>> Modified:
>> lldb/trunk/scripts/Python/python-typemaps.swig
>> lldb/trunk/test/python_api/default-constructor/sb_debugger.py
>>
>> Modified: lldb/trunk/scripts/Python/python-typemaps.swig
>> URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/Python/python-typemaps.swig?rev=162228&r1=162227&r2=162228&view=diff
>> ==============================================================================
>> --- lldb/trunk/scripts/Python/python-typemaps.swig (original)
>> +++ lldb/trunk/scripts/Python/python-typemaps.swig Mon Aug 20 16:16:02 2012
>> @@ -351,9 +351,15 @@
>> }
>>
>> %typemap(in) FILE * {
>> - if (!PyFile_Check($input)) {
>> + if ($input == Py_None)
>> + $1 = NULL;
>> + else if (!PyFile_Check($input)) {
>> int fd = PyObject_AsFileDescriptor($input);
>> PyObject *py_mode = PyObject_GetAttrString($input, "mode");
>> + if (!py_mode) {
>> + PyErr_SetString(PyExc_TypeError,"not a file-like object");
>> + return NULL;
>> + }
>> const char *mode = PyString_AsString(py_mode);
>> if (-1 != fd && mode) {
>> FILE *f;
>> @@ -366,7 +372,8 @@
>> return NULL;
>> }
>> }
>> - $1 = PyFile_AsFile($input);
>> + else
>> + $1 = PyFile_AsFile($input);
>> }
>>
>> %typemap(out) FILE * {
>>
>> Modified: lldb/trunk/test/python_api/default-constructor/sb_debugger.py
>> URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/default-constructor/sb_debugger.py?rev=162228&r1=162227&r2=162228&view=diff
>> ==============================================================================
>> --- lldb/trunk/test/python_api/default-constructor/sb_debugger.py (original)
>> +++ lldb/trunk/test/python_api/default-constructor/sb_debugger.py Mon Aug 20 16:16:02 2012
>> @@ -32,7 +32,10 @@
>> obj.GetSourceManager()
>> obj.SetSelectedTarget(lldb.SBTarget())
>> obj.SetCurrentPlatformSDKRoot("tmp/sdk-root")
>> - obj.DispatchInput(None, 0)
>> + try:
>> + obj.DispatchInput(None)
>> + except Exception:
>> + pass
>> obj.DispatchInputInterrupt()
>> obj.DispatchInputEndOfFile()
>> obj.PushInputReader(lldb.SBInputReader())
>>
>>
>> _______________________________________________
>> lldb-commits mailing list
>> lldb-commits at cs.uiuc.edu (mailto:lldb-commits at cs.uiuc.edu)
>> http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits
>
>
>
More information about the lldb-commits
mailing list