Issue 35992: Metaclasses interfere with class_getitem (original) (raw)

Issue35992

Created on 2019-02-14 06:14 by donovick, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 11857 merged levkivskyi,2019-02-14 11:56
PR 11910 merged miss-islington,2019-02-17 23:14
Messages (4)
msg335497 - (view) Author: Caleb Donovick (donovick) * Date: 2019-02-14 06:14
OS: Debian testing python3 -VV: Python 3.7.2+ (default, Feb 2 2019, 14:31:48) [gcc 8.2.0] The following: ``` class Meta(type): pass class X(metaclass=Meta): def __class_getitem__(cls, key): return key X[10] ``` Results in ``` TypeError: 'Meta' object does not support indexing ``` However, PEP 560 specifically states that __class_getitem__ should be used as fall back for when a metaclass does not implement __getitem__.
msg335521 - (view) Author: Ivan Levkivskyi (levkivskyi) * (Python committer) Date: 2019-02-14 11:57
Yes, I think this is a bug. Created a PR with a possible simple fix.
msg335790 - (view) Author: Ivan Levkivskyi (levkivskyi) * (Python committer) Date: 2019-02-17 23:13
New changeset ac28147e78c45a6217d348ce90ca5281d91f676f by Ivan Levkivskyi in branch 'master': bpo-35992: Use PySequence_GetItem only if sq_item is not NULL (GH-11857) https://github.com/python/cpython/commit/ac28147e78c45a6217d348ce90ca5281d91f676f
msg335791 - (view) Author: miss-islington (miss-islington) Date: 2019-02-17 23:33
New changeset a7f929db605326da452fbdeebfe341afa9316d25 by Miss Islington (bot) in branch '3.7': bpo-35992: Use PySequence_GetItem only if sq_item is not NULL (GH-11857) https://github.com/python/cpython/commit/a7f929db605326da452fbdeebfe341afa9316d25
History
Date User Action Args
2022-04-11 14:59:11 admin set github: 80173
2019-02-17 23:35:10 levkivskyi set status: open -> closedresolution: fixedstage: patch review -> resolved
2019-02-17 23:33:09 miss-islington set nosy: + miss-islingtonmessages: +
2019-02-17 23:14:07 miss-islington set pull_requests: + <pull%5Frequest11936>
2019-02-17 23:13:55 levkivskyi set messages: +
2019-02-14 11:57:56 levkivskyi set nosy: + gvanrossummessages: +
2019-02-14 11:56:42 levkivskyi set keywords: + patchstage: patch reviewpull_requests: + <pull%5Frequest11889>
2019-02-14 06:23:18 xtreak set nosy: + levkivskyi
2019-02-14 06:14:12 donovick create