[issue5175] negative PyLong - C unsigned integral, TypeError or OverflowError?

2009-02-10 Thread Lisandro Dalcin
Lisandro Dalcin dalc...@gmail.com added the comment: Mark, here you have a patch. I've only 'make test' on a 32bit Linux box Just two comments: - in docs: perhaps the 'versionchanged' stuff should be added. - in tests: I did not touch Modules/_testcapimodule.c, as it seems the test is

[issue5175] negative PyLong - C unsigned integral, TypeError or OverflowError?

2009-02-10 Thread Mark Dickinson
Mark Dickinson dicki...@gmail.com added the comment: Thanks for the patch! I agree that the 'versionchanged' reference should be added in the docs. I also think that the test should be updated to check the exception type. Here's a modified version of your patch that adds a test for

[issue5175] negative PyLong - C unsigned integral, TypeError or OverflowError?

2009-02-10 Thread Lisandro Dalcin
Lisandro Dalcin dalc...@gmail.com added the comment: It worked for me. BTW, 'make test' did not noticed the change in Modules/testcapi_long.h, which is #include'd by Modules/_testcapimodule.c. I've attached a trivial patch for setup.py fixing the dependency issue. Added file:

[issue5175] negative PyLong - C unsigned integral, TypeError or OverflowError?

2009-02-10 Thread Mark Dickinson
Mark Dickinson dicki...@gmail.com added the comment: Committed, r69498 (trunk) and r69499 (py3k). ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue5175 ___

[issue5175] negative PyLong - C unsigned integral, TypeError or OverflowError?

2009-02-10 Thread Mark Dickinson
Mark Dickinson dicki...@gmail.com added the comment: ...and your patch for setup.py applied in r69500, r69501, r69502, r69503. Thank you! -- resolution: - accepted status: open - closed ___ Python tracker rep...@bugs.python.org

[issue5175] negative PyLong - C unsigned integral, TypeError or OverflowError?

2009-02-09 Thread Mark Dickinson
Mark Dickinson dicki...@gmail.com added the comment: However, I would like to wait until Tim comments on this. You may be in for a long wait! I hesitate to make the heretical suggestion that there may be more important things in life than fixing minor inconsistencies in Python, but I think

[issue5175] negative PyLong - C unsigned integral, TypeError or OverflowError?

2009-02-08 Thread Mark Dickinson
Mark Dickinson dicki...@gmail.com added the comment: This also affects 3.1. Note that the current behaviour (or rather, its effects in PyLong_AsUnsignedLongLong) is as documented. In http://docs.python.org/dev/c-api/long.html it says for PyLong_AsUnsignedLongLong: Return a C unsigned long

[issue5175] negative PyLong - C unsigned integral, TypeError or OverflowError?

2009-02-08 Thread Mark Dickinson
Mark Dickinson dicki...@gmail.com added the comment: Looks like this was changed in a checkin by Tim Peters in r21099; before r21099, PyLong_AsUnsignedLongLong raised OverflowError for negative numbers. After the checkin, it raised TypeError. I suspect the change was inadvertent. Tim, any

[issue5175] negative PyLong - C unsigned integral, TypeError or OverflowError?

2009-02-08 Thread Lisandro Dalcin
Lisandro Dalcin dalc...@gmail.com added the comment: I can contribute a patch. However, I would like to wait until Tim comments on this. ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue5175 ___

[issue5175] negative PyLong - C unsigned integral, TypeError or OverflowError?

2009-02-07 Thread Mark Dickinson
Changes by Mark Dickinson dicki...@gmail.com: -- assignee: - marketdickinson nosy: +marketdickinson ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue5175 ___

[issue5175] negative PyLong - C unsigned integral, TypeError or OverflowError?

2009-02-06 Thread Lisandro Dalcin
New submission from Lisandro Dalcin dalc...@gmail.com: At Objects/longobject.c, in almost all cases OverflowError is raised when a unsigned integral is requested from a negative PyLong. However, this one breaks the rules: int _PyLong_AsByteArray(PyLongObject* v, unsigned char*