[New-bugs-announce] [issue18090] dict_contains first argument declared register, and shouldn't be
report at bugs.python.org
Wed May 29 03:49:54 CEST 2013
New submission from Larry Hastings:
I'm monkeying around with CPython trunk, and just noticed the following declaration in Objects/dictobject.c:
static PyObject *
dict_contains(register PyDictObject *mp, PyObject *key)
Although dict_contains is a static method, it's cast to PyCFunction and stored in the methoddef array for the dict class. Therefore it must be callable when cast to a PyCFunction--indeed, that's the only way it is ever called.
Although the "register" keyword is at best a vague hope, surely it'd be bad news if our wish was granted? The first argument to the PyCFunction typedef is *not* declared register. So if the caller pushed the first argument on the stack, and dict_contains went looking for its first argument in a register... kablooey.
Surely we must remove the "register" keyword to this function, and similarly clean up all other functions ever cast to PyCFunction or PyCFunctionWithKeywords.
The "register" keyword isn't just a euphemism for "I want this code to go faster" -ly yours,
components: Interpreter Core
stage: needs patch
title: dict_contains first argument declared register, and shouldn't be
versions: Python 3.4
Python tracker <report at bugs.python.org>
More information about the New-bugs-announce