• Barry Warsaw's avatar
    Several changes that Python carry on in the face of errors in the · 98b6246c
    Barry Warsaw yazdı
    initialization of class exceptions.  Specifically:
    
    init_class_exc(): This function now returns an integer status of the
    class exception initialization.  No fatal errors in this method now.
    Also, use PySys_WriteStderr() when writing error messages.  When an
    error occurs in this function, 0 is returned, but the partial creation
    of the exception classes is not undone (this happens elsewhere).
    
    Things that could trigger the fallback:
    
        - exceptions.py fails to be imported (due to syntax error, etc.)
    
        - one of the exception classes is missing (e.g. due to library
          version mismatch)
    
        - exception class can't be inserted into __builtin__'s dictionary
    
        - MemoryError instance can't be pre-allocated
    
        - some other PyErr_Occurred
    
    newstdexception(): Changed the error message.  This is still a fatal
    error because if the string based exceptions can't be created, we
    really can't continue.
    
    initerrors(): Be sure to xdecref the .exc field, which might be
    non-NULL if class exceptions init was aborted.
    
    _PyBuiltin_Init_2(): If class exception init fails, print a warning
    message and reinstate the string based exceptions.
    98b6246c
bltinmodule.c 51.8 KB