[Python-checkins] r52501 - in python/trunk: Modules/threadmodule.c Python/sysmodule.c

neal.norwitz python-checkins at python.org
Sat Oct 28 23:15:31 CEST 2006


Author: neal.norwitz
Date: Sat Oct 28 23:15:30 2006
New Revision: 52501

Modified:
   python/trunk/Modules/threadmodule.c
   python/trunk/Python/sysmodule.c
Log:
Add some asserts.  In sysmodule, I think these were to try to silence
some warnings from Klokwork.  They verify the assumptions of the format
of svn version output.

The assert in the thread module helped debug a problem on HP-UX.


Modified: python/trunk/Modules/threadmodule.c
==============================================================================
--- python/trunk/Modules/threadmodule.c	(original)
+++ python/trunk/Modules/threadmodule.c	Sat Oct 28 23:15:30 2006
@@ -25,6 +25,7 @@
 static void
 lock_dealloc(lockobject *self)
 {
+	assert(self->lock_lock);
 	/* Unlock the lock so it's safe to free it */
 	PyThread_acquire_lock(self->lock_lock, 0);
 	PyThread_release_lock(self->lock_lock);

Modified: python/trunk/Python/sysmodule.c
==============================================================================
--- python/trunk/Python/sysmodule.c	(original)
+++ python/trunk/Python/sysmodule.c	Sat Oct 28 23:15:30 2006
@@ -983,6 +983,8 @@
 
 	br_start = python + 8;
 	br_end = strchr(br_start, '/');
+	assert(br_end);
+
 	/* Works even for trunk,
 	   as we are in trunk/Python/sysmodule.c */
 	br_end2 = strchr(br_end+1, '/');
@@ -995,6 +997,8 @@
 	}
 	else if (istag || strncmp(br_start, "branches", 8) == 0) {
 		len = br_end2 - br_start;
+		assert(len >= 13);
+		assert(len < (sizeof(patchlevel_revision) - 13));
 		strncpy(branch, br_start, len);
 		branch[len] = '\0';
 


More information about the Python-checkins mailing list