tomerfiliba-org / reedsolomon

⏳🛡 Pythonic universal errors-and-erasures Reed-Solomon codec to protect your data from errors and bitrot. Includes a future-proof zero-dependencies pure-python implementation 🔮 and an optional speed-optimized Cython/C extension 🚀
http://pypi.python.org/pypi/reedsolo
Other
351 stars 86 forks source link

fix: close file after opening #61

Closed henryiii closed 1 year ago

henryiii commented 1 year ago

You must always close a file after opening it. The current code might not work on Windows + PyPy, since it's assuming the garbage collector will run (which it won't on PyPy) & the file descriptor will be released (which is required on Windows).

I'd recommend just moving this to setup.cfg & setting long_description = file: README.rst there, long term. See https://scikit-hep.org/developer/packaging for an example.

lrq3000 commented 1 year ago

Thank you for pointing this huge code smell! It's an ancient artifact that got copy/pasted over innumerable times, I never thought that the file handle would stay open, but this is very logical knowing how setuptools work!

I did not merge because I rather deleted all duplicated entries between setup.py and pyproject.toml following your other advices elsewhere, but I will keep your suggestion in mind for other projects.

Thank you very much for your help, I am convinced the module is now packaged in a much more robust and future-proof and manageable manner, it's all a lot more cleaner, the new standards and tooling are awesome! :D