Patches from Debian

Hi,

we applied these two patches. Please include them.
I learned about the `warnings.warn` function when I tried to debug the test case failure on Debian. :smile: