bpo-33503: Fix the broken pypi link in the source and the documentation (GH-6814) (GH-6872)

(cherry picked from commit 19177fbd5d6d9b29ccc302d65f9d9417ece082ce)

Co-authored-by: Stéphane Wirtel <stephane@wirtel.be>
diff --git a/Doc/library/distribution.rst b/Doc/library/distribution.rst
index 3e6e84b..8d4befe 100644
--- a/Doc/library/distribution.rst
+++ b/Doc/library/distribution.rst
@@ -4,7 +4,7 @@
 
 These libraries help you with publishing and installing Python software.
 While these modules are designed to work in conjunction with the
-`Python Package Index <https://pypi.python.org/pypi>`__, they can also be used
+`Python Package Index <https://pypi.org>`__, they can also be used
 with a local index server, or without any index server at all.
 
 .. toctree::
diff --git a/Doc/library/index.rst b/Doc/library/index.rst
index da6a460..b8fbf44 100644
--- a/Doc/library/index.rst
+++ b/Doc/library/index.rst
@@ -30,7 +30,7 @@
 In addition to the standard library, there is a growing collection of
 several thousand components (from individual programs and modules to
 packages and entire application development frameworks), available from
-the `Python Package Index <https://pypi.python.org/pypi>`_.
+the `Python Package Index <https://pypi.org>`_.
 
 
 .. toctree::
diff --git a/Doc/library/pprint.rst b/Doc/library/pprint.rst
index 65d94fe..aa97d3e 100644
--- a/Doc/library/pprint.rst
+++ b/Doc/library/pprint.rst
@@ -212,12 +212,12 @@
 -------
 
 To demonstrate several uses of the :func:`pprint` function and its parameters,
-let's fetch information about a project from `PyPI <https://pypi.python.org/pypi>`_::
+let's fetch information about a project from `PyPI <https://pypi.org>`_::
 
    >>> import json
    >>> import pprint
    >>> from urllib.request import urlopen
-   >>> with urlopen('http://pypi.python.org/pypi/Twisted/json') as url:
+   >>> with urlopen('http://pypi.org/project/Twisted/json') as url:
    ...     http_info = url.info()
    ...     raw_data = url.read().decode(http_info.get_content_charset())
    >>> project_info = json.loads(raw_data)
@@ -248,9 +248,9 @@
              'maintainer': '',
              'maintainer_email': '',
              'name': 'Twisted',
-             'package_url': 'http://pypi.python.org/pypi/Twisted',
+             'package_url': 'http://pypi.org/project/Twisted',
              'platform': 'UNKNOWN',
-             'release_url': 'http://pypi.python.org/pypi/Twisted/12.3.0',
+             'release_url': 'http://pypi.org/project/Twisted/12.3.0',
              'requires_python': None,
              'stable_version': None,
              'summary': 'An asynchronous networking framework written in Python',
@@ -264,7 +264,7 @@
               'python_version': 'source',
               'size': 2615733,
               'upload_time': '2012-12-26T12:47:03',
-              'url': 'https://pypi.python.org/packages/source/T/Twisted/Twisted-12.3.0.tar.bz2'},
+              'url': 'https://pypi.org/packages/source/T/Twisted/Twisted-12.3.0.tar.bz2'},
              {'comment_text': '',
               'downloads': 5224,
               'filename': 'Twisted-12.3.0.win32-py2.7.msi',
@@ -274,7 +274,7 @@
               'python_version': '2.7',
               'size': 2916352,
               'upload_time': '2012-12-26T12:48:15',
-              'url': 'https://pypi.python.org/packages/2.7/T/Twisted/Twisted-12.3.0.win32-py2.7.msi'}]}
+              'url': 'https://pypi.org/packages/2.7/T/Twisted/Twisted-12.3.0.win32-py2.7.msi'}]}
 
 The result can be limited to a certain *depth* (ellipsis is used for deeper
 contents)::
@@ -301,9 +301,9 @@
              'maintainer': '',
              'maintainer_email': '',
              'name': 'Twisted',
-             'package_url': 'http://pypi.python.org/pypi/Twisted',
+             'package_url': 'http://pypi.org/project/Twisted',
              'platform': 'UNKNOWN',
