[2.7] bpo-33503: Fix the broken pypi link in the source and the documentation (GH-6814). (GH-6905)

(cherry picked from commit 19177fbd5d6d9b29ccc302d65f9d9417ece082ce)

Co-authored-by: Stéphane Wirtel <stephane@wirtel.be>
diff --git a/Doc/library/bz2.rst b/Doc/library/bz2.rst
index 71957ec..e764f39 100644
--- a/Doc/library/bz2.rst
+++ b/Doc/library/bz2.rst
@@ -74,7 +74,7 @@
       input file, only the first stream will be accessible. If you require
       support for multi-stream files, consider using the third-party
       :mod:`bz2file` module (available from
-      `PyPI <https://pypi.python.org/pypi/bz2file>`_). This module provides a
+      `PyPI <https://pypi.org/project/bz2file>`_). This module provides a
       backport of Python 3.3's :class:`BZ2File` class, which does support
       multi-stream files.
 
diff --git a/Doc/library/datetime.rst b/Doc/library/datetime.rst
index b8d86e3..d2c1c56 100644
--- a/Doc/library/datetime.rst
+++ b/Doc/library/datetime.rst
@@ -1566,7 +1566,7 @@
 
 .. seealso::
 
-   `pytz <https://pypi.python.org/pypi/pytz/>`_
+   `pytz <https://pypi.org/project/pytz/>`_
       The standard library has no :class:`tzinfo` instances, but
       there exists a third-party library which brings the *IANA timezone
       database* (also known as the Olson database) to Python: *pytz*.
diff --git a/Doc/library/distribution.rst b/Doc/library/distribution.rst
index b560999..21dd18d 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>`__, 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 97cf3ea..31ca6df 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 ffa27d4..3f09b21 100644
--- a/Doc/library/pprint.rst
+++ b/Doc/library/pprint.rst
@@ -234,4 +234,3 @@
     ['aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
      'bbbbbbbbbbbbbbbbbbbbbbbbbbbbbb'],
     ['cccccccccccccccccccc', 'dddddddddddddddddddd']]
-
diff --git a/Doc/library/re.rst b/Doc/library/re.rst
index c424230..228fcfe 100644
--- a/Doc/library/re.rst
+++ b/Doc/library/re.rst
@@ -35,7 +35,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 89b9ff3..a612e6e 100644
--- a/Doc/library/ssl.rst
+++ b/Doc/library/ssl.rst
@@ -1586,7 +1586,7 @@
                 (('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', 'bugs.python.org'),
diff --git a/Doc/library/subprocess.rst b/Doc/library/subprocess.rst
index 284cf44..53a0161 100644
--- a/Doc/library/subprocess.rst
+++ b/Doc/library/subprocess.rst
@@ -32,7 +32,7 @@
 
    :pep:`324` -- PEP proposing the subprocess module
 
-.. _subprocess32: https://pypi.python.org/pypi/subprocess32/
+.. _subprocess32: https://pypi.org/project/subprocess32/
 
 Using the :mod:`subprocess` Module
 ----------------------------------
diff --git a/Doc/library/unittest.rst b/Doc/library/unittest.rst
index b36126e..0915926 100644
--- a/Doc/library/unittest.rst
+++ b/Doc/library/unittest.rst
@@ -78,7 +78,7 @@
    Module :mod:`doctest`
       Another test-support module with a very different flavor.
 
-   `unittest2: A backport of new unittest features for Python 2.4-2.6 <https://pypi.python.org/pypi/unittest2>`_
+   `unittest2: A backport of new unittest features for Python 2.4-2.6 <https://pypi.org/project/unittest2>`_
       Many new features were added to unittest in Python 2.7, including test
       discovery. unittest2 allows you to use these features with earlier
       versions of Python.
diff --git a/Doc/library/xml.rst b/Doc/library/xml.rst
index a8f20cd..b107c29 100644
--- a/Doc/library/xml.rst
+++ b/Doc/library/xml.rst
@@ -129,8 +129,8 @@
 well-defined XML features.
 
 
-.. _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