[New-bugs-announce] [issue22108] python c api wchar_t*/char* passing contradiction
Jonas Jelten
report at bugs.python.org
Wed Jul 30 19:10:42 CEST 2014
New submission from Jonas Jelten:
The documentation and the code example at
https://docs.python.org/3.5/extending/embedding.html#very-high-level-embedding
#include <Python.h>
int
main(int argc, char *argv[])
{
Py_SetProgramName(argv[0]); /* optional but recommended */
Py_Initialize();
PyRun_SimpleString("from time import time,ctime\n"
"print('Today is', ctime(time()))\n");
Py_Finalize();
return 0;
}
contradicts the actual implementation of the code:
http://hg.python.org/cpython/file/tip/Include/pythonrun.h#l25
which leads to compiler errors. To fix them, ugly wchar_t to char conversions are needed.
Also, I was hoping, Python 3.3 finally switched from wchar_t to char and UTF-8.
at least that's how I understood PEP 393 http://python.org/dev/peps/pep-0393/
see also:
http://stackoverflow.com/questions/21591908/python-3-3-c-string-handling-wchar-t-vs-char
=> Are the docs wrong (which i hope are not, the example is straightforward and simple-stupid with a char*),
or is cpython wrong?
----------
components: Unicode
messages: 224327
nosy: ezio.melotti, haypo, thejj
priority: normal
severity: normal
status: open
title: python c api wchar_t*/char* passing contradiction
type: compile error
versions: Python 3.3, Python 3.4, Python 3.5
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue22108>
_______________________________________
More information about the New-bugs-announce
mailing list