Show More
@@ -506,6 +506,17 b" def mkstemp(suffix=b'', prefix=b'tmp', d" | |||||
506 | return tempfile.mkstemp(suffix, prefix, dir) |
|
506 | return tempfile.mkstemp(suffix, prefix, dir) | |
507 |
|
507 | |||
508 |
|
508 | |||
|
509 | # TemporaryFile does not support an "encoding=" argument on python2. | |||
|
510 | # This wrapper file are always open in byte mode. | |||
|
511 | def unnamedtempfile(mode=None, *args, **kwargs): | |||
|
512 | if mode is None: | |||
|
513 | mode = b'w+b' | |||
|
514 | else: | |||
|
515 | mode = sysstr(mode) | |||
|
516 | assert 'b' in mode | |||
|
517 | return tempfile.TemporaryFile(mode, *args, **kwargs) | |||
|
518 | ||||
|
519 | ||||
509 | # NamedTemporaryFile does not support an "encoding=" argument on python2. |
|
520 | # NamedTemporaryFile does not support an "encoding=" argument on python2. | |
510 | # This wrapper file are always open in byte mode. |
|
521 | # This wrapper file are always open in byte mode. | |
511 | def namedtempfile( |
|
522 | def namedtempfile( |
General Comments 0
You need to be logged in to leave comments.
Login now