This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author Sebastian
Recipients Sebastian
Date 2010-05-22.14:00:29
SpamBayes Score 5.632281e-06
Marked as misclassified No
Message-id <1274536832.39.0.220188636264.issue8787@psf.upfronthosting.co.za>
In-reply-to
Content
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]
History
Date User Action Args
2010-05-22 14:00:32Sebastiansetrecipients: + Sebastian
2010-05-22 14:00:32Sebastiansetmessageid: <1274536832.39.0.220188636264.issue8787@psf.upfronthosting.co.za>
2010-05-22 14:00:30Sebastianlinkissue8787 messages
2010-05-22 14:00:30Sebastiancreate