Kaydet (Commit) 63db5b65 authored tarafından Ezio Melotti's avatar Ezio Melotti

Merge with 3.2 and also remove captured_output from __all__ (see #7960).

...@@ -35,8 +35,8 @@ __all__ = [ ...@@ -35,8 +35,8 @@ __all__ = [
"is_resource_enabled", "requires", "find_unused_port", "bind_port", "is_resource_enabled", "requires", "find_unused_port", "bind_port",
"IPV6_ENABLED", "is_jython", "TESTFN", "HOST", "SAVEDCWD", "temp_cwd", "IPV6_ENABLED", "is_jython", "TESTFN", "HOST", "SAVEDCWD", "temp_cwd",
"findfile", "sortdict", "check_syntax_error", "open_urlresource", "findfile", "sortdict", "check_syntax_error", "open_urlresource",
"check_warnings", "CleanImport", "EnvironmentVarGuard", "check_warnings", "CleanImport", "EnvironmentVarGuard", "TransientResource",
"TransientResource", "captured_output", "captured_stdout", "time_out", "captured_stdout", "captured_stdin", "captured_stderr", "time_out",
"socket_peer_reset", "ioerror_peer_reset", "run_with_locale", 'temp_umask', "socket_peer_reset", "ioerror_peer_reset", "run_with_locale", 'temp_umask',
"transient_internet", "set_memlimit", "bigmemtest", "bigaddrspacetest", "transient_internet", "set_memlimit", "bigmemtest", "bigaddrspacetest",
"BasicTestRunner", "run_unittest", "run_doctest", "threading_setup", "BasicTestRunner", "run_unittest", "run_doctest", "threading_setup",
...@@ -887,7 +887,7 @@ def transient_internet(resource_name, *, timeout=30.0, errnos=()): ...@@ -887,7 +887,7 @@ def transient_internet(resource_name, *, timeout=30.0, errnos=()):
@contextlib.contextmanager @contextlib.contextmanager
def captured_output(stream_name): def captured_output(stream_name):
"""Return a context manager used by captured_stdout and captured_stdin """Return a context manager used by captured_stdout/stdin/stderr
that temporarily replaces the sys stream *stream_name* with a StringIO.""" that temporarily replaces the sys stream *stream_name* with a StringIO."""
import io import io
orig_stdout = getattr(sys, stream_name) orig_stdout = getattr(sys, stream_name)
...@@ -912,6 +912,7 @@ def captured_stderr(): ...@@ -912,6 +912,7 @@ def captured_stderr():
def captured_stdin(): def captured_stdin():
return captured_output("stdin") return captured_output("stdin")
def gc_collect(): def gc_collect():
"""Force as many objects as possible to be collected. """Force as many objects as possible to be collected.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment