@@ -3956,6 +3956,13 @@ get_abs_name(PyThreadState *tstate, PyObject *name, PyObject *globals, int level
39563956 return Py_NewRef (name );
39573957}
39583958
3959+ PyObject *
3960+ _PyImport_GetAbsName (PyThreadState * tstate , PyObject * name , PyObject * globals , int level )
3961+ {
3962+ return get_abs_name (tstate , name , globals , level );
3963+ }
3964+
3965+
39593966PyObject *
39603967PyImport_ImportModuleLevelObject (PyObject * name , PyObject * globals ,
39613968 PyObject * locals , PyObject * fromlist ,
@@ -3975,11 +3982,6 @@ PyImport_ImportModuleLevelObject(PyObject *name, PyObject *globals,
39753982 goto error ;
39763983 }
39773984
3978- if (globals != NULL &&
3979- PyMapping_GetOptionalItem (globals , & _Py_ID (__lazy_modules__ ), & lazy_modules ) < 0 ) {
3980- goto error ;
3981- }
3982-
39833985 /* The below code is importlib.__import__() & _gcd_import(), ported to C
39843986 for added performance. */
39853987
@@ -3998,44 +4000,6 @@ PyImport_ImportModuleLevelObject(PyObject *name, PyObject *globals,
39984000 goto error ;
39994001 }
40004002
4001- if (lazy_modules != NULL ) {
4002- // Check and see if the module is opting in w/o syntax for backwards compatibility
4003- // with older Python versions.
4004- int contains = PySequence_Contains (lazy_modules , abs_name );
4005- if (contains < 0 ) {
4006- goto error ;
4007- } else if (contains == 1 ) {
4008- // Don't create lazy import if we're already resolving a lazy import
4009- if (interp -> imports .lazy_importing_modules != NULL &&
4010- PySet_GET_SIZE (interp -> imports .lazy_importing_modules ) > 0 ) {
4011- contains = 0 ; // Skip lazy import creation
4012- }
4013- }
4014-
4015- if (contains == 1 ) {
4016- _PyInterpreterFrame * frame = _PyEval_GetFrame ();
4017- if (frame == NULL ) {
4018- PyErr_SetString (PyExc_RuntimeError , "no current frame" );
4019- goto error ;
4020- }
4021-
4022- PyObject * import_func ;
4023- if (PyMapping_GetOptionalItem (frame -> f_builtins , & _Py_ID (__import__ ), & import_func ) < 0 ) {
4024- return NULL ;
4025- }
4026-
4027- if (import_func == NULL ) {
4028- _PyErr_SetString (tstate , PyExc_ImportError , "__import__ not found" );
4029- return NULL ;
4030- }
4031-
4032- final_mod = _PyImport_LazyImportModuleLevelObject (tstate , name , import_func , globals ,
4033- locals , fromlist , level );
4034- Py_DECREF (import_func );
4035- goto error ;
4036- }
4037- }
4038-
40394003 mod = import_get_module (tstate , abs_name );
40404004 if (mod == NULL && _PyErr_Occurred (tstate )) {
40414005 goto error ;
@@ -4219,7 +4183,6 @@ register_lazy_on_parent(PyThreadState *tstate, PyObject *name, PyObject *import_
42194183 goto done ;
42204184 }
42214185 if (PyDict_CheckExact (parent_dict ) && !PyDict_Contains (parent_dict , child )) {
4222- printf ("!!! Adding lazy onto %s %s\n" , PyUnicode_AsUTF8 (parent ), PyUnicode_AsUTF8 (child ));
42234186 PyObject * lazy_module_attr = _PyLazyImport_New (import_func , parent , child );
42244187 if (lazy_module_attr == NULL ) {
42254188 goto done ;
@@ -5344,7 +5307,6 @@ _imp__set_lazy_attributes_impl(PyObject *module, PyObject *child_module,
53445307 Py_hash_t hash ;
53455308 while (_PySet_NextEntry (lazy_submodules , & pos , & attr_name , & hash )) {
53465309 if (PyDict_Contains (child_dict , attr_name )) {
5347- printf ("!!!!!!!! Not replacing %s\n" , PyUnicode_AsUTF8 (attr_name ));
53485310 continue ;
53495311 }
53505312 PyObject * builtins = _PyEval_GetBuiltins (tstate );
0 commit comments