bpo-22640: Add silent mode to py_compile.compile() (GH-12976)

diff --git a/Doc/library/py_compile.rst b/Doc/library/py_compile.rst
index 8cb5a4d..3824353 100644
--- a/Doc/library/py_compile.rst
+++ b/Doc/library/py_compile.rst
@@ -42,6 +42,13 @@
    is raised.  This function returns the path to byte-compiled file, i.e.
    whatever *cfile* value was used.
 
+   The *doraise* and *quiet* arguments determine how errors are handled while
+   compiling file. If *quiet* is 0 or 1, and *doraise* is false, the default
+   behaviour is enabled: an error string is written to ``sys.stderr``, and the
+   function returns ``None`` instead of a path. If *doraise* is true,
+   a :exc:`PyCompileError` is raised instead. However if *quiet* is 2,
+   no message is written, and *doraise* has no effect.
+
    If the path that *cfile* becomes (either explicitly specified or computed)
    is a symlink or non-regular file, :exc:`FileExistsError` will be raised.
    This is to act as a warning that import will turn those paths into regular
@@ -82,6 +89,9 @@
       overrides the value of the *invalidation_mode* argument, and determines
       its default value instead.
 
+   .. versionchanged:: 3.8
+      The *quiet* parameter was added.
+
 
 .. class:: PycInvalidationMode
 
diff --git a/Doc/whatsnew/3.8.rst b/Doc/whatsnew/3.8.rst
index b32cec1..aaa6ffe 100644
--- a/Doc/whatsnew/3.8.rst
+++ b/Doc/whatsnew/3.8.rst
@@ -537,6 +537,13 @@
 (Contributed by Jon Janzen in :issue:`26707`.)
 
 
+py_compile
+----------
+
+:func:`py_compile.compile` now supports silent mode.
+(Contributed by Joannah Nanjekye in :issue:`22640`.)
+
+
 socket
 ------