[docs] [issue13286] PEP 3151 breaks backward compatibility: it should be documented

STINNER Victor report at bugs.python.org
Fri Oct 28 16:32:53 CEST 2011


STINNER Victor <victor.stinner at haypocalc.com> added the comment:

The first example was extracted from Lib/importlib/_bootstrap.py. The code was maybe wrong, I don't know.

Another example:
----------------------
import errno
import os

try:
    os.rmdir("testdir")
except:
    pass
os.mkdir("testdir")

try:
    try:
        #os.mkdir("testdir")
        open("NOT EXISTING FILENAME")
    except OSError as exc:
        if exc.errno == errno.EEXIST:
            pass
        else:
            raise
    except IOError as exc:
        if exc.errno == errno.ENOENT:
            pass
        else:
            raise
except Exception:
    raise
    print("PEP 3151 broke backward compatibility on such pattern!")
----------------------

Uncomment mkdir() to test both paths.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue13286>
_______________________________________


More information about the docs mailing list