Message402921
> but there is a catch -- the arguments should be a C int
Or a type that promotes to int. If you pass a C short or char, or a C++ bool, it is implicitly promoted to int.
> so you will need to write "expr ? 1 : 0"
Or alternatively "!!expr"
> which is not much better than "expr ? Py_True : Py_False"
I had to write that recently after reading through the Py_BuildValue docs twice to make sure I wasn't missing a format code I could use. It's a strange omission, especially because 'p' exists for PyArg_Parse. I'd very much like to see this change. |
|
Date |
User |
Action |
Args |
2021-09-29 23:25:08 | godlygeek | set | recipients:
+ godlygeek, vstinner, serhiy.storchaka, pablogsal |
2021-09-29 23:25:08 | godlygeek | set | messageid: <1632957908.94.0.350786681365.issue45325@roundup.psfhosted.org> |
2021-09-29 23:25:08 | godlygeek | link | issue45325 messages |
2021-09-29 23:25:08 | godlygeek | create | |
|