Amaury Forgeot d'Arc <amaur...@gmail.com> added the comment:

It's not fixed. range() now uses the tp_index slot, in weakrefs this becomes:
    WRAP_UNARY(proxy_index, PyNumber_Index)
and indeed PyNumber_Index does not accept strings.

But try with time.sleep() instead; here the line
    WRAP_UNARY(proxy_float, PyNumber_Float)
is involved:


import _weakref, time

class U(str): pass
u = U("1")

try:
    time.sleep(u)
except TypeError:
    print("raised, good")
else:
    print("didn't raise, bad")

try:
    time.sleep(_weakref.proxy(u))
except TypeError:
    print("raised, good")
else:
    print("didn't raise, bad")

----------
nosy: +amaury.forgeotdarc

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

Reply via email to