[Lldb-commits] [lldb] r246709 - We want Python int or long to both be usable as-a tid_t for API purposes. Introduce a typemap to this effect

Pavel Labath via lldb-commits lldb-commits at lists.llvm.org
Thu Sep 3 03:38:32 PDT 2015


Hi,
this commit seems to break TestPythonOSPlugin.py on the windows
builtbot <http://lab.llvm.org:8011/builders/lldb-windows7-android/builds/1060>
and I expect any other 32-bit system. It fails with the error
"OverflowError: Python int too large to convert to C long", because
the test tries to pass a 64-bit tid_t and this does not fit when
sizeof(long) == 32. It sounds like the solution should be to use a
conversion to "long long" or some other 64-bit task, but i'm afraid my
swig-fu is not really up to the task. Should we use
PyInt_AsUnsignedLongLongMask() perhaps ?

pl

On 2 September 2015 at 21:53, Enrico Granata via lldb-commits
<lldb-commits at lists.llvm.org> wrote:
> Author: enrico
> Date: Wed Sep  2 15:53:43 2015
> New Revision: 246709
>
> URL: http://llvm.org/viewvc/llvm-project?rev=246709&view=rev
> Log:
> We want Python int or long to both be usable as-a tid_t for API purposes. Introduce a typemap to this effect
>
> Modified:
>     lldb/trunk/scripts/Python/python-typemaps.swig
>
> Modified: lldb/trunk/scripts/Python/python-typemaps.swig
> URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/Python/python-typemaps.swig?rev=246709&r1=246708&r2=246709&view=diff
> ==============================================================================
> --- lldb/trunk/scripts/Python/python-typemaps.swig (original)
> +++ lldb/trunk/scripts/Python/python-typemaps.swig Wed Sep  2 15:53:43 2015
> @@ -25,6 +25,18 @@
>    }
>  }
>
> +%typemap(in) lldb::tid_t {
> +    if (PyInt_Check($input))
> +        $1 = PyInt_AsLong($input);
> +    else if (PyLong_Check($input))
> +        $1 = PyLong_AsLong($input);
> +    else
> +    {
> +        PyErr_SetString(PyExc_ValueError, "Expecting an integer");
> +        return NULL;
> +    }
> +}
> +
>  %typemap(typecheck) char ** {
>    /* Check if is a list  */
>    $1 = 1;
>
>
> _______________________________________________
> lldb-commits mailing list
> lldb-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


More information about the lldb-commits mailing list