Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 3d9dee8

Browse filesBrowse files
committed
Merge in main branch
2 parents 0c4914b + 4cdfca7 commit 3d9dee8
Copy full SHA for 3d9dee8

2 files changed

+17-4Lines changed: 17 additions & 4 deletions

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎bpython/args.py‎

Copy file name to clipboardExpand all lines: bpython/args.py
+9-4Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -88,10 +88,7 @@ def parse(args, extras=None):
8888
raise SystemExit
8989

9090
if not (sys.stdin.isatty() and sys.stdout.isatty()):
91-
interpreter = code.InteractiveInterpreter()
92-
interpreter.runsource(sys.stdin.read())
93-
raise SystemExit
94-
91+
run_stdin(sys.stdin)
9592
path = os.path.expanduser('~/.bpythonrc')
9693
# migrating old configuration file
9794
if os.path.isfile(path):
@@ -113,3 +110,11 @@ def exec_code(interpreter, args):
113110
sys.path.insert(0, os.path.abspath(os.path.dirname(args[0])))
114111
interpreter.runcode(code_obj)
115112
sys.argv = old_argv
113+
114+
def run_stdin(stdin):
115+
"""
116+
Run code from a file-like object and exit.
117+
"""
118+
interpreter = code.InteractiveInterpreter()
119+
interpreter.runsource(stdin.read())
120+
raise SystemExit
Collapse file

‎bpython/gtk_.py‎

Copy file name to clipboardExpand all lines: bpython/gtk_.py
+8Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,14 @@
5050
_COLORS = dict(b='blue', c='cyan', g='green', m='magenta', r='red',
5151
w='white', y='yellow', k='black', d='black')
5252

53+
def run_stdin(stdin):
54+
"""
55+
Overwrite stdin reader from args as GTK does not supply a stdin/stdout
56+
as a tty.
57+
"""
58+
pass
59+
60+
bpython.args.run_stdin = run_stdin
5361

5462
class ArgspecFormatter(object):
5563
"""

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.