[issue20260] Argument Clinic: add unsigned integers converters

2018-07-26 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- resolution: -> fixed stage: patch review -> resolved status: open -> closed versions: +Python 3.8 -Python 3.4 ___ Python tracker ___ __

[issue20260] Argument Clinic: add unsigned integers converters

2018-07-26 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: New changeset 7cb7bcff20a386bba59cbc51e2419542de358bd2 by Serhiy Storchaka in branch 'master': bpo-20260: Implement non-bitwise unsigned int converters for Argument Clinic. (GH-8434) https://github.com/python/cpython/commit/7cb7bcff20a386bba59cbc51e2419542

[issue20260] Argument Clinic: add unsigned integers converters

2018-07-24 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- pull_requests: +7959 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://

[issue20260] Argument Clinic: add unsigned integers converters

2015-02-25 Thread Serhiy Storchaka
Changes by Serhiy Storchaka : -- components: +Argument Clinic ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: h

[issue20260] Argument Clinic: add unsigned integers converters

2014-05-22 Thread Josh Rosenberg
Changes by Josh Rosenberg : -- nosy: +josh.rosenberg ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://ma

[issue20260] Argument Clinic: add unsigned integers converters

2014-05-22 Thread Stefan Krah
Changes by Stefan Krah : -- nosy: -skrah ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.o

[issue20260] Argument Clinic: add unsigned integers converters

2014-01-24 Thread Larry Hastings
Larry Hastings added the comment: I can start citing data points if you like. socket.if_indextoname just calls PyLong_AsUnsignedLong(). Not sure what that throws. -- ___ Python tracker __

[issue20260] Argument Clinic: add unsigned integers converters

2014-01-22 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: I think that we do not yet have enough data. Too little cases are known for which unsigned integer converters are needed, and different cases require a different behavior. I prefer to defer until we convert the majority of the code. Then we will see what beh

[issue20260] Argument Clinic: add unsigned integers converters

2014-01-21 Thread Larry Hastings
Larry Hastings added the comment: Actually, here's another data point to consider. The underlying implementation of PyArg_Parse* is the function convertsimple() in Python/getargs.c. For all the non-bitwise integer format units ('bhi'), if they overflow or underflow the native integer they ra

[issue20260] Argument Clinic: add unsigned integers converters

2014-01-21 Thread Larry Hastings
Larry Hastings added the comment: Also, you didn't remove the _ in front of "Converter" in the names, e.g "_PyLong_UnsignedShort_Converter" should be "_PyLong_UnsignedShortConverter". -- ___ Python tracker ___

[issue20260] Argument Clinic: add unsigned integers converters

2014-01-21 Thread Larry Hastings
Larry Hastings added the comment: Is this waiting on something? I agree that we can't change the behavior of existing functions. But your new converters should raise ValueError. -- ___ Python tracker

[issue20260] Argument Clinic: add unsigned integers converters

2014-01-17 Thread Ryan Smith-Roberts
Ryan Smith-Roberts added the comment: socketmodule has three builtins which use PyLong_AsUnsignedLong on their arguments and would benefit from these converters, but only if they raise OverflowError. So I vote for #2. I don't think it's unreasonable to continue to have locally-defined argument

[issue20260] Argument Clinic: add unsigned integers converters

2014-01-15 Thread Larry Hastings
Larry Hastings added the comment: I'm glad you caught that! First things first: the converted code should behave identically to the existing code, including raising the same exceptions. If you examine the exception hierarchy: http://docs.python.org/3.4/library/exceptions.html#exception-hi

[issue20260] Argument Clinic: add unsigned integers converters

2014-01-15 Thread Stefan Krah
Stefan Krah added the comment: I think we cannot change PyLong_AsUnsignedLong() without a deprecation period, if at all. That leaves the option of changing the converters. My preference is to raise either OverflowError or ValueError for *both* out-of-range conditions. People may me used to Ove

[issue20260] Argument Clinic: add unsigned integers converters

2014-01-15 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Oh, and of course 5th option: do nothing. -- ___ Python tracker ___ ___ Python-bugs-list mailing l

[issue20260] Argument Clinic: add unsigned integers converters

2014-01-15 Thread Serhiy Storchaka
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

[issue20260] Argument Clinic: add unsigned integers converters

2014-01-15 Thread Larry Hastings
Larry Hastings added the comment: We can use this now. So I bumped it to the top of my queue and reviewed it. I had only minor feedback--thanks! -- ___ Python tracker ___

[issue20260] Argument Clinic: add unsigned integers converters

2014-01-14 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Currently these converters are used only in zlib (unsigned int) and select (unsigned short). But perhaps during conversion to Argument Clinic we will discover that they are more appropriate than bitwise converters in other places. So there is no hurry.

[issue20260] Argument Clinic: add unsigned integers converters

2014-01-14 Thread Larry Hastings
Larry Hastings added the comment: Very nice! I had an idea to do this in the back of my head too. But my plate is already full. I haven't reviewed the patch yet--and I have a huge backlog of reviews already. But I can give this higher priority if you need it for other patches. When do you

[issue20260] Argument Clinic: add unsigned integers converters

2014-01-14 Thread Serhiy Storchaka
New submission from Serhiy Storchaka: Proposed patch adds support for non-bitwise unsigned integer arguments in Argument Clinic. I.e. now unsigned_int(bitwise=False) (or just unsigned_int) converts Python int in range from 0 to UINT_MAX to C unsigned int. Added support for unsigned_short, unsi