~ubuntu-branches/ubuntu/natty/python3.1/natty-security

« back to all changes in this revision

Viewing changes to Lib/asyncore.py

  • Committer: Bazaar Package Importer
  • Author(s): Matthias Klose
  • Date: 2010-07-06 16:52:42 UTC
  • mfrom: (1.2.1 upstream) (2.1.11 sid)
  • Revision ID: james.westby@ubuntu.com-20100706165242-2xv4i019r3et6c0j
Tags: 3.1.2+20100706-1ubuntu1
* Merge with Debian; remaining changes:
  - Regenerate the control file.
  - Add debian/patches/overwrite-semaphore-check for Lucid buildds.

Show diffs side-by-side

added added

removed removed

Lines of Context:
60
60
    socket_map = {}
61
61
 
62
62
def _strerror(err):
63
 
    res = os.strerror(err)
64
 
    if res == 'Unknown error':
65
 
        res = errorcode[err]
66
 
    return res
 
63
    try:
 
64
        return os.strerror(err)
 
65
    except (ValueError, OverflowError, NameError):
 
66
        if err in errorcode:
 
67
            return errorcode[err]
 
68
        return "Unknown error %s" %err
67
69
 
68
70
class ExitNow(Exception):
69
71
    pass
395
397
    # cheap inheritance, used to pass all other attribute
396
398
    # references to the underlying socket object.
397
399
    def __getattr__(self, attr):
398
 
        return getattr(self.socket, attr)
 
400
        try:
 
401
            return getattr(self.socket, attr)
 
402
        except AttributeError:
 
403
            raise AttributeError("%s instance has no attribute '%s'"
 
404
                                 %(self.__class__.__name__, attr))
399
405
 
400
406
    # log and log_info may be overridden to provide more sophisticated
401
407
    # logging and warning methods. In general, log is for 'hit' logging