Mercurial > cpython-lru_cache-weakref
annotate Python/strerror.c @ 13402:7fbdb581838f legacy-trunk
Fixed unicode() to use the new API PyUnicode_FromEncodedObject().
This adds support for instance to the constructor (instances
have to define __str__ and can return Unicode objects via that
hook; string return values are decoded into Unicode using the
current default encoding).
| author | Marc-André Lemburg <mal@egenix.com> |
|---|---|
| date | Fri, 07 Jul 2000 13:48:25 +0000 |
| parents | 87ee82e5c56d |
| children | f79434ee41fa |
| rev | line source |
|---|---|
| 145 | 1 /*********************************************************** |
|
13255
916fb024ce94
Change copyright notice.
Guido van Rossum <guido@python.org>
parents:
4503
diff
changeset
|
2 Copyright (c) 2000, BeOpen.com. |
|
916fb024ce94
Change copyright notice.
Guido van Rossum <guido@python.org>
parents:
4503
diff
changeset
|
3 Copyright (c) 1995-2000, Corporation for National Research Initiatives. |
|
916fb024ce94
Change copyright notice.
Guido van Rossum <guido@python.org>
parents:
4503
diff
changeset
|
4 Copyright (c) 1990-1995, Stichting Mathematisch Centrum. |
|
916fb024ce94
Change copyright notice.
Guido van Rossum <guido@python.org>
parents:
4503
diff
changeset
|
5 All rights reserved. |
| 145 | 6 |
|
13255
916fb024ce94
Change copyright notice.
Guido van Rossum <guido@python.org>
parents:
4503
diff
changeset
|
7 See the file "Misc/COPYRIGHT" for information on usage and |
|
916fb024ce94
Change copyright notice.
Guido van Rossum <guido@python.org>
parents:
4503
diff
changeset
|
8 redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES. |
| 145 | 9 ******************************************************************/ |
| 10 | |
|
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
|
11 /* PD implementation of strerror() for systems that don't have it. |
| 6 | 12 Author: Guido van Rossum, CWI Amsterdam, Oct. 1990, <guido@cwi.nl>. */ |
| 13 | |
| 14 #include <stdio.h> | |
| 15 | |
| 16 extern int sys_nerr; | |
| 17 extern char *sys_errlist[]; | |
| 18 | |
| 19 char * | |
| 20 strerror(err) | |
| 21 int err; | |
| 22 { | |
| 23 static char buf[20]; | |
| 24 if (err >= 0 && err < sys_nerr) | |
| 25 return sys_errlist[err]; | |
| 26 sprintf(buf, "Unknown errno %d", err); | |
| 27 return buf; | |
| 28 } | |
|
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
|
29 |
|
1848
b724599401ff
Merge back to main trunk
Guido van Rossum <guido@python.org>
parents:
1257
diff
changeset
|
30 #ifdef macintosh |
|
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
|
31 int sys_nerr = 0; |
|
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
|
32 char *sys_errlist[1] = 0; |
|
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
|
33 #endif |
