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 <rep...@bugs.python.org>
<http://bugs.python.org/issue30963>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to