Terry J. Reedy added the comment:

I like this. Very nice.  What I understand is that callers that access 
PySlice_GetIndicesEx via the header file (included with Python.h) will see the 
function as a macro.  When the macro is expanded, the length expression will be 
evaluated after any __index__ calls.

This approach requires that the length expression calculate the length from the 
sequence, rather than being a length computer before the call. I checked and 
all of our users in /Objects pass some form of seq.get_size().  This approach 
also requires that the function be accessed via .h rather than directly as the 
function in the .c file.  If we go this way, should he PySlice_GetIndicesEx doc 
say something?

I reviewed the two new functions and am satisfied a) that they correctly 
separate converting None and non-ints to ints from adjusting start and stop as 
ints according to length and b) that the effect of the change in logic for the 
latter is to stop making unnecessary checks that must fail.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue27867>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to