[sr-dev] [kamailio/kamailio] python3: `PyErr_SetString` is a void function. It doesn't return NULL. (PR #3231)

Daniel-Constantin Mierla notifications at github.com
Fri Sep 2 13:49:33 CEST 2022


Thanks for this PR!

I am not much into Python API, but somehow I get your comment in contradiction with the changes in the code, respectively:

```
PyErr_SetString is a void function. It doesn't return NULL.
```

But then the changes replace:

```
		Py_INCREF(Py_None);
		return Py_None;
```

With a `NULL` return:

```
return NULL;
```

Is it that after use of `PyErr_SetString(...);` it is not needed to reference `Py_None`, because it was not returning a `NULL` (or the `Py_None`) object?

Since (I think), Python does not really have `NULL` inside, but the `None` keyword, what is the impact of this change returning `NULL`?

Anything particularly wrong without this patch?

Practically I am trying to figure out what exactly was wrong and this PR fixes, because the code is like this for rather long time.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/pull/3231#issuecomment-1235402828
You are receiving this because you are subscribed to this thread.

Message ID: <kamailio/kamailio/pull/3231/c1235402828 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.kamailio.org/pipermail/sr-dev/attachments/20220902/d9bf5a17/attachment-0001.htm>


More information about the sr-dev mailing list