File tree 2 files changed +13
-2
lines changed
2 files changed +13
-2
lines changed Original file line number Diff line number Diff line change @@ -350,7 +350,7 @@ def __init__(
350
350
if hasattr (input , "read" ):
351
351
self .fileobj = input
352
352
elif input == "-" :
353
- self .fileobj = sys .stdin .buffer
353
+ self .fileobj = sys .stdin if PY2 else sys . stdin .buffer
354
354
else :
355
355
self .fileobj = open (input , "rb" )
356
356
@@ -438,7 +438,7 @@ def __init__(
438
438
self .filelike_fileobj = True
439
439
# If the output filename is -, then use stdout
440
440
elif output == "-" :
441
- self .fileobj = sys .stdout
441
+ self .fileobj = sys .stdout if PY2 else sys . stdout . buffer
442
442
self .filelike_fileobj = True
443
443
else :
444
444
self .fileobj = open (output , "wb" )
Original file line number Diff line number Diff line change 2
2
# vim: ts=4 sw=4 et ai:
3
3
from __future__ import print_function , unicode_literals
4
4
5
+ import sys
6
+
5
7
"""This module holds all objects shared by all other modules in partftpy."""
6
8
7
9
22
24
# be skipped to simulate lost packets.
23
25
24
26
27
+ PY2 = sys .version_info < (3 ,)
28
+
29
+
30
+ try :
31
+ from typing import TYPE_CHECKING
32
+ except :
33
+ TYPE_CHECKING = False
34
+
35
+
25
36
def tftpassert (condition , msg ):
26
37
"""This function is a simple utility that will check the condition
27
38
passed for a false state. If it finds one, it throws a TftpException
You can’t perform that action at this time.
0 commit comments