Mercurial > cpython-lru_cache-weakref
comparison Python/errors.c @ 1252:c4cd0d9d8281 legacy-trunk
* Changed many files to use mkvalue() instead of newtupleobject().
* Fixcprt.py: added [-y file] option, do only files younger than file.
* modsupport.[ch]: added vmkvalue().
* intobject.c: use mkvalue().
* stringobject.c: added "formatstring"; renamed string* to string_*;
ceval.c: call formatstring for string % value.
* longobject.c: close memory leak in divmod.
* parsetok.c: set result node to NULL when returning an error.
| author | Guido van Rossum <guido@python.org> |
|---|---|
| date | Tue, 16 Mar 1993 12:15:04 +0000 |
| parents | 0cd197947d81 |
| children | cd397266dc1c |
comparison
equal
deleted
inserted
replaced
| 1251:ca1728c4bd78 | 1252:c4cd0d9d8281 |
|---|---|
| 1 /*********************************************************** | 1 /*********************************************************** |
| 2 Copyright 1991, 1992 by Stichting Mathematisch Centrum, Amsterdam, The | 2 Copyright 1991, 1992, 1993 by Stichting Mathematisch Centrum, |
| 3 Netherlands. | 3 Amsterdam, The Netherlands. |
| 4 | 4 |
| 5 All Rights Reserved | 5 All Rights Reserved |
| 6 | 6 |
| 7 Permission to use, copy, modify, and distribute this software and its | 7 Permission to use, copy, modify, and distribute this software and its |
| 8 documentation for any purpose and without fee is hereby granted, | 8 documentation for any purpose and without fee is hereby granted, |
| 54 scheme to a multi-threaded environment, only the implementation of | 54 scheme to a multi-threaded environment, only the implementation of |
| 55 err_setval() has to be changed. | 55 err_setval() has to be changed. |
| 56 */ | 56 */ |
| 57 | 57 |
| 58 #include "allobjects.h" | 58 #include "allobjects.h" |
| 59 #include "modsupport.h" | |
| 59 | 60 |
| 60 #include <errno.h> | 61 #include <errno.h> |
| 61 #ifndef errno | 62 #ifndef errno |
| 62 extern int errno; | 63 extern int errno; |
| 63 #endif | 64 #endif |
| 151 object *v; | 152 object *v; |
| 152 if (errno == EINTR && intrcheck()) { | 153 if (errno == EINTR && intrcheck()) { |
| 153 err_set(KeyboardInterrupt); | 154 err_set(KeyboardInterrupt); |
| 154 return NULL; | 155 return NULL; |
| 155 } | 156 } |
| 156 v = newtupleobject(2); | 157 v = mkvalue("(is)", errno, strerror(errno)); |
| 157 if (v != NULL) { | 158 if (v != NULL) { |
| 158 settupleitem(v, 0, newintobject((long)errno)); | 159 err_setval(exc, v); |
| 159 settupleitem(v, 1, newstringobject(strerror(errno))); | 160 DECREF(v); |
| 160 } | 161 } |
| 161 err_setval(exc, v); | |
| 162 XDECREF(v); | |
| 163 return NULL; | 162 return NULL; |
| 164 } | 163 } |
| 165 | 164 |
| 166 void | 165 void |
| 167 err_badcall() | 166 err_badcall() |
