pygit2 0.20.3 introduces support for credentials

Changes:

  • Introduce support for credentials
  • Several memory issues fixed
  • Compatibility fixes for Python 3.3, PyPy3 and Visual Studio
  • And much more…

Thanks to Carlos Martín Nieto, Leonardo Rhodes, Devaev Maxim, Erik Meusel, Thomas Kluyver and earl.

Resources:

Enjoy!

pygit2 version 0.20.1 brings support for merge and reset

Changes:

  • New remote ref-specs API: #290
  • New Repository.reset(...): #292, #294
  • Export GIT_DIFF_MINIMAL: #293
  • New Repository.merge(...): #295
  • Fix Repository.blame argument handling: #297
  • Fix build error on Windows: #298
  • Fix typo in the README file, Blog → Blob: #301
  • Now Diff.patch returns None if no patch: #232, #303
  • New Walker.simplify_first_parent(): #304

Thanks to Jose Plana, Victor Garcia, Petr Hosek, Adam Spiers, Eric Schrijver,  Óscar San José and Xu Tao.

Resources:

Enjoy!

Python: Running Valgrind on a C extension

This is how I use Valgrind to check for memory bugs in pygit2.

Glibc with debug symbols

The first issue I run into is that Valgrind refused to work if Glibc was not compiled with debug symbols.

This is how I did in my Gentoo notebook, I edited the /etc/make.conf file to enable the splitdebug feature:

/etc/make.conf
FEATURES="splitdebug"

Then re-emerged the glibc:

$ sudo emerge glibc

Then commented out the splitdebug feature to avoid emerging other packages with debug symbols (there is likely a better way to do this).

Valgrind 3.7

The big problem is that running Valgrind with a Python C extension raises tons of false positives. There are a number of things you need to do to avoid all these false positives.

The first one is to use latest version of Valgrind 3.7, because of some bug I forgot about present in version 3.6

Python, compiling for a memory debugger

Now, you need to install a version of Python to be used with Valgrind. There is one little change to do regarding an standard Python, edit file Objects/obmalloc.c and define Py_USING_MEMORY_DEBUGGER :

Objects/obmalloc.c
#define Py_USING_MEMORY_DEBUGGER

Now install as usual:

$ ./configure --prefix=~/Python-2.7.3-mem-debug
$ make
$ make install

The suppression file

Now you need to use the suppression file that you will find in the Python sources, at Misc/valgrind-python.supp. This is how I run the unit tests in pygit2 to find issues:

$ valgrind --trace-children=yes --suppressions=valgrind-python.supp \
~/Python-2.7.3-mem-debug/bin/python setup.py test

That’s it.