Ignore:
Timestamp:
Mar 19, 2014, 11:31:01 PM (11 years ago)
Author:
dmik
Message:

python: Merge vendor 2.7.6 to trunk.

Location:
python/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • python/trunk

  • python/trunk/Lib/gettext.py

    r60 r391  
    324324            # Unicode using the character encoding specified in the charset
    325325            # parameter of the Content-Type header.  The gettext documentation
    326             # strongly encourages msgids to be us-ascii, but some appliations
     326            # strongly encourages msgids to be us-ascii, but some applications
    327327            # require alternative encodings (e.g. Zope's ZCML and ZPT).  For
    328328            # traditional gettext applications, the msgid conversion will
     
    475475            return NullTranslations()
    476476        raise IOError(ENOENT, 'No translation file found for domain', domain)
    477     # TBD: do we need to worry about the file pointer getting collected?
    478477    # Avoid opening, reading, and parsing the .mo file after it's been done
    479478    # once.
    480479    result = None
    481480    for mofile in mofiles:
    482         key = os.path.abspath(mofile)
     481        key = (class_, os.path.abspath(mofile))
    483482        t = _translations.get(key)
    484483        if t is None:
    485             t = _translations.setdefault(key, class_(open(mofile, 'rb')))
     484            with open(mofile, 'rb') as fp:
     485                t = _translations.setdefault(key, class_(fp))
    486486        # Copy the translation object to allow setting fallbacks and
    487487        # output charset. All other instance data is shared with the
Note: See TracChangeset for help on using the changeset viewer.