[issue37926] regression: PySys_SetArgvEx(0, NULL, 0): SystemError: Python-3.8.0b3/Objects/unicodeobject.c:2089: bad argument to internal function
Miro Hrončok
report at bugs.python.org
Fri Aug 23 03:39:09 EDT 2019
New submission from Miro Hrončok <miro at hroncok.cz>:
There is a regression between Python 3.7 and 3.8 when using PySys_SetArgvEx(0, NULL, 0).
Consider this example:
#include <Python.h>
int main() {
Py_Initialize();
PySys_SetArgvEx(0, NULL, 0); /* HERE */
PyRun_SimpleString("from time import time,ctime\n"
"print('Today is', ctime(time()))\n");
Py_FinalizeEx();
return 0;
}
This works in 3.7 but no longer does in 3.8:
$ gcc $(python3.7-config --cflags --ldflags) example.c
$ ./a.out
Today is Fri Aug 23 07:59:52 2019
$ gcc $(python3.8-config --cflags --ldflags --embed) example.c
$ ./a.out
Fatal Python error: no mem for sys.argv
SystemError: /builddir/build/BUILD/Python-3.8.0b3/Objects/unicodeobject.c:2089: bad argument to internal function
Current thread 0x00007f12c78b9740 (most recent call first):
Aborted (core dumped)
The documentation https://docs.python.org/3/c-api/init.html#c.PySys_SetArgvEx explicitly mentions passing 0 to PySys_SetArgvEx:
"if argc is 0..."
So I guess this is not something you shouldn't do.
----------
components: Extension Modules
messages: 350262
nosy: hroncok, vstinner
priority: normal
severity: normal
status: open
title: regression: PySys_SetArgvEx(0, NULL, 0): SystemError: Python-3.8.0b3/Objects/unicodeobject.c:2089: bad argument to internal function
versions: Python 3.8
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue37926>
_______________________________________
More information about the Python-bugs-list
mailing list