New submission from Sebastian <python.10.webmas...@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 <rep...@bugs.python.org>
<http://bugs.python.org/issue8787>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to