classification
Title: Add a warning section exaplaining that tempfiles are opened in binary mode
Type: Stage: resolved
Components: Documentation Versions: Python 3.4
process
Status: closed Resolution: rejected
Dependencies: Superseder:
Assigned To: docs@python Nosy List: Sebastian.Kreft.Deezer, docs@python, josh.r
Priority: normal Keywords:

Created on 2014-06-02 13:35 by Sebastian.Kreft.Deezer, last changed 2014-06-03 21:58 by r.david.murray. This issue is now closed.

Messages (2)
msg219585 - (view) Author: Sebastian Kreft (Sebastian.Kreft.Deezer) Date: 2014-06-02 13:35
Although it is already explained that the default mode of the opened tempfiles is 'w+b' a warning/notice section should be included to make it clearer.

I think this is important as the default for the open function is to return strings and not bytes.

I just had to debug an error with traceback, as traceback.print_exc expects a file capable of handling unicode.
msg219723 - (view) Author: Josh Rosenberg (josh.r) * (Python triager) Date: 2014-06-03 21:53
Adding warnings for something that is clearly documented (both in the constructor prototype line and again in the spelled out documentation of the "mode" argument) is wasteful, particularly when accidental misuse would immediately lead to an exception being thrown the second you attempted to write a str (so there is no risk of partial or silent failure that might lead to an inconsistent state).

As a rule, Python doesn't litter the documentation with warnings unless it's a matter of security or minor version compatibility. This doesn't affect security, behaves identically across all releases of Python 3, etc.
History
Date User Action Args
2014-06-03 21:58:09r.david.murraysetstatus: open -> closed
resolution: rejected
stage: resolved
2014-06-03 21:53:56josh.rsetnosy: + josh.r
messages: + msg219723
2014-06-02 13:35:34Sebastian.Kreft.Deezercreate