Message366647
According to the C-API documentation¹ for `Py_BuildValue`:
> The characters space, tab, colon and comma are ignored in format strings (but not within format units such as s#). This can be used to make long format strings a tad more readable.
However format strings such as `"(d )"` cause the error:
> Unmatched paren in format
By contrast `"( d)"` and `"(d d)"` cause no problems. I therefore assume that tuples are not considered “format units” in the sense of the above quote and this is a bug. Alternatively, the documentation needs clarification.
I could reproduce this problem with Python 3.7 and 3.8. I did not try other versions.
Appended is a minimal C extension exhibiting the problem. I compile and run with:
gcc -fPIC -I/usr/include/python3.8 -c foo.c -o foo.o
gcc -shared foo.o -o foo.so
python3.8 -c "import foo; foo.bar()"
----
¹ https://docs.python.org/3/c-api/arg.html |
|
Date |
User |
Action |
Args |
2020-04-17 08:54:27 | Wrzlprmft | set | recipients:
+ Wrzlprmft |
2020-04-17 08:54:27 | Wrzlprmft | set | messageid: <1587113667.76.0.930110442335.issue40309@roundup.psfhosted.org> |
2020-04-17 08:54:27 | Wrzlprmft | link | issue40309 messages |
2020-04-17 08:54:26 | Wrzlprmft | create | |
|