Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

weakref.proxy fails to delegate tp_index slot #46844

Closed
ncoghlan opened this issue Apr 8, 2008 · 3 comments
Closed

weakref.proxy fails to delegate tp_index slot #46844

ncoghlan opened this issue Apr 8, 2008 · 3 comments
Assignees
Labels
easy stdlib Python modules in the Lib dir

Comments

@ncoghlan
Copy link
Contributor

ncoghlan commented Apr 8, 2008

BPO 2592
Nosy @birkenfeld, @ncoghlan

Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

Show more details

GitHub fields:

assignee = 'https://github.com/birkenfeld'
closed_at = <Date 2008-05-20.08:41:08.207>
created_at = <Date 2008-04-08.16:17:43.191>
labels = ['easy', 'library']
title = 'weakref.proxy fails to delegate tp_index slot'
updated_at = <Date 2008-05-20.08:41:08.140>
user = 'https://github.com/ncoghlan'

bugs.python.org fields:

activity = <Date 2008-05-20.08:41:08.140>
actor = 'georg.brandl'
assignee = 'georg.brandl'
closed = True
closed_date = <Date 2008-05-20.08:41:08.207>
closer = 'georg.brandl'
components = ['Library (Lib)']
creation = <Date 2008-04-08.16:17:43.191>
creator = 'ncoghlan'
dependencies = []
files = []
hgrepos = []
issue_num = 2592
keywords = ['easy']
message_count = 3.0
messages = ['65182', '65190', '67118']
nosy_count = 2.0
nosy_names = ['georg.brandl', 'ncoghlan']
pr_nums = []
priority = 'normal'
resolution = 'fixed'
stage = None
status = 'closed'
superseder = None
type = None
url = 'https://bugs.python.org/issue2592'
versions = ['Python 2.6', 'Python 2.5', 'Python 3.0']

@ncoghlan
Copy link
Contributor Author

ncoghlan commented Apr 8, 2008

From the discussion of bpo-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.

@ncoghlan ncoghlan added the stdlib Python modules in the Lib dir label Apr 8, 2008
@ncoghlan
Copy link
Contributor Author

ncoghlan commented Apr 8, 2008

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.

@ncoghlan ncoghlan added the easy label Apr 8, 2008
@birkenfeld
Copy link
Member

Fixed in r63500, together with the floor/truediv slots.

@birkenfeld birkenfeld self-assigned this May 20, 2008
@ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
easy stdlib Python modules in the Lib dir
Projects
None yet
Development

No branches or pull requests

2 participants