diff Objects/stringobject.c @ 21263:2f2abeeefd87 legacy-trunk

PyString_FromString: this requires its argument be non-NULL, but doesn't check it. Added an assert() to that effect.
author Tim Peters <tim.peters@gmail.com>
date Thu, 06 Dec 2001 20:29:32 +0000
parents 19186b17d25a
children 34a1a50e6ab6
line wrap: on
line diff
--- a/Objects/stringobject.c	Thu Dec 06 20:03:56 2001 +0000
+++ b/Objects/stringobject.c	Thu Dec 06 20:29:32 2001 +0000
@@ -105,8 +105,11 @@
 PyObject *
 PyString_FromString(const char *str)
 {
-	register size_t size = strlen(str);
+	register size_t size;
 	register PyStringObject *op;
+
+	assert(str != NULL);
+	size = strlen(str);
 	if (size > INT_MAX) {
 		PyErr_SetString(PyExc_OverflowError,
 			"string is too long for a Python string");