classification
Title: weakref.proxy fails to delegate tp_index slot
Type: Stage:
Components: Library (Lib) Versions: Python 3.0, Python 2.6, Python 2.5
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: georg.brandl Nosy List: georg.brandl, ncoghlan
Priority: normal Keywords: easy

Created on 2008-04-08 16:17 by ncoghlan, last changed 2008-05-20 08:41 by georg.brandl. This issue is now closed.

Messages (3)
msg65182 - (view) Author: Nick Coghlan (ncoghlan) * (Python committer) Date: 2008-04-08 16:17
From the discussion of issue 643841:

>>> class Demo:
...   def __index__(self):
...     return 1
...
>>> a = Demo()
>>> b = weakref.proxy(a)
>>> operator.index(a)
1
>>> operator.index(b)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: 'weakproxy' object cannot be interpreted as an index

The weakref proxy types need to be updated to delegate 2.5's new
tp_index slot.
msg65190 - (view) Author: Nick Coghlan (ncoghlan) * (Python committer) Date: 2008-04-08 16:48
Marking as easy - it should be possible to just look at what the code in
Objects\weakref.c is already doing for slots like tp_len and tp_int and
do the same thing for tp_index.
msg67118 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2008-05-20 08:41
Fixed in r63500, together with the floor/truediv slots.
History
Date User Action Args
2008-05-20 08:41:08georg.brandlsetstatus: open -> closed
assignee: georg.brandl
messages: + msg67118
resolution: fixed
nosy: + georg.brandl
2008-04-08 16:48:33ncoghlansetkeywords: + easy
messages: + msg65190
2008-04-08 16:46:43ncoghlansetpriority: normal
2008-04-08 16:17:43ncoghlancreate