[New-bugs-announce] [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

#include "Python/Python.h"

static PyObject *testfunc(PyObject *self, PyObject *args, PyObject *keywords)
	PyErr_Warn(PyExc_DeprecationWarning, "Deprecated function.");

static PyMethodDef testmod[] =
	{"testfunc", (PyCFunction)testfunc, METH_NOARGS, "Prints out a text to stdout."},

int main (int argc, char **argv)
	PySys_SetArgv(argc, argv);
	PyObject *mod = Py_InitModule4("testmod", testmod, "", NULL, PYTHON_API_VERSION);
	if(mod == NULL) return -1;
	PyRun_SimpleString(	"import testmod\n"
	return 0;

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>

More information about the New-bugs-announce mailing list