New submission from Gerrit Ansmann <gansm...@uni-bonn.de>: 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 ---------- components: C API files: foo.c messages: 366647 nosy: Wrzlprmft priority: normal severity: normal status: open title: “unmatched paren” for space before parenthesis in Py_BuildValue versions: Python 3.7, Python 3.8 Added file: https://bugs.python.org/file49069/foo.c _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue40309> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com