Use AttributeError.
diff --git a/Lib/posixpath.py b/Lib/posixpath.py
index 7c13458..9a2ccb0 100644
--- a/Lib/posixpath.py
+++ b/Lib/posixpath.py
@@ -95,7 +95,7 @@
 def islink(path):
 	try:
 		st = posix.lstat(path)
-	except (posix.error, NameError):
+	except (posix.error, AttributeError):
 		return 0
 	return stat.S_ISLNK(st[stat.ST_MODE])