Skip to content

Commit e858ed1

Browse files
committed
Remove bpython._py3compat.prepare_for_exec
1 parent 07ec4e9 commit e858ed1

File tree

2 files changed

+5
-22
lines changed

2 files changed

+5
-22
lines changed

bpython/_py3compat.py

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -37,18 +37,6 @@
3737
py3 = sys.version_info[0] == 3
3838

3939

40-
if py3 or sys.version_info[:3] >= (2, 7, 3):
41-
42-
def prepare_for_exec(arg, encoding=None):
43-
return arg
44-
45-
46-
else:
47-
48-
def prepare_for_exec(arg, encoding=None):
49-
return arg.encode(encoding)
50-
51-
5240
if py3:
5341

5442
def try_decode(s, encoding):

bpython/repl.py

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444

4545
from . import autocomplete
4646
from . import inspection
47-
from ._py3compat import py3, prepare_for_exec
47+
from ._py3compat import py3
4848
from .clipboard import get_clipboard, CopyFailed
4949
from .config import getpreferredencoding
5050
from .formatter import Parenthesis
@@ -1169,14 +1169,12 @@ def send_to_external_editor(self, text):
11691169
exited with non-zero"""
11701170

11711171
encoding = getpreferredencoding()
1172-
editor_args = shlex.split(
1173-
prepare_for_exec(self.config.editor, encoding)
1174-
)
1172+
editor_args = shlex.split(self.config.editor)
11751173
with tempfile.NamedTemporaryFile(suffix=".py") as temp:
11761174
temp.write(text.encode(encoding))
11771175
temp.flush()
11781176

1179-
args = editor_args + [prepare_for_exec(temp.name, encoding)]
1177+
args = editor_args + [temp.name]
11801178
if subprocess.call(args) == 0:
11811179
with open(temp.name) as f:
11821180
if py3:
@@ -1187,11 +1185,8 @@ def send_to_external_editor(self, text):
11871185
return text
11881186

11891187
def open_in_external_editor(self, filename):
1190-
encoding = getpreferredencoding()
1191-
editor_args = shlex.split(
1192-
prepare_for_exec(self.config.editor, encoding)
1193-
)
1194-
args = editor_args + [prepare_for_exec(filename, encoding)]
1188+
editor_args = shlex.split(self.config.editor)
1189+
args = editor_args + [filename]
11951190
return subprocess.call(args) == 0
11961191

11971192
def edit_config(self):

0 commit comments

Comments
 (0)