summaryrefslogtreecommitdiffstats
path: root/Python/marshal.c
diff options
context:
space:
mode:
Diffstat (limited to 'Python/marshal.c')
-rw-r--r--Python/marshal.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/Python/marshal.c b/Python/marshal.c
index a40aecc..3e106c2 100644
--- a/Python/marshal.c
+++ b/Python/marshal.c
@@ -147,7 +147,7 @@ w_object(PyObject *v, WFILE *p)
else if (v == Py_True) {
w_byte(TYPE_TRUE, p);
}
- else if (PyLong_Check(v)) {
+ else if (PyLong_CheckExact(v)) {
long x = PyLong_AsLong(v);
if ((x == -1) && PyErr_Occurred()) {
PyLongObject *ob = (PyLongObject *)v;
@@ -175,7 +175,7 @@ w_object(PyObject *v, WFILE *p)
}
}
}
- else if (PyFloat_Check(v)) {
+ else if (PyFloat_CheckExact(v)) {
if (p->version > 1) {
unsigned char buf[8];
if (_PyFloat_Pack8(PyFloat_AsDouble(v),
@@ -196,7 +196,7 @@ w_object(PyObject *v, WFILE *p)
}
}
#ifndef WITHOUT_COMPLEX
- else if (PyComplex_Check(v)) {
+ else if (PyComplex_CheckExact(v)) {
if (p->version > 1) {
unsigned char buf[8];
if (_PyFloat_Pack8(PyComplex_RealAsDouble(v),
@@ -228,7 +228,7 @@ w_object(PyObject *v, WFILE *p)
}
}
#endif
- else if (PyString_Check(v)) {
+ else if (PyString_CheckExact(v)) {
w_byte(TYPE_STRING, p);
n = PyString_GET_SIZE(v);
if (n > INT_MAX) {
@@ -240,7 +240,7 @@ w_object(PyObject *v, WFILE *p)
w_long((long)n, p);
w_string(PyString_AS_STRING(v), (int)n, p);
}
- else if (PyUnicode_Check(v)) {
+ else if (PyUnicode_CheckExact(v)) {
PyObject *utf8;
utf8 = PyUnicode_AsUTF8String(v);
if (utf8 == NULL) {
@@ -259,7 +259,7 @@ w_object(PyObject *v, WFILE *p)
w_string(PyString_AS_STRING(utf8), (int)n, p);
Py_DECREF(utf8);
}
- else if (PyTuple_Check(v)) {
+ else if (PyTuple_CheckExact(v)) {
w_byte(TYPE_TUPLE, p);
n = PyTuple_Size(v);
w_long((long)n, p);
@@ -267,7 +267,7 @@ w_object(PyObject *v, WFILE *p)
w_object(PyTuple_GET_ITEM(v, i), p);
}
}
- else if (PyList_Check(v)) {
+ else if (PyList_CheckExact(v)) {
w_byte(TYPE_LIST, p);
n = PyList_GET_SIZE(v);
w_long((long)n, p);
@@ -275,7 +275,7 @@ w_object(PyObject *v, WFILE *p)
w_object(PyList_GET_ITEM(v, i), p);
}
}
- else if (PyDict_Check(v)) {
+ else if (PyDict_CheckExact(v)) {
Py_ssize_t pos;
PyObject *key, *value;
w_byte(TYPE_DICT, p);
@@ -287,7 +287,7 @@ w_object(PyObject *v, WFILE *p)
}
w_object((PyObject *)NULL, p);
}
- else if (PyAnySet_Check(v)) {
+ else if (PyAnySet_CheckExact(v)) {
PyObject *value, *it;
if (PyObject_TypeCheck(v, &PySet_Type))