annotate Python/strerror.c @ 45151:643c1397f954 legacy-trunk

#1750076: Debugger did not step on every iteration of a while statement. The mapping between bytecode offsets and source lines (lnotab) did not contain an entry for the beginning of the loop. Now it does, and the lnotab can be a bit larger: in particular, several statements on the same line generate several entries. However, this does not bother the settrace function, which will trigger only one 'line' event. The lnotab seems to be exactly the same as with python2.4.
author Amaury Forgeot d'Arc <amauryfa@gmail.com>
date Mon, 04 Feb 2008 21:45:05 +0000
parents 86fdf8fe7f17
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
145
853b736a6a9e Added copyright notice.
Guido van Rossum <guido@python.org>
parents: 61
diff changeset
1
61
5c4dd9348e81 Added provision for THINK C which doesn't have sys_nerrors or sys_errlist.
Guido van Rossum <guido@python.org>
parents: 6
diff changeset
2 /* PD implementation of strerror() for systems that don't have it.
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
3 Author: Guido van Rossum, CWI Amsterdam, Oct. 1990, <guido@cwi.nl>. */
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
4
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
5 #include <stdio.h>
21077
379fc66f4c96 Use PyOS_snprintf instead of sprintf.
Jeremy Hylton <jeremy@alum.mit.edu>
parents: 14375
diff changeset
6 #include "Python.h"
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
7
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
8 extern int sys_nerr;
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
9 extern char *sys_errlist[];
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
10
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
11 char *
13658
f79434ee41fa Mass ANSIfication of function definitions. Doesn't cover all 'extern'
Thomas Wouters <thomas@python.org>
parents: 13256
diff changeset
12 strerror(int err)
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
13 {
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
14 static char buf[20];
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
15 if (err >= 0 && err < sys_nerr)
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
16 return sys_errlist[err];
21077
379fc66f4c96 Use PyOS_snprintf instead of sprintf.
Jeremy Hylton <jeremy@alum.mit.edu>
parents: 14375
diff changeset
17 PyOS_snprintf(buf, sizeof(buf), "Unknown errno %d", err);
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
18 return buf;
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
19 }