This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author mwh
Recipients
Date 2004-11-29.16:10:35
SpamBayes Score
Marked as misclassified
Message-id
In-reply-to
Content
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.
History
Date User Action Args
2008-01-20 09:57:19adminlinkissue1075356 messages
2008-01-20 09:57:19admincreate