Matt Wozniski <godlyg...@gmail.com> added the comment:

> 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.

----------
nosy: +godlygeek

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue45325>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to