File tree Expand file tree Collapse file tree 2 files changed +13
-2
lines changed
Expand file tree Collapse file tree 2 files changed +13
-2
lines changed Original file line number Diff line number Diff line change @@ -350,7 +350,7 @@ def __init__(
350350 if hasattr (input , "read" ):
351351 self .fileobj = input
352352 elif input == "-" :
353- self .fileobj = sys .stdin .buffer
353+ self .fileobj = sys .stdin if PY2 else sys . stdin .buffer
354354 else :
355355 self .fileobj = open (input , "rb" )
356356
@@ -438,7 +438,7 @@ def __init__(
438438 self .filelike_fileobj = True
439439 # If the output filename is -, then use stdout
440440 elif output == "-" :
441- self .fileobj = sys .stdout
441+ self .fileobj = sys .stdout if PY2 else sys . stdout . buffer
442442 self .filelike_fileobj = True
443443 else :
444444 self .fileobj = open (output , "wb" )
Original file line number Diff line number Diff line change 22# vim: ts=4 sw=4 et ai:
33from __future__ import print_function , unicode_literals
44
5+ import sys
6+
57"""This module holds all objects shared by all other modules in partftpy."""
68
79
2224# be skipped to simulate lost packets.
2325
2426
27+ PY2 = sys .version_info < (3 ,)
28+
29+
30+ try :
31+ from typing import TYPE_CHECKING
32+ except :
33+ TYPE_CHECKING = False
34+
35+
2536def tftpassert (condition , msg ):
2637 """This function is a simple utility that will check the condition
2738 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