Re: [Python-Dev] cpython (3.3): return NULL here
Am 23.07.2013 07:08, schrieb benjamin.peterson:
http://hg.python.org/cpython/rev/042ff9325c5e changeset: 84804:042ff9325c5e branch: 3.3 parent: 84789:bb63f813a00f user: Benjamin Peterson
date: Mon Jul 22 22:08:09 2013 -0700 summary: return NULL here files: Python/dynload_shlib.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/Python/dynload_shlib.c b/Python/dynload_shlib.c --- a/Python/dynload_shlib.c +++ b/Python/dynload_shlib.c @@ -91,7 +91,8 @@ int i; struct stat statb; if (fstat(fileno(fp), &statb) == -1) { - return PyErr_SetFromErrno(PyExc_IOError); + PyErr_SetFromErrno(PyExc_IOError); + return NULL; }
PyErr_SetFromErrno() already and always returns NULL. Or do you prefer to return NULL explicitly? Christian
2013/7/23 Christian Heimes
Am 23.07.2013 07:08, schrieb benjamin.peterson:
http://hg.python.org/cpython/rev/042ff9325c5e changeset: 84804:042ff9325c5e branch: 3.3 parent: 84789:bb63f813a00f user: Benjamin Peterson
date: Mon Jul 22 22:08:09 2013 -0700 summary: return NULL here files: Python/dynload_shlib.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/Python/dynload_shlib.c b/Python/dynload_shlib.c --- a/Python/dynload_shlib.c +++ b/Python/dynload_shlib.c @@ -91,7 +91,8 @@ int i; struct stat statb; if (fstat(fileno(fp), &statb) == -1) { - return PyErr_SetFromErrno(PyExc_IOError); + PyErr_SetFromErrno(PyExc_IOError); + return NULL; }
PyErr_SetFromErrno() already and always returns NULL. Or do you prefer to return NULL explicitly?
It might always return NULL, but the compiler sees (PyObject *)NULL when this function returns dl_funcptr. -- Regards, Benjamin
Am 23.07.2013 17:10, schrieb Benjamin Peterson:
PyErr_SetFromErrno() already and always returns NULL. Or do you prefer to return NULL explicitly?
It might always return NULL, but the compiler sees (PyObject *)NULL when this function returns dl_funcptr.
Oh, you are right. I must have missed the compiler warning. How about we turn type return and type assignment warnings into fatal errors? Christian
On 23 Jul, 2013, at 17:36, Christian Heimes
Am 23.07.2013 17:10, schrieb Benjamin Peterson:
PyErr_SetFromErrno() already and always returns NULL. Or do you prefer to return NULL explicitly?
It might always return NULL, but the compiler sees (PyObject *)NULL when this function returns dl_funcptr.
Oh, you are right. I must have missed the compiler warning. How about we turn type return and type assignment warnings into fatal errors?
That's probably possible with a '-Werror=....' argument. But please consider issue 18211 before unconditionally adding such a flag, as that issue mentions new compiler flags also get used when compiling 3th-party extensions. I guess there needs to be (yet) another CFLAGS_xxx variable in the Makefile that gets added to $(CFLAGS) during the build of Python itself, but is ignored by distutils and sysconfig. Ronald
Christian
_______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/ronaldoussoren%40mac.com
On Tue, Jul 23, 2013 at 8:46 AM, Ronald Oussoren
On 23 Jul, 2013, at 17:36, Christian Heimes
wrote: Am 23.07.2013 17:10, schrieb Benjamin Peterson:
PyErr_SetFromErrno() already and always returns NULL. Or do you prefer to return NULL explicitly?
It might always return NULL, but the compiler sees (PyObject *)NULL when this function returns dl_funcptr.
Oh, you are right. I must have missed the compiler warning. How about we turn type return and type assignment warnings into fatal errors?
That's probably possible with a '-Werror=....' argument. But please consider issue 18211 before unconditionally adding such a flag, as that issue mentions new compiler flags also get used when compiling 3th-party extensions.
I guess there needs to be (yet) another CFLAGS_xxx variable in the Makefile that gets added to $(CFLAGS) during the build of Python itself, but is ignored by distutils and sysconfig.
It seems fair to turn those on in 3.4 and require that third party extensions clean up their code when porting from 3.3 to 3.4.
Ronald
Christian
_______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe:
http://mail.python.org/mailman/options/python-dev/ronaldoussoren%40mac.com
_______________________________________________ Python-checkins mailing list Python-checkins@python.org http://mail.python.org/mailman/listinfo/python-checkins
On 24 Jul, 2013, at 8:43, Gregory P. Smith
On Tue, Jul 23, 2013 at 8:46 AM, Ronald Oussoren
wrote: On 23 Jul, 2013, at 17:36, Christian Heimes
wrote: Am 23.07.2013 17:10, schrieb Benjamin Peterson:
PyErr_SetFromErrno() already and always returns NULL. Or do you prefer to return NULL explicitly?
It might always return NULL, but the compiler sees (PyObject *)NULL when this function returns dl_funcptr.
Oh, you are right. I must have missed the compiler warning. How about we turn type return and type assignment warnings into fatal errors?
That's probably possible with a '-Werror=....' argument. But please consider issue 18211 before unconditionally adding such a flag, as that issue mentions new compiler flags also get used when compiling 3th-party extensions.
I guess there needs to be (yet) another CFLAGS_xxx variable in the Makefile that gets added to $(CFLAGS) during the build of Python itself, but is ignored by distutils and sysconfig.
It seems fair to turn those on in 3.4 and require that third party extensions clean up their code when porting from 3.3 to 3.4.
In this case its "just" code cleanup, the issue I filed (see above) is for another -Werror flag that causes compile errors with some valid C99 code that isn't valid C89. That's good for CPython itself because its source code is explicitly C89, but is not good when building 3th-party extensions. A proper fix requires tweaking the configure script, Makefile and distutils and that's not really a fun prospect ;-) Ronald
Ronald
Christian
_______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/ronaldoussoren%40mac.com
_______________________________________________ Python-checkins mailing list Python-checkins@python.org http://mail.python.org/mailman/listinfo/python-checkins
_______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/ronaldoussoren%40mac.com
Le Wed, 24 Jul 2013 09:01:30 +0200,
Ronald Oussoren
On 24 Jul, 2013, at 8:43, Gregory P. Smith
wrote: On Tue, Jul 23, 2013 at 8:46 AM, Ronald Oussoren
wrote: On 23 Jul, 2013, at 17:36, Christian Heimes
wrote: Am 23.07.2013 17:10, schrieb Benjamin Peterson:
PyErr_SetFromErrno() already and always returns NULL. Or do you prefer to return NULL explicitly?
It might always return NULL, but the compiler sees (PyObject *)NULL when this function returns dl_funcptr.
Oh, you are right. I must have missed the compiler warning. How about we turn type return and type assignment warnings into fatal errors?
That's probably possible with a '-Werror=....' argument. But please consider issue 18211 before unconditionally adding such a flag, as that issue mentions new compiler flags also get used when compiling 3th-party extensions.
I guess there needs to be (yet) another CFLAGS_xxx variable in the Makefile that gets added to $(CFLAGS) during the build of Python itself, but is ignored by distutils and sysconfig.
It seems fair to turn those on in 3.4 and require that third party extensions clean up their code when porting from 3.3 to 3.4.
In this case its "just" code cleanup, the issue I filed (see above) is for another -Werror flag that causes compile errors with some valid C99 code that isn't valid C89. That's good for CPython itself because its source code is explicitly C89, but is not good when building 3th-party extensions.
Agreed. We shouldn't impose specific error flags on 3rd-party extension writers. Regards Antoine.
participants (5)
-
Antoine Pitrou
-
Benjamin Peterson
-
Christian Heimes
-
Gregory P. Smith
-
Ronald Oussoren