PEP 489: Tweak code formatting.
This commit is contained in:
parent
0751f33dab
commit
e597818e47
28
pep-0489.txt
28
pep-0489.txt
|
@ -191,9 +191,11 @@ are left out, and C code is presented with a concise Python-like syntax.
|
||||||
The framework that calls the importers is explained in PEP 451
|
The framework that calls the importers is explained in PEP 451
|
||||||
[#pep-0451-loading]_.
|
[#pep-0451-loading]_.
|
||||||
|
|
||||||
importlib/_bootstrap.py::
|
importlib/_bootstrap.py:
|
||||||
|
|
||||||
class BuiltinImporter:
|
::
|
||||||
|
|
||||||
|
class BuiltinImporter:
|
||||||
def create_module(self, spec):
|
def create_module(self, spec):
|
||||||
module = _imp.create_builtin(spec)
|
module = _imp.create_builtin(spec)
|
||||||
|
|
||||||
|
@ -204,7 +206,9 @@ class BuiltinImporter:
|
||||||
# use a backwards compatibility shim
|
# use a backwards compatibility shim
|
||||||
_load_module_shim(self, name)
|
_load_module_shim(self, name)
|
||||||
|
|
||||||
importlib/_bootstrap_external.py::
|
importlib/_bootstrap_external.py:
|
||||||
|
|
||||||
|
::
|
||||||
|
|
||||||
class ExtensionFileLoader:
|
class ExtensionFileLoader:
|
||||||
def create_module(self, spec):
|
def create_module(self, spec):
|
||||||
|
@ -217,7 +221,9 @@ importlib/_bootstrap_external.py::
|
||||||
# use a backwards compatibility shim
|
# use a backwards compatibility shim
|
||||||
_load_module_shim(self, name)
|
_load_module_shim(self, name)
|
||||||
|
|
||||||
Python/import.c (the _imp module)::
|
Python/import.c (the _imp module):
|
||||||
|
|
||||||
|
::
|
||||||
|
|
||||||
def create_dynamic(spec):
|
def create_dynamic(spec):
|
||||||
name = spec.name
|
name = spec.name
|
||||||
|
@ -264,9 +270,11 @@ Python/import.c (the _imp module)::
|
||||||
_PyImport_FixupExtensionObject(module, name, name)
|
_PyImport_FixupExtensionObject(module, name, name)
|
||||||
return module
|
return module
|
||||||
|
|
||||||
Python/importdl.c::
|
Python/importdl.c:
|
||||||
|
|
||||||
def _PyImport_LoadDynamicModuleWithSpec(spec):
|
::
|
||||||
|
|
||||||
|
def _PyImport_LoadDynamicModuleWithSpec(spec):
|
||||||
path = spec.origin
|
path = spec.origin
|
||||||
package, dot, name = spec.name.rpartition('.')
|
package, dot, name = spec.name.rpartition('.')
|
||||||
|
|
||||||
|
@ -287,9 +295,11 @@ def _PyImport_LoadDynamicModuleWithSpec(spec):
|
||||||
# fall back to single-phase initialization
|
# fall back to single-phase initialization
|
||||||
....
|
....
|
||||||
|
|
||||||
Objects/moduleobject.c::
|
Objects/moduleobject.c:
|
||||||
|
|
||||||
def PyModule_FromDefAndSpec(def, spec):
|
::
|
||||||
|
|
||||||
|
def PyModule_FromDefAndSpec(def, spec):
|
||||||
name = spec.name
|
name = spec.name
|
||||||
create = None
|
create = None
|
||||||
for slot, value in def.m_slots:
|
for slot, value in def.m_slots:
|
||||||
|
@ -309,7 +319,7 @@ def PyModule_FromDefAndSpec(def, spec):
|
||||||
if def.m_doc:
|
if def.m_doc:
|
||||||
PyModule_SetDocString(m, def.m_doc)
|
PyModule_SetDocString(m, def.m_doc)
|
||||||
|
|
||||||
def PyModule_ExecDef(module, def):
|
def PyModule_ExecDef(module, def):
|
||||||
if isinstance(module, types.module_type):
|
if isinstance(module, types.module_type):
|
||||||
if module.md_state is NULL:
|
if module.md_state is NULL:
|
||||||
# allocate a block of zeroed-out memory
|
# allocate a block of zeroed-out memory
|
||||||
|
|
Loading…
Reference in New Issue