Support for 3.12

Those couple of fixes, which I developed for supporting 3.12 in Debian, apply cleanly to your fork.

In case you're interested...

(to be honest I didn't test your fork - but it looks interesting, in particular given that there is no activity since years in the Quixotix branch)