Issue 2592: weakref.proxy fails to delegate tp_index slot (original) (raw)

Issue2592

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.

This issue has been migrated to GitHub: https://github.com/python/cpython/issues/46844

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 2022-04-11 14:56 by admin. This issue is now closed.

Messages (3)
msg65182 - (view) Author: Alyssa 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 "", line 1, in 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: Alyssa 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
2022-04-11 14:56:33 admin set github: 46844
2008-05-20 08:41:08 georg.brandl set status: open -> closedassignee: georg.brandlmessages: + resolution: fixednosy: + georg.brandl
2008-04-08 16:48:33 ncoghlan set keywords: + easymessages: +
2008-04-08 16:46:43 ncoghlan set priority: normal
2008-04-08 16:17:43 ncoghlan create