MCPcopy Create free account
hub / github.com/fabioz/PyDev.Debugger / push

Method push

_pydevd_bundle/pydevd_console.py:93–133  ·  view source on GitHub ↗

Change built-in stdout and stderr methods by the new custom StdMessage. execute the InteractiveConsole.push. Change the stdout and stderr back be the original built-ins :param buffer_output: if False won't redirect the output. Return boolean (True if more in

(self, line, frame, buffer_output=True)

Source from the content-addressed store, hash-verified

91
92 @overrides(InteractiveConsole.push)
93 def push(self, line, frame, buffer_output=True):
94 """Change built-in stdout and stderr methods by the
95 new custom StdMessage.
96 execute the InteractiveConsole.push.
97 Change the stdout and stderr back be the original built-ins
98
99 :param buffer_output: if False won't redirect the output.
100
101 Return boolean (True if more input is required else False),
102 output_messages and input_messages
103 """
104 self.__buffer_output = buffer_output
105 more = False
106 if buffer_output:
107 original_stdout = sys.stdout
108 original_stderr = sys.stderr
109 try:
110 try:
111 self.frame = frame
112 if buffer_output:
113 out = sys.stdout = IOBuf()
114 err = sys.stderr = IOBuf()
115 more = self.add_exec(line)
116 except Exception:
117 exc = get_exception_traceback_str()
118 if buffer_output:
119 err.buflist.append("Internal Error: %s" % (exc,))
120 else:
121 sys.stderr.write("Internal Error: %s\n" % (exc,))
122 finally:
123 # Remove frame references.
124 self.frame = None
125 frame = None
126 if buffer_output:
127 sys.stdout = original_stdout
128 sys.stderr = original_stderr
129
130 if buffer_output:
131 return more, out.buflist, err.buflist
132 else:
133 return more, [], []
134
135 @overrides(BaseInterpreterInterface.do_add_exec)
136 def do_add_exec(self, line):

Callers 2

do_add_execMethod · 0.45
execute_console_commandFunction · 0.45

Calls 5

IOBufClass · 0.90
add_execMethod · 0.45
appendMethod · 0.45
writeMethod · 0.45

Tested by

no test coverage detected