Backport 52501:
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.
This commit is contained in:
parent
aabdd5480c
commit
b5fdf0da21
|
@ -25,6 +25,7 @@ typedef struct {
|
||||||
static void
|
static void
|
||||||
lock_dealloc(lockobject *self)
|
lock_dealloc(lockobject *self)
|
||||||
{
|
{
|
||||||
|
assert(self->lock_lock);
|
||||||
/* Unlock the lock so it's safe to free it */
|
/* Unlock the lock so it's safe to free it */
|
||||||
PyThread_acquire_lock(self->lock_lock, 0);
|
PyThread_acquire_lock(self->lock_lock, 0);
|
||||||
PyThread_release_lock(self->lock_lock);
|
PyThread_release_lock(self->lock_lock);
|
||||||
|
|
|
@ -983,6 +983,8 @@ svnversion_init(void)
|
||||||
|
|
||||||
br_start = python + 8;
|
br_start = python + 8;
|
||||||
br_end = strchr(br_start, '/');
|
br_end = strchr(br_start, '/');
|
||||||
|
assert(br_end);
|
||||||
|
|
||||||
/* Works even for trunk,
|
/* Works even for trunk,
|
||||||
as we are in trunk/Python/sysmodule.c */
|
as we are in trunk/Python/sysmodule.c */
|
||||||
br_end2 = strchr(br_end+1, '/');
|
br_end2 = strchr(br_end+1, '/');
|
||||||
|
@ -995,6 +997,8 @@ svnversion_init(void)
|
||||||
}
|
}
|
||||||
else if (istag || strncmp(br_start, "branches", 8) == 0) {
|
else if (istag || strncmp(br_start, "branches", 8) == 0) {
|
||||||
len = br_end2 - br_start;
|
len = br_end2 - br_start;
|
||||||
|
assert(len >= 13);
|
||||||
|
assert(len < (sizeof(patchlevel_revision) - 13));
|
||||||
strncpy(branch, br_start, len);
|
strncpy(branch, br_start, len);
|
||||||
branch[len] = '\0';
|
branch[len] = '\0';
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue