Message208180
Unfortunately I have discovered that there is significant difference between uint_converter in Modules/zlibmodule.c and proposed _PyLong_UnsignedInt_Converter. And there are tests in Lib/test/test_zlib.py which fail when _PyLong_UnsignedInt_Converter is used instead of uint_converter. uint_converter raises ValueError for negative integers, and _PyLong_UnsignedInt_Converter raises OverflowError.
Possible solutions:
1. Change tests. I don't like this, ValueError looks reasonable for these cases.
2. Continue to use uint_converter in Modules/zlibmodule.c. Then new converters become less useful.
3. Raise ValueError in new converters for negative integers. ValueError looks reasonable in many cases.
4. Raise ValueError in PyLong_AsUnsignedLong etc for negative integers.
Here is a patch which incorporates Larry's suggestions and implements option #3. |
|
Date |
User |
Action |
Args |
2014-01-15 18:59:41 | serhiy.storchaka | set | recipients:
+ serhiy.storchaka, georg.brandl, mark.dickinson, larry, skrah |
2014-01-15 18:59:40 | serhiy.storchaka | set | messageid: <1389812380.95.0.952496699363.issue20260@psf.upfronthosting.co.za> |
2014-01-15 18:59:40 | serhiy.storchaka | link | issue20260 messages |
2014-01-15 18:59:40 | serhiy.storchaka | create | |
|