]> granicus.if.org Git - python/commitdiff
Issue #25533: Update documentation regarding the frozen modules table
authorMartin Panter <vadmium+py@gmail.com>
Sun, 15 May 2016 00:13:04 +0000 (00:13 +0000)
committerMartin Panter <vadmium+py@gmail.com>
Sun, 15 May 2016 00:13:04 +0000 (00:13 +0000)
* "ctypes" documentation was using Python 2 bytes-str equivalence.
* PyImport_FrozenModules is a pointer to const as of Python 3.4

Doc/c-api/import.rst
Doc/library/ctypes.rst
Doc/library/pkgutil.rst
Lib/ctypes/test/test_values.py

index 86c1d7d6e3471ff1029b50538d2922ca9fe36783..2936f4ff33dd6ba80b94ddff95fe2631cb602c23 100644 (file)
@@ -272,7 +272,7 @@ Importing Modules
       };
 
 
-.. c:var:: struct _frozen* PyImport_FrozenModules
+.. c:var:: const struct _frozen* PyImport_FrozenModules
 
    This pointer is initialized to point to an array of :c:type:`struct _frozen`
    records, terminated by one whose members are all *NULL* or zero.  When a frozen
index 4da276c4aafcd04b5319c194f904297b29993f75..1d45a37f119a6629ca1175d602c1cdd41f45ef60 100644 (file)
@@ -1100,14 +1100,15 @@ access violation or whatever, so it's better to break out of the loop when we
 hit the NULL entry::
 
    >>> for item in table:
-   ...     print(item.name, item.size)
    ...     if item.name is None:
    ...         break
+   ...     print(item.name.decode("ascii"), item.size)
    ...
-   __hello__ 104
-   __phello__ -104
-   __phello__.spam 104
-   None 0
+   _frozen_importlib 31764
+   _frozen_importlib_external 41499
+   __hello__ 161
+   __phello__ -161
+   __phello__.spam 161
    >>>
 
 The fact that standard Python has a frozen module and a frozen package
index 5d3295db7ef8c0efb1df222887edce11aadd6511..26c5ac066b4a1f6797d1909fc3f945be164d5149 100644 (file)
@@ -140,7 +140,7 @@ support.
 .. function:: iter_modules(path=None, prefix='')
 
    Yields ``(module_finder, name, ispkg)`` for all submodules on *path*, or, if
-   path is ``None``, all top-level modules on ``sys.path``.
+   *path* is ``None``, all top-level modules on ``sys.path``.
 
    *path* should be either ``None`` or a list of paths to look for modules in.
 
@@ -161,7 +161,7 @@ support.
 .. function:: walk_packages(path=None, prefix='', onerror=None)
 
    Yields ``(module_finder, name, ispkg)`` for all modules recursively on
-   *path*, or, if path is ``None``, all accessible modules.
+   *path*, or, if *path* is ``None``, all accessible modules.
 
    *path* should be either ``None`` or a list of paths to look for modules in.
 
index c7c78ce4e59fe07661d4ce14ce0adf66413db531..5a3a47f96819fbd87208b83fe1b2512c66d3406b 100644 (file)
@@ -77,13 +77,14 @@ class PythonValuesTestCase(unittest.TestCase):
                 self.assertTrue(entry.size,
                     "{!r} was reported as having no size".format(entry.name))
                 continue
-            items.append((entry.name, entry.size))
+            items.append((entry.name.decode("ascii"), entry.size))
 
-        expected = [(b"__hello__", 161),
-                    (b"__phello__", -161),
-                    (b"__phello__.spam", 161),
+        expected = [("__hello__", 161),
+                    ("__phello__", -161),
+                    ("__phello__.spam", 161),
                     ]
-        self.assertEqual(items, expected)
+        self.assertEqual(items, expected, "PyImport_FrozenModules example "
+            "in Doc/library/ctypes.rst may be out of date")
 
         self.assertEqual(sorted(bootstrap_seen), bootstrap_expected,
             "frozen bootstrap modules did not match PyImport_FrozenModules")