This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author serhiy.storchaka
Recipients georg.brandl, larry, mark.dickinson, serhiy.storchaka, skrah
Date 2014-01-15.18:59:40
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1389812380.95.0.952496699363.issue20260@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2014-01-15 18:59:41serhiy.storchakasetrecipients: + serhiy.storchaka, georg.brandl, mark.dickinson, larry, skrah
2014-01-15 18:59:40serhiy.storchakasetmessageid: <1389812380.95.0.952496699363.issue20260@psf.upfronthosting.co.za>
2014-01-15 18:59:40serhiy.storchakalinkissue20260 messages
2014-01-15 18:59:40serhiy.storchakacreate