[issue8787] PySys_Get
Sebastian
report at bugs.python.org
Sat May 22 16:00:32 CEST 2010
New submission from Sebastian <python.10.webmaster at spamgourmet.com>:
Hi all,
I found a bug in the exception handler. When I
start the app without any arguments I get an
output I expect:
__main__:2:DeprecationWarning: Deprecated function.
When I run the app with arguments, the arguments
are printed somehow in the exception output:
-test=HALLO:1:DeprecationWarning: Deprecated function
Can anyone please confirm?
Bye, Seb
[code]
#include "Python/Python.h"
static PyObject *testfunc(PyObject *self, PyObject *args, PyObject *keywords)
{
PyErr_Warn(PyExc_DeprecationWarning, "Deprecated function.");
Py_RETURN_NONE;
}
static PyMethodDef testmod[] =
{
{"testfunc", (PyCFunction)testfunc, METH_NOARGS, "Prints out a text to stdout."},
{NULL}
};
int main (int argc, char **argv)
{
Py_Initialize();
PySys_SetArgv(argc, argv);
PyObject *mod = Py_InitModule4("testmod", testmod, "", NULL, PYTHON_API_VERSION);
if(mod == NULL) return -1;
PyRun_SimpleString( "import testmod\n"
"testmod.testfunc()");
Py_Finalize();
return 0;
}
[/code]
----------
components: None
messages: 106306
nosy: Sebastian
priority: normal
severity: normal
status: open
title: PySys_Get
type: behavior
versions: Python 2.6
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue8787>
_______________________________________
More information about the Python-bugs-list
mailing list