33#include "Python.h"
44#include "pycore_audit.h" // _PySys_Audit()
55#include "pycore_ceval.h"
6- #include "pycore_dict.h" // _PyDict_Contains_KnownHash()
76#include "pycore_critical_section.h" // Py_BEGIN_CRITICAL_SECTION()
7+ #include "pycore_dict.h" // _PyDict_Contains_KnownHash()
88#include "pycore_hashtable.h" // _Py_hashtable_new_full()
99#include "pycore_import.h" // _PyImport_BootstrapImp()
1010#include "pycore_initconfig.h" // _PyStatus_OK()
1111#include "pycore_interp.h" // struct _import_runtime_state
12- #include "pycore_long.h" // _PyLong_GetZero
13- #include "pycore_lazyimportobject.h"
14- #include "pycore_traceback.h"
1512#include "pycore_interpframe.h"
13+ #include "pycore_lazyimportobject.h"
14+ #include "pycore_long.h" // _PyLong_GetZero
1615#include "pycore_magic_number.h" // PYC_MAGIC_NUMBER_TOKEN
1716#include "pycore_moduleobject.h" // _PyModule_GetDef()
1817#include "pycore_namespace.h" // _PyNamespace_Type
2625#include "pycore_setobject.h" // _PySet_NextEntry()
2726#include "pycore_sysmodule.h" // _PySys_ClearAttrString()
2827#include "pycore_time.h" // _PyTime_AsMicroseconds()
28+ #include "pycore_traceback.h"
2929#include "pycore_unicodeobject.h" // _PyUnicode_AsUTF8NoNUL()
3030#include "pycore_weakref.h" // _PyWeakref_GET_REF()
3131
@@ -2168,7 +2168,8 @@ import_run_extension(PyThreadState *tstate, PyModInitFunction p0,
21682168 if (filename == NULL ) {
21692169 return NULL ;
21702170 }
2171- } else {
2171+ }
2172+ else {
21722173 filename = Py_NewRef (info -> filename );
21732174 }
21742175 // XXX There's a refleak somewhere with the filename.
@@ -3853,7 +3854,8 @@ _PyImport_LoadLazyImportTstate(PyThreadState *tstate, PyObject *lazy_import)
38533854 if (is_loading < 0 ) {
38543855 _PyImport_ReleaseLock (interp );
38553856 return NULL ;
3856- } else if (is_loading == 1 ) {
3857+ }
3858+ else if (is_loading == 1 ) {
38573859 PyObject * name = _PyLazyImport_GetName (lazy_import );
38583860 if (name == NULL ) {
38593861 _PyImport_ReleaseLock (interp );
@@ -3872,7 +3874,8 @@ _PyImport_LoadLazyImportTstate(PyThreadState *tstate, PyObject *lazy_import)
38723874 Py_DECREF (name );
38733875 _PyImport_ReleaseLock (interp );
38743876 return NULL ;
3875- } else if (PySet_Add (importing , lazy_import ) < 0 ) {
3877+ }
3878+ else if (PySet_Add (importing , lazy_import ) < 0 ) {
38763879 _PyImport_ReleaseLock (interp );
38773880 goto error ;
38783881 }
@@ -3897,7 +3900,8 @@ _PyImport_LoadLazyImportTstate(PyThreadState *tstate, PyObject *lazy_import)
38973900 }
38983901 Py_INCREF (lz -> lz_attr );
38993902 PyTuple_SET_ITEM (fromlist , 0 , lz -> lz_attr );
3900- } else {
3903+ }
3904+ else {
39013905 Py_INCREF (lz -> lz_attr );
39023906 fromlist = lz -> lz_attr ;
39033907 }
@@ -3913,25 +3917,20 @@ _PyImport_LoadLazyImportTstate(PyThreadState *tstate, PyObject *lazy_import)
39133917 goto error ;
39143918 }
39153919 if (full ) {
3916- obj = _PyEval_ImportNameWithImport (tstate ,
3917- import_func ,
3918- globals ,
3919- globals ,
3920- lz -> lz_from ,
3921- fromlist ,
3922- _PyLong_GetZero ());
3923- } else {
3920+ obj = _PyEval_ImportNameWithImport (
3921+ tstate , import_func , globals , globals ,
3922+ lz -> lz_from , fromlist , _PyLong_GetZero ()
3923+ );
3924+ }
3925+ else {
39243926 PyObject * name = PyUnicode_Substring (lz -> lz_from , 0 , dot );
39253927 if (name == NULL ) {
39263928 goto error ;
39273929 }
3928- obj = _PyEval_ImportNameWithImport (tstate ,
3929- import_func ,
3930- globals ,
3931- globals ,
3932- name ,
3933- fromlist ,
3934- _PyLong_GetZero ());
3930+ obj = _PyEval_ImportNameWithImport (
3931+ tstate , import_func , globals , globals ,
3932+ name , fromlist , _PyLong_GetZero ()
3933+ );
39353934 Py_DECREF (name );
39363935 }
39373936 if (obj == NULL ) {
@@ -4292,7 +4291,8 @@ register_lazy_on_parent(PyThreadState *tstate, PyObject *name, PyObject *builtin
42924291
42934292 Py_INCREF (name );
42944293 while (true) {
4295- Py_ssize_t dot = PyUnicode_FindChar (name , '.' , 0 , PyUnicode_GET_LENGTH (name ), -1 );
4294+ Py_ssize_t dot = PyUnicode_FindChar (name , '.' ,
4295+ 0 , PyUnicode_GET_LENGTH (name ), -1 );
42964296 if (dot < 0 ) {
42974297 ret = 0 ;
42984298 goto done ;
@@ -4336,7 +4336,9 @@ register_lazy_on_parent(PyThreadState *tstate, PyObject *name, PyObject *builtin
43364336 goto done ;
43374337 }
43384338 if (!contains ) {
4339- PyObject * lazy_module_attr = _PyLazyImport_New (builtins , parent , child );
4339+ PyObject * lazy_module_attr = _PyLazyImport_New (
4340+ builtins , parent , child
4341+ );
43404342 if (lazy_module_attr == NULL ) {
43414343 goto done ;
43424344 }
@@ -4416,12 +4418,7 @@ _PyImport_LazyImportModuleLevelObject(PyThreadState *tstate,
44164418 modname = Py_NewRef (Py_None );
44174419 }
44184420 PyObject * args [] = {modname , name , fromlist };
4419- PyObject * res = PyObject_Vectorcall (
4420- filter ,
4421- args ,
4422- 3 ,
4423- NULL
4424- );
4421+ PyObject * res = PyObject_Vectorcall (filter , args , 3 , NULL );
44254422
44264423 Py_DECREF (modname );
44274424 Py_DECREF (filter );
@@ -4456,9 +4453,13 @@ _PyImport_LazyImportModuleLevelObject(PyThreadState *tstate,
44564453 if (register_from_lazy_on_parent (tstate , abs_name , fromlist , builtins ) < 0 ) {
44574454 goto error ;
44584455 }
4459- } else if (fromlist && PyTuple_Check (fromlist ) && PyTuple_GET_SIZE (fromlist )) {
4456+ }
4457+ else if (fromlist && PyTuple_Check (fromlist ) && PyTuple_GET_SIZE (fromlist )) {
44604458 for (Py_ssize_t i = 0 ; i < PyTuple_GET_SIZE (fromlist ); i ++ ) {
4461- if (register_from_lazy_on_parent (tstate , abs_name , PyTuple_GET_ITEM (fromlist , i ), builtins ) < 0 ) {
4459+ if (register_from_lazy_on_parent (tstate , abs_name ,
4460+ PyTuple_GET_ITEM (fromlist , i ),
4461+ builtins ) < 0 )
4462+ {
44624463 goto error ;
44634464 }
44644465 }
@@ -5477,7 +5478,10 @@ _imp_source_hash_impl(PyObject *module, long key, Py_buffer *source)
54775478}
54785479
54795480static int
5480- publish_lazy_imports_on_module (PyThreadState * tstate , PyObject * lazy_submodules , PyObject * name , PyObject * module_dict )
5481+ publish_lazy_imports_on_module (PyThreadState * tstate ,
5482+ PyObject * lazy_submodules ,
5483+ PyObject * name ,
5484+ PyObject * module_dict )
54815485{
54825486 PyObject * builtins = _PyEval_GetBuiltins (tstate );
54835487 PyObject * attr_name ;
0 commit comments