• Jurko Gospodnetić's avatar
    simplify ContextualZipFile implementation and avoid DeprecationWarnings · e234ee81
    Jurko Gospodnetić authored
    ContextualZipFile tried to be smart and have its __new__ method return
    zipfile.ZipFile instances on Python versions supporting the zipfile.ZipFile
    context manager interface (i.e. only on Python [2.7, 3.0> & 3.2+) while on
    others it would return an actual ContextualZipFile instance.
    
    The new implementation seems much simpler and avoids a DeprecationWarning on
    Python [3.0, 3.2>. There zipFile.ZipFile's __new__ method implementation is
    actually inherited from object, and calling object.__new__ with extra
    parameters has been deprecated since Python 2.6 (it has even been converted to
    an error since Python 3.3).
    
    Notes on why there were no related problems in other Python versions:
    * Python versions prior to 2.5 were not affected because they did not yet
    deprecate passing extra parameters to object.__new__.
    * Python version 2.6 was not affected because there zipfile.ZipFile was
    implemented as an old-style class and therefore did not get its __new__ method
    called in the first place.
    * Python [2.7, 3.0> & 3.2+ - explained above.
    
    --HG--
    extra : source : 9388cc525f1919672fb916b0e62f80ca581072b7
    e234ee81
ez_setup.py 10.1 KB