microsoft / knossos-ksc

Compiler with automatic differentiation
Other
45 stars 10 forks source link

Improve error handling around creation of temporary files #908

Closed dcrc2 closed 3 years ago

dcrc2 commented 3 years ago

Reduce the scope of the try in this code. This makes linters happier as they previously thought that fkso and fcpp might be used in the except block without having been initialized.

Also it seems we were asking ksc to write to fkso and fcpp while those files were kept open by the NamedTemporaryFile. Even though this seems to work (I was slightly surprised by that), it seems better to close the file before ksc writes to it.

dcrc2 commented 3 years ago

OK, thanks, something to come back to.