[issue32933] mock_open does not support iteration around text files.

Ned Deily report at bugs.python.org
Thu Sep 13 19:47:52 EDT 2018


Ned Deily <nad at python.org> added the comment:

While I think arguments could be made either way, this seems to me to be somewhat more of a bugfix (rather than a feature) in the sense that mock_open did not correctly emulate a real textfile open at least for an idiom that is commonly used (while acknowledging that mock_open does not claim to fully implement open or all classes of IO objects).  The key question to me is would backporting this change likely cause any change in behavior to existing programs running on 3.7.x or 3.6.x.  If yes, then we definitely shouldn't backport it.  If not, then there is now the issue that people using mock_open on 3.7.x (or possibly 3.6.x) still can't depend on its behavior unless they explicitly check for, say, 3.7.1 or 3.6.7.  That's not particularly user friendly, either.  So perhaps it *is* best to not backport; if the functionality is needed in earlier releases, one could create a PyPI package to provide it, for example.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue32933>
_______________________________________


More information about the Python-bugs-list mailing list