Author jj
Recipients ezio.melotti, jj, vstinner
Date 2014-07-30.17:10:42
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1406740242.49.0.577134590981.issue22108@psf.upfronthosting.co.za>
In-reply-to
Content
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?
History
Date User Action Args
2014-07-30 17:10:42jjsetrecipients: + jj, vstinner, ezio.melotti
2014-07-30 17:10:42jjsetmessageid: <1406740242.49.0.577134590981.issue22108@psf.upfronthosting.co.za>
2014-07-30 17:10:42jjlinkissue22108 messages
2014-07-30 17:10:42jjcreate