[Patches] getpath patch (repost)

Barry A. Warsaw bwarsaw@python.org
Tue, 23 May 2000 23:23:06 -0400 (EDT)


>>>>> "GW" == Greg Ward <gward@mems-exchange.org> writes:

    GW> Seems to me that this is really how the standard exceptions
    GW> should be defined.  IOError, OSError, TypeError, etc. really
    GW> are part of the language, and Python's implementation language
    GW> is C.  The whole idea of having such a fundamental part of the
    GW> language as the standard exceptions imported at run-time
    GW> strikes me as slow, prone to inexplicable failure, and
    GW> all-round dodgy at best.

Much of the current situation is historical.  My very first attempt at
class-based standard exceptions defined them as a big C string that
was execd.  Ug.

Implementing them as Python code helped considerably during
development and testing, but the link into the core interpreter is a
fragile one.  If you were to add, remove, or rename a class in
exception.py, you'd have to hack bltinmodule.c anyway.  It used to be
worse with optional string-based s.e.'s because even a change to the
hierarchy required a hack of the C code.

Now that the standard exception hierarchy and implementation is fairly
well fixed, it seems to me that unconditionally adopting the C module
for them makes a lot of sense.

-Barry