Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #26384
| Path | csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!npeer02.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail |
|---|---|
| From | rahul <rahul03535@gmail.com> |
| Newsgroups | comp.lang.python |
| Subject | C extension module doesn't throw exception after setting error indicator through PyErr_SetString() |
| Date | Thu, 2 Aug 2012 01:57:27 -0700 (PDT) |
| Organization | http://groups.google.com |
| Lines | 24 |
| Message-ID | <fa944ed7-8101-4b2f-a49a-363eb8d05d1d@googlegroups.com> (permalink) |
| NNTP-Posting-Host | 122.248.161.59 |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=ISO-8859-1 |
| X-Trace | posting.google.com 1343897847 16190 127.0.0.1 (2 Aug 2012 08:57:27 GMT) |
| X-Complaints-To | groups-abuse@google.com |
| NNTP-Posting-Date | Thu, 2 Aug 2012 08:57:27 +0000 (UTC) |
| Complaints-To | groups-abuse@google.com |
| Injection-Info | glegroupsg2000goo.googlegroups.com; posting-host=122.248.161.59; posting-account=xyzyTgoAAAB2OaRT58zhH9j7aeiDRJa3 |
| User-Agent | G2/1.0 |
| X-Received-Bytes | 1811 |
| Xref | csiph.com comp.lang.python:26384 |
Show key headers only | View raw
I am implementing a C extension module, during this I saw that when I set the global error indicator and error message through PyErr_SetString() API and return false.
But it doesn't throw any error when I tried to check the error through sys.exc_info() then it returns (NULL, NULL, NULL) tuple.
When I return NULL through the C extension module's function then it works correctly and throws the exception as expected.
The skeleton looks like:
static PyObject* check(PyObject* sef, PyObject* args)
{
PyObject* input = NULL;
if (!PyArg_ParseTuple(args, "O", &input)){
return NULL;
}
.....
.....
PyErr_SetString(PyExc_Exception, "Throwing Error through check function");
Py_RETURN_FALSE;
}
Any idea on why this is happening? Any help will be appreciated.
Thanks,
Rahul
Back to comp.lang.python | Previous | Next — Next in thread | Find similar | Unroll thread
C extension module doesn't throw exception after setting error indicator through PyErr_SetString() rahul <rahul03535@gmail.com> - 2012-08-02 01:57 -0700
Re: C extension module doesn't throw exception after setting error indicator through PyErr_SetString() Tim Golden <mail@timgolden.me.uk> - 2012-08-02 10:06 +0100
Re: C extension module doesn't throw exception after setting error indicator through PyErr_SetString() rahul <rahul03535@gmail.com> - 2012-08-02 02:21 -0700
Re: C extension module doesn't throw exception after setting error indicator through PyErr_SetString() rahul <rahul03535@gmail.com> - 2012-08-02 02:21 -0700
Re: C extension module doesn't throw exception after setting error indicator through PyErr_SetString() Tim Golden <mail@timgolden.me.uk> - 2012-08-02 10:37 +0100
Re: C extension module doesn't throw exception after setting error indicator through PyErr_SetString() rahul <rahul03535@gmail.com> - 2012-08-02 02:50 -0700
Re: C extension module doesn't throw exception after setting error indicator through PyErr_SetString() Tim Golden <mail@timgolden.me.uk> - 2012-08-02 11:45 +0100
Re: C extension module doesn't throw exception after setting error indicator through PyErr_SetString() Stefan Behnel <stefan_ml@behnel.de> - 2012-08-02 12:54 +0200
Re: C extension module doesn't throw exception after setting error indicator through PyErr_SetString() rahul <rahul03535@gmail.com> - 2012-08-02 02:50 -0700
csiph-web