ENH: optimize: curve_fit now warns if pcov is undetermined

It fails if some test elsewhere raises an optimizewarning at the same place.

There's probably some way to reset the line cache of the warnings module, but I'm not sure how...