-             'release_url': 'http://pypi.python.org/pypi/Twisted/12.3.0',
+             'release_url': 'http://pypi.org/project/Twisted/12.3.0',
              'requires_python': None,
              'stable_version': None,
              'summary': 'An asynchronous networking framework written in Python',
@@ -339,9 +339,9 @@
              'maintainer': '',
              'maintainer_email': '',
              'name': 'Twisted',
-             'package_url': 'http://pypi.python.org/pypi/Twisted',
+             'package_url': 'http://pypi.org/project/Twisted',
              'platform': 'UNKNOWN',
-             'release_url': 'http://pypi.python.org/pypi/Twisted/12.3.0',
+             'release_url': 'http://pypi.org/project/Twisted/12.3.0',
              'requires_python': None,
              'stable_version': None,
              'summary': 'An asynchronous networking '
diff --git a/Doc/library/re.rst b/Doc/library/re.rst
index d35aaf4..3a051dd 100644
--- a/Doc/library/re.rst
+++ b/Doc/library/re.rst
@@ -45,7 +45,7 @@
 
 .. seealso::
 
-   The third-party `regex <https://pypi.python.org/pypi/regex/>`_ module,
+   The third-party `regex <https://pypi.org/project/regex/>`_ module,
    which has an API compatible with the standard library :mod:`re` module,
    but offers additional functionality and a more thorough Unicode support.
 
diff --git a/Doc/library/ssl.rst b/Doc/library/ssl.rst
index 8082a38..f965494 100644
--- a/Doc/library/ssl.rst
+++ b/Doc/library/ssl.rst
@@ -2158,9 +2158,9 @@
                 (('commonName', 'www.python.org'),)),
     'subjectAltName': (('DNS', 'www.python.org'),
                        ('DNS', 'python.org'),
-                       ('DNS', 'pypi.python.org'),
+                       ('DNS', 'pypi.org'),
                        ('DNS', 'docs.python.org'),
-                       ('DNS', 'testpypi.python.org'),
+                       ('DNS', 'testpypi.org'),
                        ('DNS', 'bugs.python.org'),
                        ('DNS', 'wiki.python.org'),
                        ('DNS', 'hg.python.org'),
diff --git a/Doc/library/unittest.mock.rst b/Doc/library/unittest.mock.rst
index ac9dd3b..bb647bb 100644
--- a/Doc/library/unittest.mock.rst
+++ b/Doc/library/unittest.mock.rst
@@ -35,7 +35,7 @@
 used by many mocking frameworks.
 
 There is a backport of :mod:`unittest.mock` for earlier versions of Python,
-available as `mock on PyPI <https://pypi.python.org/pypi/mock>`_.
+available as `mock on PyPI <https://pypi.org/project/mock>`_.
 
 
 Quick Guide
@@ -2085,7 +2085,7 @@
     the start.  If you need more control over the data that you are feeding to
     the tested code you will need to customize this mock for yourself.  When that
     is insufficient, one of the in-memory filesystem packages on `PyPI
-    <https://pypi.python.org/pypi>`_ can offer a realistic filesystem for testing.
+    <https://pypi.org>`_ can offer a realistic filesystem for testing.
 
    .. versionchanged:: 3.4
       Added :meth:`~io.IOBase.readline` and :meth:`~io.IOBase.readlines` support.
diff --git a/Doc/library/xml.rst b/Doc/library/xml.rst
index d833b7f..63c24f8 100644
--- a/Doc/library/xml.rst
+++ b/Doc/library/xml.rst
@@ -130,8 +130,8 @@
 Python because they break backward compatibility.
 
 
-.. _defusedxml: https://pypi.python.org/pypi/defusedxml/
-.. _defusedexpat: https://pypi.python.org/pypi/defusedexpat/
+.. _defusedxml: https://pypi.org/project/defusedxml/
+.. _defusedexpat: https://pypi.org/project/defusedexpat/
 .. _Billion Laughs: https://en.wikipedia.org/wiki/Billion_laughs
 .. _ZIP bomb: https://en.wikipedia.org/wiki/Zip_bomb
 .. _DTD: https://en.wikipedia.org/wiki/Document_type_definition