You don't use the parameter value here. I think you should call __init__ on Memory error with it to have it taken into account.