diff options
author | Guido van Rossum <guido@python.org> | 1990-10-14 20:03:32 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 1990-10-14 20:03:32 (GMT) |
commit | 2b654f74c23de18c25a9e0b36979322ef461223c (patch) | |
tree | aa52b4386765dfeee3727549f1f144b315dc0eb0 /Objects/moduleobject.c | |
parent | 0539ba2c742d96b09922e9795086be1dc39c82a1 (diff) | |
download | cpython-2b654f74c23de18c25a9e0b36979322ef461223c.zip cpython-2b654f74c23de18c25a9e0b36979322ef461223c.tar.gz cpython-2b654f74c23de18c25a9e0b36979322ef461223c.tar.bz2 |
New error handling in getattr().
Diffstat (limited to 'Objects/moduleobject.c')
-rw-r--r-- | Objects/moduleobject.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/Objects/moduleobject.c b/Objects/moduleobject.c index 95dc094..7b9e0e9 100644 --- a/Objects/moduleobject.c +++ b/Objects/moduleobject.c @@ -8,6 +8,7 @@ #include "dictobject.h" #include "moduleobject.h" #include "objimpl.h" +#include "errors.h" typedef struct { OB_HEAD @@ -94,10 +95,8 @@ modulegetattr(m, name) char *name; { object *res = dictlookup(m->md_dict, name); - if (res == NULL) { - if (errno == ENOENT) - errno = ESRCH; - } + if (res == NULL) + err_setstr(NameError, name); else INCREF(res); return res; |