Skip to content

Commit

Permalink
make rpyc more introspection friendly; closes #71
Browse files Browse the repository at this point in the history
  • Loading branch information
tomerfiliba committed Mar 26, 2012
1 parent 07036df commit b2870ad
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
2 changes: 2 additions & 0 deletions rpyc/core/stream.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ class ClosedFile(object):
"""Represents a closed file object (singleton)"""
__slots__ = ()
def __getattr__(self, name):
if name.startswith("__"): # issue 71
raise AttributeError("stream has been closed")
raise EOFError("stream has been closed")
def close(self):
pass
Expand Down
2 changes: 1 addition & 1 deletion rpyc/core/vinegar.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ class simply doesn't exist on the local machine), a :class:`GenericException`
if cls is None:
fullname = "%s.%s" % (modname, clsname)
if fullname not in _generic_exceptions_cache:
fakemodule = {"__module__" : "%s.%s" % (__name__, modname)}
fakemodule = {"__module__" : "%s/%s" % (__name__, modname)}
if isinstance(GenericException, ClassType):
_generic_exceptions_cache[fullname] = ClassType(fullname, (GenericException,), fakemodule)
else:
Expand Down
2 changes: 2 additions & 0 deletions rpyc/lib/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ class MissingModule(object):
def __init__(self, name):
self.__name = name
def __getattr__(self, name):
if name.startswith("__"): # issue 71
raise AttributeError("module %r not found" % (self.__name,))
raise ImportError("module %r not found" % (self.__name,))
def __bool__(self):
return False
Expand Down

0 comments on commit b2870ad

Please sign in to comment.