of the PNG file or a "nil" surface if the data read is not a valid PNG image or memory could not be allocated for the operation. A nil surface can be checked for with cairo_surface_status(surface) which may return one of the following values:
cairo.types.Status.NoMemory cairo.types.Status.ReadError cairo.types.Status.PngError
Alternatively, you can allow errors to propagate through the drawing operations and check the status on the context upon completion using cairo.context.Context.status.