]> granicus.if.org Git - python/commitdiff
Tim Peters writes:
authorGuido van Rossum <guido@python.org>
Wed, 15 Sep 1999 22:48:09 +0000 (22:48 +0000)
committerGuido van Rossum <guido@python.org>
Wed, 15 Sep 1999 22:48:09 +0000 (22:48 +0000)
For a long time I've seen absurd tracebacks under -O (e.g., negative
line numbers), but very rarely.  Since I was looking at tracebacks
anyway, thought I'd track it down.  Turns out to be Guido's only
predictable blind spot <wink -- "char" is signed on some non-GvR
systems>.  Patch follows.

Python/compile.c

index 1e937e492abf0cdc2901c77ac4ae6be12272fc79..e4e37d53f8cb0e7ad0199dfc92fa78a75d3c29ba 100644 (file)
@@ -3451,7 +3451,7 @@ PyCode_Addr2Line(co, addrq)
        int addrq;
 {
        int size = PyString_Size(co->co_lnotab) / 2;
-       char *p = PyString_AsString(co->co_lnotab);
+       unsigned char *p = (unsigned char*)PyString_AsString(co->co_lnotab);
        int line = co->co_firstlineno;
        int addr = 0;
        while (--size >= 0) {