Running Clang 2.7's static analyzer over the code base
Since 2.7 is probably going to exist for a while, I am running Clang 2.7's static analyzer (``clang --static``) over trunk. It's mostly just finding stuff like unneeded variable initialization or variables that are never used (compilation is picking up unused returned values, almost all from PyObject_INIT). When I check in these changes I will do it file by file, but my question is how to handle Misc/NEWS. I have gone through the underscores and the 'a's in Modules and already have six modified files, so the final count might be a little high. Do people want individual entries per file, or simply a single entry that lists each file modified? We should probably go through the C code and fix the whitespace before we hit 2.7 final (there is a ton of lines with extraneous spaces). -Brett
2010/5/3 Brett Cannon <brett@python.org>:
Since 2.7 is probably going to exist for a while, I am running Clang 2.7's static analyzer (``clang --static``) over trunk. It's mostly just finding stuff like unneeded variable initialization or variables that are never used (compilation is picking up unused returned values, almost all from PyObject_INIT). When I check in these changes I will do it file by file, but my question is how to handle Misc/NEWS. I have gone through the underscores and the 'a's in Modules and already have six modified files, so the final count might be a little high. Do people want individual entries per file, or simply a single entry that lists each file modified?
Do these changes even warrant a NEWS entry? NEWS is more for user facing changes.
We should probably go through the C code and fix the whitespace before we hit 2.7 final (there is a ton of lines with extraneous spaces).
Why?
-Brett
-- Regards, Benjamin
Benjamin Peterson <benjamin <at> python.org> writes:
2010/5/3 Brett Cannon <brett <at> python.org>:
When I check in these changes I will do it file by file, but my
question is
how to handle Misc/NEWS. I have gone through the underscores and the 'a's in Modules and already have six modified files, so the final count might be a little high. Do people want individual entries per file, or simply a single entry that lists each file modified?
Do these changes even warrant a NEWS entry? NEWS is more for user facing changes.
Indeed. At most a single NEWS entry sounds sufficient. Regards Antoine.
I am done running the analysis over trunk. I will not svnmerge these changes into py3k as the amount of time and effort that would take equates to running the static analyzer again just before 3.2 is released and possibly catching more changes (and maybe even a newer version of Clang at that point). On Mon, May 3, 2010 at 15:37, Brett Cannon <brett@python.org> wrote:
Since 2.7 is probably going to exist for a while, I am running Clang 2.7's static analyzer (``clang --static``) over trunk. It's mostly just finding stuff like unneeded variable initialization or variables that are never used (compilation is picking up unused returned values, almost all from PyObject_INIT).
When I check in these changes I will do it file by file, but my question is how to handle Misc/NEWS. I have gone through the underscores and the 'a's in Modules and already have six modified files, so the final count might be a little high. Do people want individual entries per file, or simply a single entry that lists each file modified?
We should probably go through the C code and fix the whitespace before we hit 2.7 final (there is a ton of lines with extraneous spaces).
-Brett
On 5 May, 2010, at 22:56, Brett Cannon wrote:
I am done running the analysis over trunk. I will not svnmerge these changes into py3k as the amount of time and effort that would take equates to running the static analyzer again just before 3.2 is released and possibly catching more changes (and maybe even a newer version of Clang at that point).
Have you looked into teaching clang's static analyser about Python's refcounting rules? Clang's analyser can tell you about problems related to reference count management for Objective-C code and doing the same for code using the CPython API would be usefull. Ronald
On Mon, May 3, 2010 at 15:37, Brett Cannon <brett@python.org> wrote: Since 2.7 is probably going to exist for a while, I am running Clang 2.7's static analyzer (``clang --static``) over trunk. It's mostly just finding stuff like unneeded variable initialization or variables that are never used (compilation is picking up unused returned values, almost all from PyObject_INIT).
When I check in these changes I will do it file by file, but my question is how to handle Misc/NEWS. I have gone through the underscores and the 'a's in Modules and already have six modified files, so the final count might be a little high. Do people want individual entries per file, or simply a single entry that lists each file modified?
We should probably go through the C code and fix the whitespace before we hit 2.7 final (there is a ton of lines with extraneous spaces).
-Brett
_______________________________________________ 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 Thu, May 6, 2010 at 08:09, Ronald Oussoren <ronaldoussoren@mac.com>wrote:
On 5 May, 2010, at 22:56, Brett Cannon wrote:
I am done running the analysis over trunk. I will not svnmerge these changes into py3k as the amount of time and effort that would take equates to running the static analyzer again just before 3.2 is released and possibly catching more changes (and maybe even a newer version of Clang at that point).
Have you looked into teaching clang's static analyser about Python's refcounting rules? Clang's analyser can tell you about problems related to reference count management for Objective-C code and doing the same for code using the CPython API would be usefull.
That's a thought, but I have not looked into it yet. As of right now the first thing I would do is fix its NULL de-reference analysis as it had a bunch of false-positives on that (I don't think it handles `!ptr` as equivalent to `ptr == NULL`). -Brett
Ronald
On Mon, May 3, 2010 at 15:37, Brett Cannon <brett@python.org> wrote:
Since 2.7 is probably going to exist for a while, I am running Clang 2.7's static analyzer (``clang --static``) over trunk. It's mostly just finding stuff like unneeded variable initialization or variables that are never used (compilation is picking up unused returned values, almost all from PyObject_INIT).
When I check in these changes I will do it file by file, but my question is how to handle Misc/NEWS. I have gone through the underscores and the 'a's in Modules and already have six modified files, so the final count might be a little high. Do people want individual entries per file, or simply a single entry that lists each file modified?
We should probably go through the C code and fix the whitespace before we hit 2.7 final (there is a ton of lines with extraneous spaces).
-Brett
_______________________________________________ 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 mardi 04 mai 2010 00:37:22, Brett Cannon a écrit :
Since 2.7 is probably going to exist for a while, I am running Clang 2.7's static analyzer (``clang --static``) over trunk. It's mostly just finding stuff like unneeded variable initialization or variables that are never used (compilation is picking up unused returned values, almost all from PyObject_INIT).
When I check in these changes I will do it file by file, ...
Do you plan to port the changes to py3k? and what about 2.6 and 3.1? -- Please don't change whitespaces in the same commit. I think that we should fix the whitespaces of the whole project in one unique commit. Well, or least don't fix whitespaces file by file... -- Victor Stinner http://www.haypocalc.com/
On Wed, May 5, 2010 at 14:01, Victor Stinner <victor.stinner@haypocalc.com>wrote:
Le mardi 04 mai 2010 00:37:22, Brett Cannon a écrit :
Since 2.7 is probably going to exist for a while, I am running Clang 2.7's static analyzer (``clang --static``) over trunk. It's mostly just finding stuff like unneeded variable initialization or variables that are never used (compilation is picking up unused returned values, almost all from PyObject_INIT).
When I check in these changes I will do it file by file, ...
Do you plan to port the changes to py3k?
In case you didn't see my follow-up email that I sent just before this email, I will most likely do py3k when 3.2 is closer.
and what about 2.6 and 3.1?
Not doing 2.6 as almost all changes are too minor bother. I think I found like two potential Py_DECREF/Py_XDECREF changes, but that's about it. And 3.1 would require py3k which I am not planning on doing in the near future. -Brett
participants (5)
-
Antoine Pitrou
-
Benjamin Peterson
-
Brett Cannon
-
Ronald Oussoren
-
Victor Stinner