[New-bugs-announce] [issue30963] xxlimited.c XxoObject_Check should be XxoObject_CheckExact
Jim Jewett
report at bugs.python.org
Tue Jul 18 17:17:58 EDT 2017
New submission from Jim Jewett:
https://github.com/python/cpython/blob/master/Modules/xxlimited.c#L28
#define XxoObject_Check(v) (Py_TYPE(v) == Xxo_Type)
assumes that the type cannot be subclassed, but does not say so. Since this is demo code, it would be better to use something like decimal:
#define PyDec_CheckExact(v) (Py_TYPE(v) == &PyDec_Type)
#define PyDec_Check(v) PyObject_TypeCheck(v, &PyDec_Type)
I *believe* (but haven't verified) that would be:
#define XxoObject_CheckExact(v) (Py_TYPE(v) == &Xxo_Type)
#define XxoObject_Check(v) PyObject_TypeCheck(v, &Xxo_Type)
----------
components: Extension Modules
messages: 298617
nosy: Jim.Jewett
priority: normal
severity: normal
stage: needs patch
status: open
title: xxlimited.c XxoObject_Check should be XxoObject_CheckExact
type: enhancement
versions: Python 3.7
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue30963>
_______________________________________
More information about the New-bugs-announce
mailing list