@@ -12,6 +12,7 @@ Python-Version: 3.5
1212Post-History: 23-Aug-2013, 20-Feb-2015, 16-Apr-2015, 07-May-2015, 18-May-2015
1313Resolution: https://mail.python.org/pipermail/python-dev/2015-May/140108.html
1414
15+ .. highlight :: c
1516
1617Abstract
1718========
@@ -190,7 +191,7 @@ The framework that calls the importers is explained in
190191
191192importlib/_bootstrap.py:
192193
193- ::
194+ .. code-block :: python
194195
195196 class BuiltinImporter :
196197 def create_module (self , spec ):
@@ -205,7 +206,7 @@ importlib/_bootstrap.py:
205206
206207 importlib/_bootstrap_external.py:
207208
208- ::
209+ .. code-block :: python
209210
210211 class ExtensionFileLoader :
211212 def create_module (self , spec ):
@@ -220,7 +221,7 @@ importlib/_bootstrap_external.py:
220221
221222 Python/import.c (the _imp module):
222223
223- ::
224+ .. code-block :: python
224225
225226 def create_dynamic (spec ):
226227 name = spec.name
@@ -269,7 +270,7 @@ Python/import.c (the _imp module):
269270
270271 Python/importdl.c:
271272
272- ::
273+ .. code-block :: python
273274
274275 def _PyImport_LoadDynamicModuleWithSpec (spec ):
275276 path = spec.origin
@@ -294,7 +295,7 @@ Python/importdl.c:
294295
295296 Objects/moduleobject.c:
296297
297- ::
298+ .. code-block :: python
298299
299300 def PyModule_FromDefAndSpec (def , spec ):
300301 name = spec.name
@@ -621,14 +622,16 @@ PyInitU_<encodedname>, where the name is encoded using CPython's
621622with hyphens ("-") replaced by underscores ("_").
622623
623624
624- In Python::
625+ In Python:
625626
626- def export_hook_name(name):
627- try:
628- suffix = b'_' + name.encode('ascii')
629- except UnicodeEncodeError:
630- suffix = b'U_' + name.encode('punycode').replace(b'-', b'_')
631- return b'PyInit' + suffix
627+ .. code-block :: python
628+
629+ def export_hook_name (name ):
630+ try :
631+ suffix = b ' _' + name.encode(' ascii' )
632+ except UnicodeEncodeError :
633+ suffix = b ' U_' + name.encode(' punycode' ).replace(b ' -' , b ' _' )
634+ return b ' PyInit' + suffix
632635
633636 Examples:
634637
@@ -673,7 +676,9 @@ Note that this mechanism can currently only be used to *load* extra modules,
673676but not to *find * them. (This is a limitation of the loader mechanism,
674677which this PEP does not try to modify.)
675678To work around the lack of a suitable finder, code like the following
676- can be used::
679+ can be used:
680+
681+ .. code-block :: python
677682
678683 import importlib.machinery
679684 import importlib.util
0 commit comments