Re: [Python-Dev] Convert from unsigned long long to PyLong

2016-07-23 Thread MRAB
On 2016-07-23 05:23, Tian JiaLin wrote: Hey Guys, I found the mistake I made, basically I'm using a tool called Sentry to capture the exceptions. The value returned from the Python is 2^64-1, which is -1 from mysql_affected_rows. Sentry is using JSON format as the a kind of storage, apparently t

Re: [Python-Dev] Convert from unsigned long long to PyLong

2016-07-22 Thread Tian JiaLin
Hey Guys, I found the mistake I made, basically I'm using a tool called Sentry to capture the exceptions. The value returned from the Python is 2^64-1, which is -1 from mysql_affected_rows. Sentry is using JSON format as the a kind of storage, apparently the MAX SAFE INTEGER

Re: [Python-Dev] Convert from unsigned long long to PyLong

2016-07-22 Thread Random832
On Fri, Jul 22, 2016, at 11:50, Eric Snow wrote: > On Fri, Jul 22, 2016 at 3:02 AM, Stefan Ring wrote: > > 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 (0x10180). I have a hard time bel

Re: [Python-Dev] Convert from unsigned long long to PyLong

2016-07-22 Thread Tian JiaLin
Yes, you are right. Definitely "long" in Python can represent a number much bigger than the native. But the range of returned value from mysql_affected_rows within 0 ~ 2^64-1. No matter how it's converted, the converted value in Python also should in the range of 0 ~ 2^64 - 1. On Fri, Jul 22, 20

Re: [Python-Dev] Convert from unsigned long long to PyLong

2016-07-22 Thread Eric Snow
On Fri, Jul 22, 2016 at 3:02 AM, Stefan Ring wrote: > 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 (0x10180). I have a hard time believing this. Perhaps I misunderstood your meaning, but P

Re: [Python-Dev] Convert from unsigned long long to PyLong

2016-07-22 Thread Tian JiaLin
I know it's hard to believe this, I wish I'm wrong. But after looking into the code for one week, I didn't find any other code change the number. I will go through them again make sure I didn't miss anything. Thanks for the reply. On Fri, Jul 22, 2016 at 5:02 PM, Stefan Ring wrote: > So to sum

Re: [Python-Dev] Convert from unsigned long long to PyLong

2016-07-22 Thread Stefan Ring
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 (0x10180). 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 co

[Python-Dev] Convert from unsigned long long to PyLong

2016-07-21 Thread Tian JiaLin
HI There, Maybe I should not post this in the dev group, but I think it has some relationship on the Python core. I'm using MySQLdb as the MySQL client. Recently I got a weird problem of this library. After looking into it, I suspect the problem may related to the conversion from unsigned long to