summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2012-04-27 11:55:39 (GMT)
committerVictor Stinner <victor.stinner@gmail.com>2012-04-27 11:55:39 (GMT)
commit8f825060f1c168b913f2ac299ca48d4e9375f34d (patch)
tree8f8a2fe0d64cd2fdf98fdb762ff1def490473bde /Modules
parent990eff0776a948b4a45b1c2750552c0c6864b5c7 (diff)
downloadcpython-8f825060f1c168b913f2ac299ca48d4e9375f34d.zip
cpython-8f825060f1c168b913f2ac299ca48d4e9375f34d.tar.gz
cpython-8f825060f1c168b913f2ac299ca48d4e9375f34d.tar.bz2
Check newly created consistency using _PyUnicode_CheckConsistency(str, 1)
* In debug mode, fill the string data with invalid characters * Simplify also reference counting in PyCodec_BackslashReplaceErrors() and PyCodec_XMLCharRefReplaceError()
Diffstat (limited to 'Modules')
-rw-r--r--Modules/_json.c1
-rw-r--r--Modules/md5module.c1
-rw-r--r--Modules/sha1module.c1
-rw-r--r--Modules/sha256module.c1
-rw-r--r--Modules/sha512module.c1
5 files changed, 5 insertions, 0 deletions
diff --git a/Modules/_json.c b/Modules/_json.c
index 95c658c..40c2ced 100644
--- a/Modules/_json.c
+++ b/Modules/_json.c
@@ -246,6 +246,7 @@ ascii_escape_unicode(PyObject *pystr)
}
}
output[chars++] = '"';
+ assert(_PyUnicode_CheckConsistency(rval, 1));
return rval;
}
diff --git a/Modules/md5module.c b/Modules/md5module.c
index 86f602e..ee44c48 100644
--- a/Modules/md5module.c
+++ b/Modules/md5module.c
@@ -397,6 +397,7 @@ MD5_hexdigest(MD5object *self, PyObject *unused)
c = (digest[i] & 0xf);
hex_digest[j++] = Py_hexdigits[c];
}
+ assert(_PyUnicode_CheckConsistency(retval, 1));
return retval;
}
diff --git a/Modules/sha1module.c b/Modules/sha1module.c
index 30e5c50..daea887 100644
--- a/Modules/sha1module.c
+++ b/Modules/sha1module.c
@@ -373,6 +373,7 @@ SHA1_hexdigest(SHA1object *self, PyObject *unused)
c = (digest[i] & 0xf);
hex_digest[j++] = Py_hexdigits[c];
}
+ assert(_PyUnicode_CheckConsistency(retval, 1));
return retval;
}
diff --git a/Modules/sha256module.c b/Modules/sha256module.c
index f1ef329..76d91af 100644
--- a/Modules/sha256module.c
+++ b/Modules/sha256module.c
@@ -466,6 +466,7 @@ SHA256_hexdigest(SHAobject *self, PyObject *unused)
c = (digest[i] & 0xf);
hex_digest[j++] = Py_hexdigits[c];
}
+ assert(_PyUnicode_CheckConsistency(retval, 1));
return retval;
}
diff --git a/Modules/sha512module.c b/Modules/sha512module.c
index 4f5a113..88f8a64 100644
--- a/Modules/sha512module.c
+++ b/Modules/sha512module.c
@@ -532,6 +532,7 @@ SHA512_hexdigest(SHAobject *self, PyObject *unused)
c = (digest[i] & 0xf);
hex_digest[j++] = Py_hexdigits[c];
}
+ assert(_PyUnicode_CheckConsistency(retval, 1));
return retval;
}