New error handling in getattr().

This commit is contained in:
Guido van Rossum 1990-10-14 20:03:32 +00:00
parent 0539ba2c74
commit 2b654f74c2
2 changed files with 5 additions and 5 deletions

View file

@ -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;