Details
Details
- Reviewers
clayborg granata.enrico - Commits
- rGb88703c03790: [Python] Allow PyLong values in integer lists (when converting to C lists)
rLLDB241208: [Python] Allow PyLong values in integer lists (when converting to C lists)
rL241208: [Python] Allow PyLong values in integer lists (when converting to C lists)
Diff Detail
Diff Detail
Event Timeline
Comment Actions
Looks good. Not sure if we also want to handle booleans? Should be easy to add support for bools.
Comment Actions
At a glance, it looks like you might be able to use PyLong_AsUnsignedLongLong() also for bool values.
If so, that might be a nicer code flow instead of the exact pointer equality check
if (PyLong || PyBool) { PyLong_AsUnsigned.... }
But if that actually doesn't work, looks good to me
Comment Actions
Enrico prompted me to do this experiment:
>>> isinstance(True, long) False >>> isinstance(False, long) False >>> isinstance(False, int) True >>> isinstance(True, int) True
So, bools were allowed even before this patch! I have taken out the additional
PyBool check and reverted to the original version of the patch. Will put it in
shortly.