this is a partial backport of #3119.
(the 3 bugs that cause a SystemError to be raised and are fixed in #3198 don't exist on 2.7. This is because on 2.7, the code of these bugs uses PyArg_Parse (which doesn't assume it received a tuple) instead of PyArg_ParseTuple.)
https://bugs.python.org/issue28261