Message60608
Broadly speaking, this line (488 in today's CVS) in
Python/weakref.c isn't right:
WRAP_UNARY(proxy_int, PyNumber_Int)
because PyNumber_Int will convert from a string
argument. You can "exploit" this like so:
class U(unicode): pass
u = U("1")
try:
range(u)
except TypeError:
print "raised, good"
else:
print "didn't raise, bad"
import _weakref
try:
range(_weakref.proxy(u))
except TypeError:
print "raised, good"
else:
print "didn't raise, bad"
(prints
raised, good
didn't raise, bad
for me). I think the fix is PyNumber_Int ->
PyInt_AsLong, but haven't checked that. |
|
Date |
User |
Action |
Args |
2008-01-20 09:57:19 | admin | link | issue1075356 messages |
2008-01-20 09:57:19 | admin | create | |
|