gcc-python-plugin is a plugin for GCC 4.6 onwards which embeds the CPython interpreter within GCC, allowing you to write new compiler warnings in Python, generate code visualizations, etc.
It ships with "cpychecker", which implements static analysis passes for GCC aimed at finding bugs in CPython extensions. In particular, it can automatically detect reference-counting errors: http://gcc-python-plugin.readthedocs.org/en/latest/cpychecker.html Highlights of this release: * You can now create custom GCC attributes from Python, allowing you to add custom high-level annotations to a C API, and to write Python scripts that will verify these properties. * The "cpychecker" code has too many improvements to list here, and has now detected many reference-counting bugs in real-world CPython extension code. Some success stories can be seen at: http://gcc-python-plugin.readthedocs.org/en/latest/success.html The usability and signal:noise ratio is greatly improved over previous releases. It can now emit HTML reports showing the path of execution through a function that triggers a particular error. For more information you can read detailed notes on this release at: http://readthedocs.org/docs/gcc-python-plugin/en/latest/0.7.html Tarball releases are available at: https://fedorahosted.org/releases/g/c/gcc-python-plugin/ Prebuilt-documentation can be seen at: http://gcc-python-plugin.readthedocs.org/en/latest/index.html The project's homepage is: https://fedorahosted.org/gcc-python-plugin/ The plugin and checker are Free Software, licensed under the GPLv3 or later. Thanks to Red Hat for funding their development. If you're using Fedora, pre-built RPMs of the plugin should be hitting the repositories shortly. Enjoy! Dave Malcolm