[Python-checkins] The current documentation says it returns None if the name is not found, but (GH-26785) (GH-27372)

ambv webhook-mailer at python.org
Mon Jul 26 15:35:51 EDT 2021


https://github.com/python/cpython/commit/3f1389459abe415299d340c6af77d5ffe20c8fd6
commit: 3f1389459abe415299d340c6af77d5ffe20c8fd6
branch: 3.9
author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com>
committer: ambv <lukasz at langa.pl>
date: 2021-07-26T21:35:46+02:00
summary:

The current documentation says it returns None if the name is not found, but (GH-26785) (GH-27372)

the implementation uses [] and will raise KeyError instead.

Noticed by @srittau in python/typeshed at 5659.
(cherry picked from commit f22737abfa07605f4ed1a99cfa97a26520b6c5c2)

Co-authored-by: Jelle Zijlstra <jelle.zijlstra at gmail.com>

files:
A Misc/NEWS.d/next/Documentation/2021-06-18-06-44-45.bpo-44453.3PIkj2.rst
M Doc/library/sysconfig.rst

diff --git a/Doc/library/sysconfig.rst b/Doc/library/sysconfig.rst
index c9306e9bf9de1..641abf436b962 100644
--- a/Doc/library/sysconfig.rst
+++ b/Doc/library/sysconfig.rst
@@ -138,7 +138,7 @@ identifier.  Python currently uses eight paths:
    If *expand* is set to ``False``, the path will not be expanded using the
    variables.
 
-   If *name* is not found, return ``None``.
+   If *name* is not found, raise a :exc:`KeyError`.
 
 
 .. function:: get_paths([scheme, [vars, [expand]]])
diff --git a/Misc/NEWS.d/next/Documentation/2021-06-18-06-44-45.bpo-44453.3PIkj2.rst b/Misc/NEWS.d/next/Documentation/2021-06-18-06-44-45.bpo-44453.3PIkj2.rst
new file mode 100644
index 0000000000000..fd72cf525c32f
--- /dev/null
+++ b/Misc/NEWS.d/next/Documentation/2021-06-18-06-44-45.bpo-44453.3PIkj2.rst
@@ -0,0 +1 @@
+Fix documentation for the return type of :func:`sysconfig.get_path`.



More information about the Python-checkins mailing list