New error handling in getattr().
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 @@
 	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;