So to sum this up, you claim that PyLong_FromUnsignedLongLong can
somehow produce a number larger than the value range of a 64 bit
number (0x10000000000000180). I have a hard time believing this.
Most likely you are looking in the wrong place, mysql_affected_rows
returns 2^64-1, and some Python code later adds 0x181 to that number.