Serhiy Storchaka added the comment: 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. ---------- nosy: +mark.dickinson, skrah Added file: http://bugs.python.org/file33483/clinic_unsigned_converters.patch _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue20260> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com