MOD_INIT_DECL( Crypto$Random$OSRNG ) { #if defined(_NUITKA_EXE) || PYTHON_VERSION >= 300 static bool _init_done = false; // Packages can be imported recursively in deep executables. if ( _init_done ) { return MOD_RETURN_VALUE( module_Crypto$Random$OSRNG ); } else { _init_done = true; } #endif #ifdef _NUITKA_MODULE // In case of a stand alone extension module, need to call initialization // the init here because that's the first and only time we are going to get // called here. // Initialize the constant values used. _initBuiltinModule(); _initConstants(); // Initialize the compiled types of Nuitka. PyType_Ready( &Nuitka_Generator_Type ); PyType_Ready( &Nuitka_Function_Type ); PyType_Ready( &Nuitka_Method_Type ); PyType_Ready( &Nuitka_Frame_Type ); #if PYTHON_VERSION < 300 initSlotCompare(); #endif patchBuiltinModule(); patchTypeComparison(); #endif #if _MODULE_UNFREEZER registerMetaPathBasedUnfreezer( meta_path_loader_entries ); #endif _initModuleConstants(); _initModuleCodeObjects(); // puts( "in initCrypto$Random$OSRNG" ); // Create the module object first. There are no methods initially, all are // added dynamically in actual code only. Also no "__doc__" is initially // set at this time, as it could not contain NUL characters this way, they // are instead set in early module code. No "self" for modules, we have no // use for it. #if PYTHON_VERSION < 300 module_Crypto$Random$OSRNG = Py_InitModule4( "Crypto.Random.OSRNG", // Module Name NULL, // No methods initially, all are added // dynamically in actual module code only. NULL, // No __doc__ is initially set, as it could // not contain NUL this way, added early in // actual code. NULL, // No self for modules, we don't use it. PYTHON_API_VERSION ); #else module_Crypto$Random$OSRNG = PyModule_Create( &mdef_Crypto$Random$OSRNG ); #endif moduledict_Crypto$Random$OSRNG = (PyDictObject *)((PyModuleObject *)module_Crypto$Random$OSRNG)->md_dict; assertObject( module_Crypto$Random$OSRNG ); // Seems to work for Python2.7 out of the box, but for Python3, the module // doesn't automatically enter "sys.modules", so do it manually. #if PYTHON_VERSION >= 300 { int r = PyObject_SetItem( PySys_GetObject( (char *)"modules" ), const_str_digest_bc407d35a8cca84be9184e875aad04dc, module_Crypto$Random$OSRNG ); assert( r != -1 ); } #endif // For deep importing of a module we need to have "__builtins__", so we set // it ourselves in the same way than CPython does. Note: This must be done // before the frame object is allocated, or else it may fail. PyObject *module_dict = PyModule_GetDict( module_Crypto$Random$OSRNG ); if ( PyDict_GetItem( module_dict, const_str_plain___builtins__ ) == NULL ) { PyObject *value = (PyObject *)builtin_module; // Check if main module, not a dict then. #if !defined(_NUITKA_EXE) || !0 value = PyModule_GetDict( value ); #endif #ifndef __NUITKA_NO_ASSERT__ int res = #endif PyDict_SetItem( module_dict, const_str_plain___builtins__, value ); assert( res == 0 ); } #if PYTHON_VERSION >= 330 #if _MODULE_UNFREEZER PyDict_SetItem( module_dict, const_str_plain___loader__, metapath_based_loader ); #else PyDict_SetItem( module_dict, const_str_plain___loader__, Py_None ); #endif #endif // Temp variables if any PyObject *exception_type, *exception_value; PyTracebackObject *exception_tb; PyObject *tmp_assign_source_1; PyObject *tmp_assign_source_2; PyObject *tmp_assign_source_3; PyObject *tmp_assign_source_4; PyObject *tmp_assign_source_5; PyObject *tmp_assign_source_6; PyObject *tmp_assign_source_7; PyObject *tmp_assign_source_8; int tmp_cmp_Eq_1; int tmp_cmp_Eq_2; PyObject *tmp_compare_left_1; PyObject *tmp_compare_left_2; PyObject *tmp_compare_right_1; PyObject *tmp_compare_right_2; PyObject *tmp_hasattr_attr_1; PyObject *tmp_hasattr_source_1; PyObject *tmp_import_globals_1; PyObject *tmp_import_globals_2; PyObject *tmp_import_globals_3; PyObject *tmp_import_globals_4; PyObject *tmp_import_name_from_1; PyObject *tmp_import_name_from_2; PyObject *tmp_import_name_from_3; PyObject *tmp_make_exception_arg_1; PyObject *tmp_raise_type_1; int tmp_res; PyObject *tmp_source_name_1; PyObject *tmp_source_name_2; // Module code. tmp_assign_source_1 = const_str_digest_f01c2b13d766443866465debfd607d0e; UPDATE_STRING_DICT0( moduledict_Crypto$Random$OSRNG, (Nuitka_StringObject *)const_str_plain___doc__, tmp_assign_source_1 ); tmp_assign_source_2 = const_str_digest_ff978bc30768b4bce0b5b1f0a5855595; UPDATE_STRING_DICT0( moduledict_Crypto$Random$OSRNG, (Nuitka_StringObject *)const_str_plain___file__, tmp_assign_source_2 ); tmp_assign_source_3 = LIST_COPY( const_list_str_digest_a10cd80b314d8fd7184d913c98d61dfa_list ); UPDATE_STRING_DICT1( moduledict_Crypto$Random$OSRNG, (Nuitka_StringObject *)const_str_plain___path__, tmp_assign_source_3 ); tmp_assign_source_4 = const_str_digest_e716a6839c8454d1d77f5308c1bdd157; UPDATE_STRING_DICT0( moduledict_Crypto$Random$OSRNG, (Nuitka_StringObject *)const_str_plain___revision__, tmp_assign_source_4 ); // Frame without reuse. PyFrameObject *frame_module = MAKE_FRAME( codeobj_c96d8313b82a8f9bc4e63bebe63be847, module_Crypto$Random$OSRNG ); // Push the new frame as the currently active one, and we should be exlusively // owning it. pushFrameStack( frame_module ); assert( Py_REFCNT( frame_module ) == 1 ); #if PYTHON_VERSION >= 340 frame_module->f_executing += 1; #endif // Framed code: tmp_import_globals_1 = ((PyModuleObject *)module_Crypto$Random$OSRNG)->md_dict; frame_module->f_lineno = 29; tmp_assign_source_5 = IMPORT_MODULE( const_str_plain_os, tmp_import_globals_1, tmp_import_globals_1, Py_None, const_int_neg_1 ); if ( tmp_assign_source_5 == NULL ) { assert( ERROR_OCCURED() ); PyErr_Fetch( &exception_type, &exception_value, (PyObject **)&exception_tb ); frame_module->f_lineno = 29; goto frame_exception_exit_1; } UPDATE_STRING_DICT1( moduledict_Crypto$Random$OSRNG, (Nuitka_StringObject *)const_str_plain_os, tmp_assign_source_5 ); tmp_source_name_1 = GET_STRING_DICT_VALUE( moduledict_Crypto$Random$OSRNG, (Nuitka_StringObject *)const_str_plain_os ); if (unlikely( tmp_source_name_1 == NULL )) { tmp_source_name_1 = GET_STRING_DICT_VALUE( dict_builtin, (Nuitka_StringObject *)const_str_plain_os ); } if ( tmp_source_name_1 == NULL ) { exception_type = INCREASE_REFCOUNT( PyExc_NameError ); exception_value = UNSTREAM_STRING( &constant_bin[ 7477 ], 24, 0 ); exception_tb = NULL; frame_module->f_lineno = 31; goto frame_exception_exit_1; } tmp_compare_left_1 = LOOKUP_ATTRIBUTE( tmp_source_name_1, const_str_plain_name ); if ( tmp_compare_left_1 == NULL ) { assert( ERROR_OCCURED() ); PyErr_Fetch( &exception_type, &exception_value, (PyObject **)&exception_tb ); frame_module->f_lineno = 31; goto frame_exception_exit_1; } tmp_compare_right_1 = const_str_plain_posix; tmp_cmp_Eq_1 = RICH_COMPARE_BOOL_EQ_NORECURSE( tmp_compare_left_1, tmp_compare_right_1 ); if ( tmp_cmp_Eq_1 == -1 ) { assert( ERROR_OCCURED() ); PyErr_Fetch( &exception_type, &exception_value, (PyObject **)&exception_tb ); Py_DECREF( tmp_compare_left_1 ); frame_module->f_lineno = 31; goto frame_exception_exit_1; } Py_DECREF( tmp_compare_left_1 ); if (tmp_cmp_Eq_1 == 1) { goto branch_yes_1; } else { goto branch_no_1; } branch_yes_1:; tmp_import_globals_2 = ((PyModuleObject *)module_Crypto$Random$OSRNG)->md_dict; frame_module->f_lineno = 32; tmp_import_name_from_1 = IMPORT_MODULE( const_str_digest_c36bc412b01c803f6316b97c4821aeff, tmp_import_globals_2, tmp_import_globals_2, const_tuple_str_plain_new_tuple, const_int_neg_1 ); if ( tmp_import_name_from_1 == NULL ) { assert( ERROR_OCCURED() ); PyErr_Fetch( &exception_type, &exception_value, (PyObject **)&exception_tb ); frame_module->f_lineno = 32; goto frame_exception_exit_1; } tmp_assign_source_6 = IMPORT_NAME( tmp_import_name_from_1, const_str_plain_new ); Py_DECREF( tmp_import_name_from_1 ); if ( tmp_assign_source_6 == NULL ) { assert( ERROR_OCCURED() ); PyErr_Fetch( &exception_type, &exception_value, (PyObject **)&exception_tb ); frame_module->f_lineno = 32; goto frame_exception_exit_1; } UPDATE_STRING_DICT1( moduledict_Crypto$Random$OSRNG, (Nuitka_StringObject *)const_str_plain_new, tmp_assign_source_6 ); goto branch_end_1; branch_no_1:; tmp_source_name_2 = GET_STRING_DICT_VALUE( moduledict_Crypto$Random$OSRNG, (Nuitka_StringObject *)const_str_plain_os ); if (unlikely( tmp_source_name_2 == NULL )) { tmp_source_name_2 = GET_STRING_DICT_VALUE( dict_builtin, (Nuitka_StringObject *)const_str_plain_os ); } if ( tmp_source_name_2 == NULL ) { exception_type = INCREASE_REFCOUNT( PyExc_NameError ); exception_value = UNSTREAM_STRING( &constant_bin[ 7477 ], 24, 0 ); exception_tb = NULL; frame_module->f_lineno = 33; goto frame_exception_exit_1; } tmp_compare_left_2 = LOOKUP_ATTRIBUTE( tmp_source_name_2, const_str_plain_name ); if ( tmp_compare_left_2 == NULL ) { assert( ERROR_OCCURED() ); PyErr_Fetch( &exception_type, &exception_value, (PyObject **)&exception_tb ); frame_module->f_lineno = 33; goto frame_exception_exit_1; } tmp_compare_right_2 = const_str_plain_nt; tmp_cmp_Eq_2 = RICH_COMPARE_BOOL_EQ_NORECURSE( tmp_compare_left_2, tmp_compare_right_2 ); if ( tmp_cmp_Eq_2 == -1 ) { assert( ERROR_OCCURED() ); PyErr_Fetch( &exception_type, &exception_value, (PyObject **)&exception_tb ); Py_DECREF( tmp_compare_left_2 ); frame_module->f_lineno = 33; goto frame_exception_exit_1; } Py_DECREF( tmp_compare_left_2 ); if (tmp_cmp_Eq_2 == 1) { goto branch_yes_2; } else { goto branch_no_2; } branch_yes_2:; tmp_import_globals_3 = ((PyModuleObject *)module_Crypto$Random$OSRNG)->md_dict; frame_module->f_lineno = 34; tmp_import_name_from_2 = IMPORT_MODULE( const_str_digest_06dd65564ea0dd8766c2222a8271160e, tmp_import_globals_3, tmp_import_globals_3, const_tuple_str_plain_new_tuple, const_int_neg_1 ); if ( tmp_import_name_from_2 == NULL ) { assert( ERROR_OCCURED() ); PyErr_Fetch( &exception_type, &exception_value, (PyObject **)&exception_tb ); frame_module->f_lineno = 34; goto frame_exception_exit_1; } tmp_assign_source_7 = IMPORT_NAME( tmp_import_name_from_2, const_str_plain_new ); Py_DECREF( tmp_import_name_from_2 ); if ( tmp_assign_source_7 == NULL ) { assert( ERROR_OCCURED() ); PyErr_Fetch( &exception_type, &exception_value, (PyObject **)&exception_tb ); frame_module->f_lineno = 34; goto frame_exception_exit_1; } UPDATE_STRING_DICT1( moduledict_Crypto$Random$OSRNG, (Nuitka_StringObject *)const_str_plain_new, tmp_assign_source_7 ); goto branch_end_2; branch_no_2:; tmp_hasattr_source_1 = GET_STRING_DICT_VALUE( moduledict_Crypto$Random$OSRNG, (Nuitka_StringObject *)const_str_plain_os ); if (unlikely( tmp_hasattr_source_1 == NULL )) { tmp_hasattr_source_1 = GET_STRING_DICT_VALUE( dict_builtin, (Nuitka_StringObject *)const_str_plain_os ); } if ( tmp_hasattr_source_1 == NULL ) { exception_type = INCREASE_REFCOUNT( PyExc_NameError ); exception_value = UNSTREAM_STRING( &constant_bin[ 7477 ], 24, 0 ); exception_tb = NULL; frame_module->f_lineno = 35; goto frame_exception_exit_1; } tmp_hasattr_attr_1 = const_str_plain_urandom; tmp_res = PyObject_HasAttr( tmp_hasattr_source_1, tmp_hasattr_attr_1 ); if ( tmp_res == -1 ) { assert( ERROR_OCCURED() ); PyErr_Fetch( &exception_type, &exception_value, (PyObject **)&exception_tb ); frame_module->f_lineno = 35; goto frame_exception_exit_1; } if (tmp_res == 1) { goto branch_yes_3; } else { goto branch_no_3; } branch_yes_3:; tmp_import_globals_4 = ((PyModuleObject *)module_Crypto$Random$OSRNG)->md_dict; frame_module->f_lineno = 36; tmp_import_name_from_3 = IMPORT_MODULE( const_str_digest_623da4fa9a2ac5457959104e083f5513, tmp_import_globals_4, tmp_import_globals_4, const_tuple_str_plain_new_tuple, const_int_neg_1 ); if ( tmp_import_name_from_3 == NULL ) { assert( ERROR_OCCURED() ); PyErr_Fetch( &exception_type, &exception_value, (PyObject **)&exception_tb ); frame_module->f_lineno = 36; goto frame_exception_exit_1; } tmp_assign_source_8 = IMPORT_NAME( tmp_import_name_from_3, const_str_plain_new ); Py_DECREF( tmp_import_name_from_3 ); if ( tmp_assign_source_8 == NULL ) { assert( ERROR_OCCURED() ); PyErr_Fetch( &exception_type, &exception_value, (PyObject **)&exception_tb ); frame_module->f_lineno = 36; goto frame_exception_exit_1; } UPDATE_STRING_DICT1( moduledict_Crypto$Random$OSRNG, (Nuitka_StringObject *)const_str_plain_new, tmp_assign_source_8 ); goto branch_end_3; branch_no_3:; tmp_make_exception_arg_1 = const_str_digest_d0d695099e39173eb72601dce2dbb05f; frame_module->f_lineno = 38; tmp_raise_type_1 = CALL_FUNCTION_WITH_ARGS1( PyExc_ImportError, tmp_make_exception_arg_1 ); if ( tmp_raise_type_1 == NULL ) { assert( ERROR_OCCURED() ); PyErr_Fetch( &exception_type, &exception_value, (PyObject **)&exception_tb ); frame_module->f_lineno = 38; goto frame_exception_exit_1; } exception_type = tmp_raise_type_1; frame_module->f_lineno = 38; RAISE_EXCEPTION_WITH_TYPE( &exception_type, &exception_value, &exception_tb ); goto frame_exception_exit_1; branch_end_3:; branch_end_2:; branch_end_1:; // Restore frame exception if necessary. #if 0 RESTORE_FRAME_EXCEPTION( frame_module ); #endif popFrameStack(); assertFrameObject( frame_module ); Py_DECREF( frame_module ); goto frame_no_exception_1; frame_exception_exit_1:; #if 0 RESTORE_FRAME_EXCEPTION( frame_module ); #endif if ( exception_tb == NULL ) { exception_tb = MAKE_TRACEBACK( INCREASE_REFCOUNT( frame_module ) ); } else if ( exception_tb->tb_frame != frame_module ) { PyTracebackObject *traceback_new = (PyTracebackObject *)MAKE_TRACEBACK( INCREASE_REFCOUNT( frame_module ) ); traceback_new->tb_next = exception_tb; exception_tb = traceback_new; } // Put the previous frame back on top. popFrameStack(); #if PYTHON_VERSION >= 340 frame_module->f_executing -= 1; #endif Py_DECREF( frame_module ); // Return the error. goto module_exception_exit; frame_no_exception_1:; return MOD_RETURN_VALUE( module_Crypto$Random$OSRNG ); module_exception_exit: PyErr_Restore( exception_type, exception_value, (PyObject *)exception_tb ); return MOD_RETURN_VALUE( NULL ); }
MOD_INIT_DECL( pip$_vendor$cachecontrol$wrapper ) { #if defined(_NUITKA_EXE) || PYTHON_VERSION >= 300 static bool _init_done = false; // Modules might be imported repeatedly, which is to be ignored. if ( _init_done ) { return MOD_RETURN_VALUE( module_pip$_vendor$cachecontrol$wrapper ); } else { _init_done = true; } #endif #ifdef _NUITKA_MODULE // In case of a stand alone extension module, need to call initialization // the init here because that's the first and only time we are going to get // called here. // Initialize the constant values used. _initBuiltinModule(); createGlobalConstants(); // Initialize the compiled types of Nuitka. PyType_Ready( &Nuitka_Generator_Type ); PyType_Ready( &Nuitka_Function_Type ); PyType_Ready( &Nuitka_Method_Type ); PyType_Ready( &Nuitka_Frame_Type ); #if PYTHON_VERSION >= 350 PyType_Ready( &Nuitka_Coroutine_Type ); PyType_Ready( &Nuitka_CoroutineWrapper_Type ); #endif #if PYTHON_VERSION < 300 _initSlotCompare(); #endif #if PYTHON_VERSION >= 270 _initSlotIternext(); #endif patchBuiltinModule(); patchTypeComparison(); // Enable meta path based loader if not already done. setupMetaPathBasedLoader(); #if PYTHON_VERSION >= 300 patchInspectModule(); #endif #endif createModuleConstants(); createModuleCodeObjects(); // puts( "in initpip$_vendor$cachecontrol$wrapper" ); // Create the module object first. There are no methods initially, all are // added dynamically in actual code only. Also no "__doc__" is initially // set at this time, as it could not contain NUL characters this way, they // are instead set in early module code. No "self" for modules, we have no // use for it. #if PYTHON_VERSION < 300 module_pip$_vendor$cachecontrol$wrapper = Py_InitModule4( "pip._vendor.cachecontrol.wrapper", // Module Name NULL, // No methods initially, all are added // dynamically in actual module code only. NULL, // No __doc__ is initially set, as it could // not contain NUL this way, added early in // actual code. NULL, // No self for modules, we don't use it. PYTHON_API_VERSION ); #else module_pip$_vendor$cachecontrol$wrapper = PyModule_Create( &mdef_pip$_vendor$cachecontrol$wrapper ); #endif moduledict_pip$_vendor$cachecontrol$wrapper = (PyDictObject *)((PyModuleObject *)module_pip$_vendor$cachecontrol$wrapper)->md_dict; CHECK_OBJECT( module_pip$_vendor$cachecontrol$wrapper ); // Seems to work for Python2.7 out of the box, but for Python3, the module // doesn't automatically enter "sys.modules", so do it manually. #if PYTHON_VERSION >= 300 { int r = PyObject_SetItem( PySys_GetObject( (char *)"modules" ), const_str_digest_752ad0551f1bf40ca5b6a8cda161ccf4, module_pip$_vendor$cachecontrol$wrapper ); assert( r != -1 ); } #endif // For deep importing of a module we need to have "__builtins__", so we set // it ourselves in the same way than CPython does. Note: This must be done // before the frame object is allocated, or else it may fail. PyObject *module_dict = PyModule_GetDict( module_pip$_vendor$cachecontrol$wrapper ); if ( PyDict_GetItem( module_dict, const_str_plain___builtins__ ) == NULL ) { PyObject *value = (PyObject *)builtin_module; // Check if main module, not a dict then. #if !defined(_NUITKA_EXE) || !0 value = PyModule_GetDict( value ); #endif #ifndef __NUITKA_NO_ASSERT__ int res = #endif PyDict_SetItem( module_dict, const_str_plain___builtins__, value ); assert( res == 0 ); } #if PYTHON_VERSION >= 330 PyDict_SetItem( module_dict, const_str_plain___loader__, metapath_based_loader ); #endif // Temp variables if any PyObject *exception_type = NULL, *exception_value = NULL; PyTracebackObject *exception_tb = NULL; NUITKA_MAY_BE_UNUSED int exception_lineno = -1; PyObject *tmp_assign_source_1; PyObject *tmp_assign_source_2; PyObject *tmp_assign_source_3; PyObject *tmp_assign_source_4; PyObject *tmp_assign_source_5; PyObject *tmp_assign_source_6; PyObject *tmp_assign_source_7; PyObject *tmp_defaults_1; PyObject *tmp_import_globals_1; PyObject *tmp_import_globals_2; PyObject *tmp_import_name_from_1; PyObject *tmp_import_name_from_2; PyFrameObject *frame_module; // Module code. tmp_assign_source_1 = Py_None; UPDATE_STRING_DICT0( moduledict_pip$_vendor$cachecontrol$wrapper, (Nuitka_StringObject *)const_str_plain___doc__, tmp_assign_source_1 ); tmp_assign_source_2 = const_str_digest_b31e0a7d9885533032515f63a652cb9c; UPDATE_STRING_DICT0( moduledict_pip$_vendor$cachecontrol$wrapper, (Nuitka_StringObject *)const_str_plain___file__, tmp_assign_source_2 ); tmp_assign_source_3 = Py_None; UPDATE_STRING_DICT0( moduledict_pip$_vendor$cachecontrol$wrapper, (Nuitka_StringObject *)const_str_plain___cached__, tmp_assign_source_3 ); tmp_assign_source_4 = const_str_digest_cf6ad67e1fcab184ae3b2b70b1bd41c1; UPDATE_STRING_DICT0( moduledict_pip$_vendor$cachecontrol$wrapper, (Nuitka_StringObject *)const_str_plain___package__, tmp_assign_source_4 ); // Frame without reuse. frame_module = MAKE_MODULE_FRAME( codeobj_22e6269ebd4aca7f4dc21ac4b8656728, module_pip$_vendor$cachecontrol$wrapper ); // Push the new frame as the currently active one, and we should be exclusively // owning it. pushFrameStack( frame_module ); assert( Py_REFCNT( frame_module ) == 1 ); #if PYTHON_VERSION >= 340 frame_module->f_executing += 1; #endif // Framed code: tmp_import_globals_1 = ((PyModuleObject *)module_pip$_vendor$cachecontrol$wrapper)->md_dict; frame_module->f_lineno = 1; tmp_import_name_from_1 = IMPORT_MODULE( const_str_plain_adapter, tmp_import_globals_1, tmp_import_globals_1, const_tuple_str_plain_CacheControlAdapter_tuple, const_int_pos_1 ); if ( tmp_import_name_from_1 == NULL ) { assert( ERROR_OCCURRED() ); FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb ); exception_lineno = 1; goto frame_exception_exit_1; } tmp_assign_source_5 = IMPORT_NAME( tmp_import_name_from_1, const_str_plain_CacheControlAdapter ); Py_DECREF( tmp_import_name_from_1 ); if ( tmp_assign_source_5 == NULL ) { assert( ERROR_OCCURRED() ); FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb ); exception_lineno = 1; goto frame_exception_exit_1; } UPDATE_STRING_DICT1( moduledict_pip$_vendor$cachecontrol$wrapper, (Nuitka_StringObject *)const_str_plain_CacheControlAdapter, tmp_assign_source_5 ); tmp_import_globals_2 = ((PyModuleObject *)module_pip$_vendor$cachecontrol$wrapper)->md_dict; frame_module->f_lineno = 2; tmp_import_name_from_2 = IMPORT_MODULE( const_str_plain_cache, tmp_import_globals_2, tmp_import_globals_2, const_tuple_str_plain_DictCache_tuple, const_int_pos_1 ); if ( tmp_import_name_from_2 == NULL ) { assert( ERROR_OCCURRED() ); FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb ); exception_lineno = 2; goto frame_exception_exit_1; } tmp_assign_source_6 = IMPORT_NAME( tmp_import_name_from_2, const_str_plain_DictCache ); Py_DECREF( tmp_import_name_from_2 ); if ( tmp_assign_source_6 == NULL ) { assert( ERROR_OCCURRED() ); FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb ); exception_lineno = 2; goto frame_exception_exit_1; } UPDATE_STRING_DICT1( moduledict_pip$_vendor$cachecontrol$wrapper, (Nuitka_StringObject *)const_str_plain_DictCache, tmp_assign_source_6 ); // Restore frame exception if necessary. #if 0 RESTORE_FRAME_EXCEPTION( frame_module ); #endif popFrameStack(); assertFrameObject( frame_module ); Py_DECREF( frame_module ); goto frame_no_exception_1; frame_exception_exit_1:; #if 0 RESTORE_FRAME_EXCEPTION( frame_module ); #endif if ( exception_tb == NULL ) { exception_tb = MAKE_TRACEBACK( frame_module, exception_lineno ); } else if ( exception_tb->tb_frame != frame_module ) { PyTracebackObject *traceback_new = MAKE_TRACEBACK( frame_module, exception_lineno ); traceback_new->tb_next = exception_tb; exception_tb = traceback_new; } // Put the previous frame back on top. popFrameStack(); #if PYTHON_VERSION >= 340 frame_module->f_executing -= 1; #endif Py_DECREF( frame_module ); // Return the error. goto module_exception_exit; frame_no_exception_1:; tmp_defaults_1 = const_tuple_none_true_none_none_tuple; tmp_assign_source_7 = MAKE_FUNCTION_function_1_CacheControl_of_pip$_vendor$cachecontrol$wrapper( INCREASE_REFCOUNT( tmp_defaults_1 ) ); UPDATE_STRING_DICT1( moduledict_pip$_vendor$cachecontrol$wrapper, (Nuitka_StringObject *)const_str_plain_CacheControl, tmp_assign_source_7 ); return MOD_RETURN_VALUE( module_pip$_vendor$cachecontrol$wrapper ); module_exception_exit: RESTORE_ERROR_OCCURRED( exception_type, exception_value, exception_tb ); return MOD_RETURN_VALUE( NULL ); }
static void green_dealloc_safe(PyGreenlet* self) { PyObject *error_type, *error_value, *error_traceback; if (PyGreenlet_ACTIVE(self) && self->run_info != NULL && !PyGreenlet_MAIN(self)) { /* Hacks hacks hacks copied from instance_dealloc() */ /* Temporarily resurrect the greenlet. */ assert(Py_REFCNT(self) == 0); Py_REFCNT(self) = 1; /* Save the current exception, if any. */ PyErr_Fetch(&error_type, &error_value, &error_traceback); if (kill_greenlet(self) < 0) { PyErr_WriteUnraisable((PyObject*) self); /* XXX what else should we do? */ } /* Check for no resurrection must be done while we keep * our internal reference, otherwise PyFile_WriteObject * causes recursion if using Py_INCREF/Py_DECREF */ if (Py_REFCNT(self) == 1 && PyGreenlet_ACTIVE(self)) { /* Not resurrected, but still not dead! XXX what else should we do? we complain. */ PyObject* f = PySys_GetObject("stderr"); Py_INCREF(self); /* leak! */ if (f != NULL) { PyFile_WriteString("GreenletExit did not kill ", f); PyFile_WriteObject((PyObject*) self, f, 0); PyFile_WriteString("\n", f); } } /* Restore the saved exception. */ PyErr_Restore(error_type, error_value, error_traceback); /* Undo the temporary resurrection; can't use DECREF here, * it would cause a recursive call. */ assert(Py_REFCNT(self) > 0); if (--Py_REFCNT(self) != 0) { /* Resurrected! */ Py_ssize_t refcnt = Py_REFCNT(self); _Py_NewReference((PyObject*) self); Py_REFCNT(self) = refcnt; #if GREENLET_USE_GC PyObject_GC_Track((PyObject *)self); #endif _Py_DEC_REFTOTAL; #ifdef COUNT_ALLOCS --Py_TYPE(self)->tp_frees; --Py_TYPE(self)->tp_allocs; #endif /* COUNT_ALLOCS */ return; } } if (self->weakreflist != NULL) PyObject_ClearWeakRefs((PyObject *) self); Py_CLEAR(self->parent); Py_CLEAR(self->run_info); Py_CLEAR(self->exc_type); Py_CLEAR(self->exc_value); Py_CLEAR(self->exc_traceback); Py_CLEAR(self->dict); Py_TYPE(self)->tp_free((PyObject*) self); }
static int generic_channel_cando(PyThreadState *ts, PyObject **result, PyChannelObject *self, int dir, int stackless) { PyTaskletObject *source = ts->st.current; PyTaskletObject *switchto, *target, *next; int interthread; int oldflags, runflags = 0; int switched, fail; /* swap data and perform necessary scheduling */ switchto = target = slp_channel_remove(self, NULL, NULL, &next); interthread = target->cstate->tstate != ts; /* exchange data */ TASKLET_SWAPVAL(source, target); if (interthread) { ; /* nothing happens, the target is merely made runnable */ } else { if (self->flags.schedule_all) { /* target goes last */ slp_current_insert(target); /* always schedule away from source */ switchto = source->next; } else if (self->flags.preference == -dir) { /* move target after source */ ts->st.current = source->next; slp_current_insert(target); ts->st.current = source; /* don't mess with this scheduling behaviour: */ runflags = PY_WATCHDOG_NO_SOFT_IRQ; } else { /* otherwise we return to the caller */ slp_current_insert(target); switchto = source; /* don't mess with this scheduling behaviour: */ runflags = PY_WATCHDOG_NO_SOFT_IRQ; } } /* Make sure that the channel will exist past the actual switch, if * we are softswitching. A temporary channel might disappear. */ assert(ts->st.del_post_switch == NULL); if (source != target && Py_REFCNT(self)) { ts->st.del_post_switch = (PyObject*)self; Py_INCREF(self); } oldflags = ts->st.runflags; ts->st.runflags |= runflags; /* extra info for slp_schedule_task */ fail = slp_schedule_task(result, source, switchto, stackless, &switched); if (fail || !switched) Py_CLEAR(ts->st.del_post_switch); if (fail) { ts->st.runflags = oldflags; if (!interthread) { slp_current_uninsert(target); ts->st.current = source; } slp_channel_insert(self, target, -dir, next); TASKLET_SWAPVAL(source, target); } else { if (interthread) Py_DECREF(target); } return fail; }
// The module function definitions. static PyObject *impl_function_1_new_of_module_Crypto$Random( Nuitka_FunctionObject *self, PyObject *_python_par_args, PyObject *_python_par_kwargs ) { // No context is used. // Local variable declarations. PyObjectLocalVariable par_args; par_args.object = _python_par_args; PyObjectLocalVariable par_kwargs; par_kwargs.object = _python_par_kwargs; PyObject *exception_type = NULL, *exception_value = NULL; PyTracebackObject *exception_tb = NULL; PyObject *tmp_dircall_arg1_1; PyObject *tmp_dircall_arg2_1; PyObject *tmp_dircall_arg3_1; PyObject *tmp_frame_locals; PyObject *tmp_return_value; PyObject *tmp_source_name_1; tmp_return_value = NULL; // Actual function code. static PyFrameObject *cache_frame_function = NULL; MAKE_OR_REUSE_FRAME( cache_frame_function, codeobj_133c4414c20d7de5bf4cbf02f8208534, module_Crypto$Random ); PyFrameObject *frame_function = cache_frame_function; // Push the new frame as the currently active one. pushFrameStack( frame_function ); // Mark the frame object as in use, ref count 1 will be up for reuse. Py_INCREF( frame_function ); assert( Py_REFCNT( frame_function ) == 2 ); // Frame stack #if PYTHON_VERSION >= 340 frame_function->f_executing += 1; #endif // Framed code: tmp_source_name_1 = GET_STRING_DICT_VALUE( moduledict_Crypto$Random, (Nuitka_StringObject *)const_str_plain__UserFriendlyRNG ); if (unlikely( tmp_source_name_1 == NULL )) { tmp_source_name_1 = GET_STRING_DICT_VALUE( dict_builtin, (Nuitka_StringObject *)const_str_plain__UserFriendlyRNG ); } if ( tmp_source_name_1 == NULL ) { exception_type = INCREASE_REFCOUNT( PyExc_NameError ); exception_value = UNSTREAM_STRING( &constant_bin[ 6196 ], 45, 0 ); exception_tb = NULL; frame_function->f_lineno = 33; goto frame_exception_exit_1; } tmp_dircall_arg1_1 = LOOKUP_ATTRIBUTE( tmp_source_name_1, const_str_plain_new ); if ( tmp_dircall_arg1_1 == NULL ) { assert( ERROR_OCCURED() ); PyErr_Fetch( &exception_type, &exception_value, (PyObject **)&exception_tb ); frame_function->f_lineno = 33; goto frame_exception_exit_1; } tmp_dircall_arg2_1 = par_args.object; if ( tmp_dircall_arg2_1 == NULL ) { Py_DECREF( tmp_dircall_arg1_1 ); exception_type = INCREASE_REFCOUNT( PyExc_UnboundLocalError ); exception_value = UNSTREAM_STRING( &constant_bin[ 201 ], 50, 0 ); exception_tb = NULL; frame_function->f_lineno = 33; goto frame_exception_exit_1; } tmp_dircall_arg3_1 = par_kwargs.object; if ( tmp_dircall_arg3_1 == NULL ) { Py_DECREF( tmp_dircall_arg1_1 ); exception_type = INCREASE_REFCOUNT( PyExc_UnboundLocalError ); exception_value = UNSTREAM_STRING( &constant_bin[ 251 ], 52, 0 ); exception_tb = NULL; frame_function->f_lineno = 33; goto frame_exception_exit_1; } tmp_return_value = impl_function_3_complex_call_helper_star_list_star_dict_of_module___internal__( tmp_dircall_arg1_1, INCREASE_REFCOUNT( tmp_dircall_arg2_1 ), INCREASE_REFCOUNT( tmp_dircall_arg3_1 ) ); if ( tmp_return_value == NULL ) { assert( ERROR_OCCURED() ); PyErr_Fetch( &exception_type, &exception_value, (PyObject **)&exception_tb ); frame_function->f_lineno = 33; goto frame_exception_exit_1; } goto frame_return_exit_1; #if 0 RESTORE_FRAME_EXCEPTION( frame_function ); #endif // Put the previous frame back on top. popFrameStack(); #if PYTHON_VERSION >= 340 frame_function->f_executing -= 1; #endif Py_DECREF( frame_function ); goto frame_no_exception_1; frame_return_exit_1:; #if 0 RESTORE_FRAME_EXCEPTION( frame_function ); #endif popFrameStack(); #if PYTHON_VERSION >= 340 frame_function->f_executing -= 1; #endif Py_DECREF( frame_function ); goto function_return_exit; frame_exception_exit_1:; #if 0 RESTORE_FRAME_EXCEPTION( frame_function ); #endif if ( exception_tb == NULL ) { exception_tb = MAKE_TRACEBACK( INCREASE_REFCOUNT( frame_function ) ); } else if ( exception_tb->tb_frame != frame_function ) { PyTracebackObject *traceback_new = (PyTracebackObject *)MAKE_TRACEBACK( INCREASE_REFCOUNT( frame_function ) ); traceback_new->tb_next = exception_tb; exception_tb = traceback_new; } tmp_frame_locals = PyDict_New(); if ((par_args.object != NULL)) { PyDict_SetItem( tmp_frame_locals, const_str_plain_args, par_args.object ); } if ((par_kwargs.object != NULL)) { PyDict_SetItem( tmp_frame_locals, const_str_plain_kwargs, par_kwargs.object ); } detachFrame( exception_tb, tmp_frame_locals ); popFrameStack(); #if PYTHON_VERSION >= 340 frame_function->f_executing -= 1; #endif Py_DECREF( frame_function ); // Return the error. goto function_exception_exit; frame_no_exception_1:; // Return statement must be present. assert(false); function_exception_exit: assert( exception_type ); PyErr_Restore( exception_type, exception_value, (PyObject *)exception_tb ); return NULL; function_return_exit: return tmp_return_value; }
static PyObject * typecast_PYDATETIME_cast(const char *str, Py_ssize_t len, PyObject *curs) { PyObject* obj = NULL; PyObject *tzinfo = NULL; PyObject *tzinfo_factory; int n, y=0, m=0, d=0; int hh=0, mm=0, ss=0, us=0, tz=0; const char *tp = NULL; if (str == NULL) {Py_INCREF(Py_None); return Py_None;} /* check for infinity */ if (!strcmp(str, "infinity") || !strcmp(str, "-infinity")) { if (str[0] == '-') { obj = PyObject_GetAttrString( (PyObject*)PyDateTimeAPI->DateTimeType, "min"); } else { obj = PyObject_GetAttrString( (PyObject*)PyDateTimeAPI->DateTimeType, "max"); } } else { Dprintf("typecast_PYDATETIME_cast: s = %s", str); n = typecast_parse_date(str, &tp, &len, &y, &m, &d); Dprintf("typecast_PYDATE_cast: tp = %p " "n = %d, len = " FORMAT_CODE_PY_SSIZE_T "," " y = %d, m = %d, d = %d", tp, n, len, y, m, d); if (n != 3) { PyErr_SetString(DataError, "unable to parse date"); return NULL; } if (len > 0) { n = typecast_parse_time(tp, NULL, &len, &hh, &mm, &ss, &us, &tz); Dprintf("typecast_PYDATETIME_cast: n = %d," " len = " FORMAT_CODE_PY_SSIZE_T "," " hh = %d, mm = %d, ss = %d, us = %d, tz = %d", n, len, hh, mm, ss, us, tz); if (n < 3 || n > 6) { PyErr_SetString(DataError, "unable to parse time"); return NULL; } } if (ss > 59) { mm += 1; ss -= 60; } if (y > 9999) y = 9999; tzinfo_factory = ((cursorObject *)curs)->tzinfo_factory; if (n >= 5 && tzinfo_factory != Py_None) { /* we have a time zone, calculate minutes and create appropriate tzinfo object calling the factory */ Dprintf("typecast_PYDATETIME_cast: UTC offset = %ds", tz); /* The datetime module requires that time zone offsets be a whole number of minutes, so truncate the seconds to the closest minute. */ // printf("%d %d %d\n", tz, tzmin, round(tz / 60.0)); tzinfo = PyObject_CallFunction(tzinfo_factory, "i", (int)round(tz / 60.0)); } else { Py_INCREF(Py_None); tzinfo = Py_None; } if (tzinfo != NULL) { obj = PyObject_CallFunction( (PyObject*)PyDateTimeAPI->DateTimeType, "iiiiiiiO", y, m, d, hh, mm, ss, us, tzinfo); Dprintf("typecast_PYDATETIME_cast: tzinfo: %p, refcnt = " FORMAT_CODE_PY_SSIZE_T, tzinfo, Py_REFCNT(tzinfo) ); Py_DECREF(tzinfo); } } return obj; }
// The module function definitions. static PyObject *impl_function_1_permalink_of_module_django__db__models( Nuitka_FunctionObject *self, PyObject *_python_par_func ) { // No context is used. // Local variable declarations. PyObjectSharedLocalVariable _python_var_func( _python_str_plain_func, _python_par_func ); PyObjectSharedLocalVariable _python_var_reverse( _python_str_plain_reverse ); PyObjectLocalVariable _python_var_inner( _python_str_plain_inner ); // Actual function code. static PyFrameObject *frame_function_1_permalink_of_module_django__db__models = NULL; if ( isFrameUnusable( frame_function_1_permalink_of_module_django__db__models ) ) { if ( frame_function_1_permalink_of_module_django__db__models ) { #if _DEBUG_REFRAME puts( "reframe for function_1_permalink_of_module_django__db__models" ); #endif Py_DECREF( frame_function_1_permalink_of_module_django__db__models ); } frame_function_1_permalink_of_module_django__db__models = MAKE_FRAME( _codeobj_da16f767a7fecea956689af1d24a2307, _module_django__db__models ); } FrameGuard frame_guard( frame_function_1_permalink_of_module_django__db__models ); try { assert( Py_REFCNT( frame_function_1_permalink_of_module_django__db__models ) == 2 ); // Frame stack frame_guard.setLineNumber( 28 ); _python_var_reverse.assign1( IMPORT_NAME( PyObjectTemporary( IMPORT_MODULE( _python_str_digest_4c07869702570273c29e851966a4b9ca, ((PyModuleObject *)_module_django__db__models)->md_dict, PyObjectTemporary( _python_var_func.updateLocalsDict( _python_var_inner.updateLocalsDict( _python_var_reverse.updateLocalsDict( PyDict_New() ) ) ) ).asObject(), _python_list_str_plain_reverse_list, _python_int_neg_1 ) ).asObject(), _python_str_plain_reverse ) ); frame_guard.setLineNumber( 29 ); { PyObjectTempKeeper0 call1; _python_var_inner.assign1( CALL_FUNCTION_WITH_ARGS( PyObjectTemporary( ( call1.assign( _mvar_django__db__models_wraps.asObject0() ), CALL_FUNCTION_WITH_ARGS( call1.asObject0(), _python_var_func.asObject() ) ) ).asObject(), PyObjectTemporary( MAKE_FUNCTION_function_1_inner_of_function_1_permalink_of_module_django__db__models( _python_var_func, _python_var_reverse ) ).asObject() ) ); } frame_guard.setLineNumber( 33 ); return _python_var_inner.asObject1(); } catch ( PythonException &_exception ) { if ( !_exception.hasTraceback() ) { _exception.setTraceback( MAKE_TRACEBACK( frame_guard.getFrame() ) ); } else { _exception.addTraceback( frame_guard.getFrame0() ); } Py_XDECREF( frame_guard.getFrame0()->f_locals ); frame_guard.getFrame0()->f_locals = _python_var_func.updateLocalsDict( _python_var_inner.updateLocalsDict( _python_var_reverse.updateLocalsDict( PyDict_New() ) ) ); if ( frame_guard.getFrame0() == frame_function_1_permalink_of_module_django__db__models ) { Py_DECREF( frame_function_1_permalink_of_module_django__db__models ); frame_function_1_permalink_of_module_django__db__models = NULL; } _exception.toPython(); return NULL; } }
inline void xdecref(T* p) { assert( !p || Py_REFCNT(python::upcast<PyObject>(p)) > 0 ); Py_XDECREF(python::upcast<PyObject>(p)); }
int _PyIOBase_finalize(PyObject *self) { PyObject *res; PyObject *tp, *v, *tb; int closed = 1; int is_zombie; /* If _PyIOBase_finalize() is called from a destructor, we need to resurrect the object as calling close() can invoke arbitrary code. */ is_zombie = (Py_REFCNT(self) == 0); if (is_zombie) { ++Py_REFCNT(self); } PyErr_Fetch(&tp, &v, &tb); /* If `closed` doesn't exist or can't be evaluated as bool, then the object is probably in an unusable state, so ignore. */ res = PyObject_GetAttr(self, _PyIO_str_closed); if (res == NULL) PyErr_Clear(); else { closed = PyObject_IsTrue(res); Py_DECREF(res); if (closed == -1) PyErr_Clear(); } if (closed == 0) { res = PyObject_CallMethodObjArgs((PyObject *) self, _PyIO_str_close, NULL); /* Silencing I/O errors is bad, but printing spurious tracebacks is equally as bad, and potentially more frequent (because of shutdown issues). */ if (res == NULL) PyErr_Clear(); else Py_DECREF(res); } PyErr_Restore(tp, v, tb); if (is_zombie) { if (--Py_REFCNT(self) != 0) { /* The object lives again. The following code is taken from slot_tp_del in typeobject.c. */ Py_ssize_t refcnt = Py_REFCNT(self); _Py_NewReference(self); Py_REFCNT(self) = refcnt; /* If Py_REF_DEBUG, _Py_NewReference bumped _Py_RefTotal, so * we need to undo that. */ _Py_DEC_REFTOTAL; /* If Py_TRACE_REFS, _Py_NewReference re-added self to the object * chain, so no more to do there. * If COUNT_ALLOCS, the original decref bumped tp_frees, and * _Py_NewReference bumped tp_allocs: both of those need to be * undone. */ #ifdef COUNT_ALLOCS --Py_TYPE(self)->tp_frees; --Py_TYPE(self)->tp_allocs; #endif return -1; } } return 0; }
static PyObject * psyco_conn_cursor(connectionObject *self, PyObject *args, PyObject *kwargs) { PyObject *obj; PyObject *name = Py_None; PyObject *factory = (PyObject *)&cursorType; PyObject *withhold = Py_False; static char *kwlist[] = {"name", "cursor_factory", "withhold", NULL}; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|OOO", kwlist, &name, &factory, &withhold)) { return NULL; } if (PyObject_IsTrue(withhold) && (name == Py_None)) { PyErr_SetString(ProgrammingError, "'withhold=True can be specified only for named cursors"); return NULL; } EXC_IF_CONN_CLOSED(self); if (self->status != CONN_STATUS_READY && self->status != CONN_STATUS_BEGIN && self->status != CONN_STATUS_PREPARED) { PyErr_SetString(OperationalError, "asynchronous connection attempt underway"); return NULL; } if (name != Py_None && self->async == 1) { PyErr_SetString(ProgrammingError, "asynchronous connections " "cannot produce named cursors"); return NULL; } Dprintf("psyco_conn_cursor: new %s cursor for connection at %p", (name == Py_None ? "unnamed" : "named"), self); if (!(obj = PyObject_CallFunctionObjArgs(factory, self, name, NULL))) { return NULL; } if (PyObject_IsInstance(obj, (PyObject *)&cursorType) == 0) { PyErr_SetString(PyExc_TypeError, "cursor factory must be subclass of psycopg2._psycopg.cursor"); Py_DECREF(obj); return NULL; } if (PyObject_IsTrue(withhold)) ((cursorObject*)obj)->withhold = 1; Dprintf("psyco_conn_cursor: new cursor at %p: refcnt = " FORMAT_CODE_PY_SSIZE_T, obj, Py_REFCNT(obj) ); return obj; }
static PyObject * partial_new(PyTypeObject *type, PyObject *args, PyObject *kw) { PyObject *func, *pargs, *nargs, *pkw; partialobject *pto; if (PyTuple_GET_SIZE(args) < 1) { PyErr_SetString(PyExc_TypeError, "type 'partial' takes at least one argument"); return NULL; } pargs = pkw = NULL; func = PyTuple_GET_ITEM(args, 0); if (Py_TYPE(func) == &partial_type && type == &partial_type) { partialobject *part = (partialobject *)func; if (part->dict == NULL) { pargs = part->args; pkw = part->kw; func = part->fn; assert(PyTuple_Check(pargs)); assert(PyDict_Check(pkw)); } } if (!PyCallable_Check(func)) { PyErr_SetString(PyExc_TypeError, "the first argument must be callable"); return NULL; } /* create partialobject structure */ pto = (partialobject *)type->tp_alloc(type, 0); if (pto == NULL) return NULL; pto->fn = func; Py_INCREF(func); nargs = PyTuple_GetSlice(args, 1, PY_SSIZE_T_MAX); if (nargs == NULL) { Py_DECREF(pto); return NULL; } if (pargs == NULL) { pto->args = nargs; } else { pto->args = PySequence_Concat(pargs, nargs); Py_DECREF(nargs); if (pto->args == NULL) { Py_DECREF(pto); return NULL; } assert(PyTuple_Check(pto->args)); } if (pkw == NULL || PyDict_GET_SIZE(pkw) == 0) { if (kw == NULL) { pto->kw = PyDict_New(); } else if (Py_REFCNT(kw) == 1) { Py_INCREF(kw); pto->kw = kw; } else { pto->kw = PyDict_Copy(kw); } } else { pto->kw = PyDict_Copy(pkw); if (kw != NULL && pto->kw != NULL) { if (PyDict_Merge(pto->kw, kw, 1) != 0) { Py_DECREF(pto); return NULL; } } } if (pto->kw == NULL) { Py_DECREF(pto); return NULL; } pto->use_fastcall = _PyObject_HasFastCall(func); return (PyObject *)pto; }
long int pyobj_refcnt(PyObject *obj) { return Py_REFCNT(obj); }
static PyObject * psyco_conn_cursor(connectionObject *self, PyObject *args, PyObject *kwargs) { PyObject *obj = NULL; PyObject *rv = NULL; PyObject *name = Py_None; PyObject *factory = (PyObject *)&cursorType; PyObject *withhold = Py_False; PyObject *scrollable = Py_None; static char *kwlist[] = { "name", "cursor_factory", "withhold", "scrollable", NULL}; EXC_IF_CONN_CLOSED(self); if (self->cursor_factory && self->cursor_factory != Py_None) { factory = self->cursor_factory; } if (!PyArg_ParseTupleAndKeywords( args, kwargs, "|OOOO", kwlist, &name, &factory, &withhold, &scrollable)) { goto exit; } if (self->status != CONN_STATUS_READY && self->status != CONN_STATUS_BEGIN && self->status != CONN_STATUS_PREPARED) { PyErr_SetString(OperationalError, "asynchronous connection attempt underway"); goto exit; } if (name != Py_None && self->async == 1) { PyErr_SetString(ProgrammingError, "asynchronous connections " "cannot produce named cursors"); goto exit; } Dprintf("psyco_conn_cursor: new %s cursor for connection at %p", (name == Py_None ? "unnamed" : "named"), self); if (!(obj = PyObject_CallFunctionObjArgs(factory, self, name, NULL))) { goto exit; } if (PyObject_IsInstance(obj, (PyObject *)&cursorType) == 0) { PyErr_SetString(PyExc_TypeError, "cursor factory must be subclass of psycopg2._psycopg.cursor"); goto exit; } if (0 != psyco_curs_withhold_set((cursorObject *)obj, withhold)) { goto exit; } if (0 != psyco_curs_scrollable_set((cursorObject *)obj, scrollable)) { goto exit; } Dprintf("psyco_conn_cursor: new cursor at %p: refcnt = " FORMAT_CODE_PY_SSIZE_T, obj, Py_REFCNT(obj) ); rv = obj; obj = NULL; exit: Py_XDECREF(obj); return rv; }
static PyObject * test_memotable(PyObject *self) { PyMemoTable *memo, *copy; PyObject *five, *three; long i, refcnt; #define ASSERT_EQ(a, b, msg) if ((a) != (b)) { \ return raiseTestError("test_memotable", #a " != " #b ": " msg); } memo = PyMemoTable_New(); ASSERT_EQ(PyMemoTable_Size(memo), 0, "Non-zero empty size"); five = PyInt_FromLong(5); assert(five && "Failed to get 5"); ASSERT_EQ(PyMemoTable_Get(memo, five), NULL, "Got invalid entry"); refcnt = Py_REFCNT(five); PyMemoTable_Set(memo, five, 7); ASSERT_EQ(PyMemoTable_Size(memo), 1, "Bad memo size"); ASSERT_EQ(*PyMemoTable_Get(memo, five), 7, "Failed to get entry"); ASSERT_EQ(Py_REFCNT(five), refcnt + 1, "Failed to incref key"); /* Update an existing entry */ PyMemoTable_Set(memo, five, 9); ASSERT_EQ(PyMemoTable_Size(memo), 1, "Bad memo size"); ASSERT_EQ(*PyMemoTable_Get(memo, five), 9, "Failed to get entry"); ASSERT_EQ(Py_REFCNT(five), refcnt + 1, "Incorrectly increfed key"); /* Clear the memo */ PyMemoTable_Clear(memo); ASSERT_EQ(PyMemoTable_Size(memo), 0, "Non-zero empty size"); ASSERT_EQ(PyMemoTable_Get(memo, five), NULL, "Got invalid entry"); Py_DECREF(five); /* Insert enough entries to trigger a resize. These tests rely on the fact that Python caches small ints so that we end up with the same object in each of the two loops below. */ for (i = 1; i < 12; i++) { PyObject *obj = PyInt_FromLong(i); assert(obj && "Failed to create an int"); PyMemoTable_Set(memo, obj, i); Py_DECREF(obj); } ASSERT_EQ(PyMemoTable_Size(memo), 11, "Bad memo size"); ASSERT_EQ(memo->mt_allocated, 32, "Allocated less/more than expected"); for (i = 1; i < 12; i++) { PyObject *obj = PyInt_FromLong(i); assert(obj && "Failed to create an int"); ASSERT_EQ(*PyMemoTable_Get(memo, obj), i, "Wrong value"); Py_DECREF(obj); } /* Copy the memo, and verify that the copy is independent. */ copy = PyMemoTable_Copy(memo); three = PyInt_FromLong(3); assert(three && "Failed to create an int"); PyMemoTable_Set(copy, three, 777); ASSERT_EQ(*PyMemoTable_Get(memo, three), 3, "Wrong value"); ASSERT_EQ(*PyMemoTable_Get(copy, three), 777, "Wrong value"); Py_DECREF(three); PyMemoTable_Del(memo); PyMemoTable_Del(copy); Py_RETURN_NONE; #undef ASSERT_EQ }
MOD_INIT_DECL( pip$_vendor$requests$status_codes ) { #if defined(_NUITKA_EXE) || PYTHON_VERSION >= 300 static bool _init_done = false; // Modules might be imported repeatedly, which is to be ignored. if ( _init_done ) { return MOD_RETURN_VALUE( module_pip$_vendor$requests$status_codes ); } else { _init_done = true; } #endif #ifdef _NUITKA_MODULE // In case of a stand alone extension module, need to call initialization // the init here because that's the first and only time we are going to get // called here. // Initialize the constant values used. _initBuiltinModule(); createGlobalConstants(); // Initialize the compiled types of Nuitka. PyType_Ready( &Nuitka_Generator_Type ); PyType_Ready( &Nuitka_Function_Type ); PyType_Ready( &Nuitka_Method_Type ); PyType_Ready( &Nuitka_Frame_Type ); #if PYTHON_VERSION >= 350 PyType_Ready( &Nuitka_Coroutine_Type ); PyType_Ready( &Nuitka_CoroutineWrapper_Type ); #endif #if PYTHON_VERSION < 300 _initSlotCompare(); #endif #if PYTHON_VERSION >= 270 _initSlotIternext(); #endif patchBuiltinModule(); patchTypeComparison(); // Enable meta path based loader if not already done. setupMetaPathBasedLoader(); #if PYTHON_VERSION >= 300 patchInspectModule(); #endif #endif createModuleConstants(); createModuleCodeObjects(); // puts( "in initpip$_vendor$requests$status_codes" ); // Create the module object first. There are no methods initially, all are // added dynamically in actual code only. Also no "__doc__" is initially // set at this time, as it could not contain NUL characters this way, they // are instead set in early module code. No "self" for modules, we have no // use for it. #if PYTHON_VERSION < 300 module_pip$_vendor$requests$status_codes = Py_InitModule4( "pip._vendor.requests.status_codes", // Module Name NULL, // No methods initially, all are added // dynamically in actual module code only. NULL, // No __doc__ is initially set, as it could // not contain NUL this way, added early in // actual code. NULL, // No self for modules, we don't use it. PYTHON_API_VERSION ); #else module_pip$_vendor$requests$status_codes = PyModule_Create( &mdef_pip$_vendor$requests$status_codes ); #endif moduledict_pip$_vendor$requests$status_codes = (PyDictObject *)((PyModuleObject *)module_pip$_vendor$requests$status_codes)->md_dict; CHECK_OBJECT( module_pip$_vendor$requests$status_codes ); // Seems to work for Python2.7 out of the box, but for Python3, the module // doesn't automatically enter "sys.modules", so do it manually. #if PYTHON_VERSION >= 300 { int r = PyObject_SetItem( PySys_GetObject( (char *)"modules" ), const_str_digest_7407a472cb7f92da9dfbd02c8e685bfe, module_pip$_vendor$requests$status_codes ); assert( r != -1 ); } #endif // For deep importing of a module we need to have "__builtins__", so we set // it ourselves in the same way than CPython does. Note: This must be done // before the frame object is allocated, or else it may fail. PyObject *module_dict = PyModule_GetDict( module_pip$_vendor$requests$status_codes ); if ( PyDict_GetItem( module_dict, const_str_plain___builtins__ ) == NULL ) { PyObject *value = (PyObject *)builtin_module; // Check if main module, not a dict then. #if !defined(_NUITKA_EXE) || !0 value = PyModule_GetDict( value ); #endif #ifndef __NUITKA_NO_ASSERT__ int res = #endif PyDict_SetItem( module_dict, const_str_plain___builtins__, value ); assert( res == 0 ); } #if PYTHON_VERSION >= 330 PyDict_SetItem( module_dict, const_str_plain___loader__, metapath_based_loader ); #endif // Temp variables if any PyObject *tmp_for_loop_1__for_iterator = NULL; PyObject *tmp_for_loop_1__iter_value = NULL; PyObject *tmp_tuple_unpack_1__source_iter = NULL; PyObject *tmp_tuple_unpack_1__element_1 = NULL; PyObject *tmp_tuple_unpack_1__element_2 = NULL; PyObject *tmp_for_loop_2__for_iterator = NULL; PyObject *tmp_for_loop_2__iter_value = NULL; PyObject *exception_type = NULL, *exception_value = NULL; PyTracebackObject *exception_tb = NULL; NUITKA_MAY_BE_UNUSED int exception_lineno = -1; PyObject *exception_keeper_type_1; PyObject *exception_keeper_value_1; PyTracebackObject *exception_keeper_tb_1; NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_1; PyObject *exception_keeper_type_2; PyObject *exception_keeper_value_2; PyTracebackObject *exception_keeper_tb_2; NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_2; PyObject *exception_keeper_type_3; PyObject *exception_keeper_value_3; PyTracebackObject *exception_keeper_tb_3; NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_3; PyObject *tmp_assign_source_1; PyObject *tmp_assign_source_2; PyObject *tmp_assign_source_3; PyObject *tmp_assign_source_4; PyObject *tmp_assign_source_5; PyObject *tmp_assign_source_6; PyObject *tmp_assign_source_7; PyObject *tmp_assign_source_8; PyObject *tmp_assign_source_9; PyObject *tmp_assign_source_10; PyObject *tmp_assign_source_11; PyObject *tmp_assign_source_12; PyObject *tmp_assign_source_13; PyObject *tmp_assign_source_14; PyObject *tmp_assign_source_15; PyObject *tmp_assign_source_16; PyObject *tmp_assign_source_17; PyObject *tmp_called_name_1; PyObject *tmp_called_name_2; PyObject *tmp_called_name_3; PyObject *tmp_called_name_4; int tmp_cond_truth_1; PyObject *tmp_cond_value_1; PyObject *tmp_import_globals_1; PyObject *tmp_import_name_from_1; PyObject *tmp_iter_arg_1; PyObject *tmp_iter_arg_2; PyObject *tmp_iter_arg_3; PyObject *tmp_iterator_attempt; PyObject *tmp_iterator_name_1; PyObject *tmp_kw_name_1; PyObject *tmp_next_source_1; PyObject *tmp_next_source_2; PyObject *tmp_setattr_attr_1; PyObject *tmp_setattr_attr_2; PyObject *tmp_setattr_target_1; PyObject *tmp_setattr_target_2; PyObject *tmp_setattr_value_1; PyObject *tmp_setattr_value_2; PyObject *tmp_source_name_1; PyObject *tmp_source_name_2; PyObject *tmp_source_name_3; PyObject *tmp_unpack_1; PyObject *tmp_unpack_2; NUITKA_MAY_BE_UNUSED PyObject *tmp_unused; PyFrameObject *frame_module; // Module code. tmp_assign_source_1 = Py_None; UPDATE_STRING_DICT0( moduledict_pip$_vendor$requests$status_codes, (Nuitka_StringObject *)const_str_plain___doc__, tmp_assign_source_1 ); tmp_assign_source_2 = const_str_digest_edc503ce8640402b515eac9b4be2e49c; UPDATE_STRING_DICT0( moduledict_pip$_vendor$requests$status_codes, (Nuitka_StringObject *)const_str_plain___file__, tmp_assign_source_2 ); tmp_assign_source_3 = Py_None; UPDATE_STRING_DICT0( moduledict_pip$_vendor$requests$status_codes, (Nuitka_StringObject *)const_str_plain___cached__, tmp_assign_source_3 ); tmp_assign_source_4 = const_str_digest_92068ee7fa29014ac06ffc664a1b4b4e; UPDATE_STRING_DICT0( moduledict_pip$_vendor$requests$status_codes, (Nuitka_StringObject *)const_str_plain___package__, tmp_assign_source_4 ); // Frame without reuse. frame_module = MAKE_MODULE_FRAME( codeobj_fc398c3ce42402f17822919035abca66, module_pip$_vendor$requests$status_codes ); // Push the new frame as the currently active one, and we should be exclusively // owning it. pushFrameStack( frame_module ); assert( Py_REFCNT( frame_module ) == 1 ); #if PYTHON_VERSION >= 340 frame_module->f_executing += 1; #endif // Framed code: tmp_import_globals_1 = ((PyModuleObject *)module_pip$_vendor$requests$status_codes)->md_dict; frame_module->f_lineno = 3; tmp_import_name_from_1 = IMPORT_MODULE( const_str_plain_structures, tmp_import_globals_1, tmp_import_globals_1, const_tuple_str_plain_LookupDict_tuple, const_int_pos_1 ); if ( tmp_import_name_from_1 == NULL ) { assert( ERROR_OCCURRED() ); FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb ); exception_lineno = 3; goto frame_exception_exit_1; } tmp_assign_source_5 = IMPORT_NAME( tmp_import_name_from_1, const_str_plain_LookupDict ); Py_DECREF( tmp_import_name_from_1 ); if ( tmp_assign_source_5 == NULL ) { assert( ERROR_OCCURRED() ); FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb ); exception_lineno = 3; goto frame_exception_exit_1; } UPDATE_STRING_DICT1( moduledict_pip$_vendor$requests$status_codes, (Nuitka_StringObject *)const_str_plain_LookupDict, tmp_assign_source_5 ); tmp_assign_source_6 = PyDict_Copy( const_dict_19730b058f28080932defca1165e072e ); UPDATE_STRING_DICT1( moduledict_pip$_vendor$requests$status_codes, (Nuitka_StringObject *)const_str_plain__codes, tmp_assign_source_6 ); tmp_called_name_1 = GET_STRING_DICT_VALUE( moduledict_pip$_vendor$requests$status_codes, (Nuitka_StringObject *)const_str_plain_LookupDict ); if (unlikely( tmp_called_name_1 == NULL )) { tmp_called_name_1 = GET_STRING_DICT_VALUE( dict_builtin, (Nuitka_StringObject *)const_str_plain_LookupDict ); } if ( tmp_called_name_1 == NULL ) { exception_type = PyExc_NameError; Py_INCREF( exception_type ); exception_value = PyUnicode_FromFormat( "name '%s' is not defined", "LookupDict" ); exception_tb = NULL; NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb ); CHAIN_EXCEPTION( exception_value ); exception_lineno = 84; goto frame_exception_exit_1; } tmp_kw_name_1 = PyDict_Copy( const_dict_38252060f20256dc080a28c7e1fb8512 ); frame_module->f_lineno = 84; tmp_assign_source_7 = CALL_FUNCTION_WITH_KEYARGS( tmp_called_name_1, tmp_kw_name_1 ); Py_DECREF( tmp_kw_name_1 ); if ( tmp_assign_source_7 == NULL ) { assert( ERROR_OCCURRED() ); FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb ); exception_lineno = 84; goto frame_exception_exit_1; } UPDATE_STRING_DICT1( moduledict_pip$_vendor$requests$status_codes, (Nuitka_StringObject *)const_str_plain_codes, tmp_assign_source_7 ); tmp_source_name_1 = GET_STRING_DICT_VALUE( moduledict_pip$_vendor$requests$status_codes, (Nuitka_StringObject *)const_str_plain__codes ); if (unlikely( tmp_source_name_1 == NULL )) { tmp_source_name_1 = GET_STRING_DICT_VALUE( dict_builtin, (Nuitka_StringObject *)const_str_plain__codes ); } if ( tmp_source_name_1 == NULL ) { exception_type = PyExc_NameError; Py_INCREF( exception_type ); exception_value = PyUnicode_FromFormat( "name '%s' is not defined", "_codes" ); exception_tb = NULL; NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb ); CHAIN_EXCEPTION( exception_value ); exception_lineno = 86; goto frame_exception_exit_1; } tmp_called_name_2 = LOOKUP_ATTRIBUTE( tmp_source_name_1, const_str_plain_items ); if ( tmp_called_name_2 == NULL ) { assert( ERROR_OCCURRED() ); FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb ); exception_lineno = 86; goto frame_exception_exit_1; } frame_module->f_lineno = 86; tmp_iter_arg_1 = CALL_FUNCTION_NO_ARGS( tmp_called_name_2 ); Py_DECREF( tmp_called_name_2 ); if ( tmp_iter_arg_1 == NULL ) { assert( ERROR_OCCURRED() ); FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb ); exception_lineno = 86; goto frame_exception_exit_1; } tmp_assign_source_8 = MAKE_ITERATOR( tmp_iter_arg_1 ); Py_DECREF( tmp_iter_arg_1 ); if ( tmp_assign_source_8 == NULL ) { assert( ERROR_OCCURRED() ); FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb ); exception_lineno = 86; goto frame_exception_exit_1; } assert( tmp_for_loop_1__for_iterator == NULL ); tmp_for_loop_1__for_iterator = tmp_assign_source_8; // Tried code: loop_start_1:; tmp_next_source_1 = tmp_for_loop_1__for_iterator; tmp_assign_source_9 = ITERATOR_NEXT( tmp_next_source_1 ); if ( tmp_assign_source_9 == NULL ) { if ( CHECK_AND_CLEAR_STOP_ITERATION_OCCURRED() ) { goto loop_end_1; } else { FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb ); frame_module->f_lineno = 86; goto try_except_handler_1; } } { PyObject *old = tmp_for_loop_1__iter_value; tmp_for_loop_1__iter_value = tmp_assign_source_9; Py_XDECREF( old ); } // Tried code: tmp_iter_arg_2 = tmp_for_loop_1__iter_value; tmp_assign_source_10 = MAKE_ITERATOR( tmp_iter_arg_2 ); if ( tmp_assign_source_10 == NULL ) { assert( ERROR_OCCURRED() ); FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb ); exception_lineno = 86; goto try_except_handler_2; } { PyObject *old = tmp_tuple_unpack_1__source_iter; tmp_tuple_unpack_1__source_iter = tmp_assign_source_10; Py_XDECREF( old ); } tmp_unpack_1 = tmp_tuple_unpack_1__source_iter; tmp_assign_source_11 = UNPACK_NEXT( tmp_unpack_1, 0, 2 ); if ( tmp_assign_source_11 == NULL ) { if ( !ERROR_OCCURRED() ) { exception_type = PyExc_StopIteration; Py_INCREF( exception_type ); exception_value = NULL; exception_tb = NULL; } else { FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb ); } exception_lineno = 86; goto try_except_handler_2; } { PyObject *old = tmp_tuple_unpack_1__element_1; tmp_tuple_unpack_1__element_1 = tmp_assign_source_11; Py_XDECREF( old ); } tmp_unpack_2 = tmp_tuple_unpack_1__source_iter; tmp_assign_source_12 = UNPACK_NEXT( tmp_unpack_2, 1, 2 ); if ( tmp_assign_source_12 == NULL ) { if ( !ERROR_OCCURRED() ) { exception_type = PyExc_StopIteration; Py_INCREF( exception_type ); exception_value = NULL; exception_tb = NULL; } else { FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb ); } exception_lineno = 86; goto try_except_handler_2; } { PyObject *old = tmp_tuple_unpack_1__element_2; tmp_tuple_unpack_1__element_2 = tmp_assign_source_12; Py_XDECREF( old ); } tmp_iterator_name_1 = tmp_tuple_unpack_1__source_iter; // Check if iterator has left-over elements. CHECK_OBJECT( tmp_iterator_name_1 ); assert( HAS_ITERNEXT( tmp_iterator_name_1 ) ); tmp_iterator_attempt = (*Py_TYPE( tmp_iterator_name_1 )->tp_iternext)( tmp_iterator_name_1 ); if (likely( tmp_iterator_attempt == NULL )) { PyObject *error = GET_ERROR_OCCURRED(); if ( error != NULL ) { if ( EXCEPTION_MATCH_BOOL_SINGLE( error, PyExc_StopIteration )) { CLEAR_ERROR_OCCURRED(); } else { FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb ); goto try_except_handler_2; } } } else { Py_DECREF( tmp_iterator_attempt ); // TODO: Could avoid PyErr_Format. #if PYTHON_VERSION < 300 PyErr_Format( PyExc_ValueError, "too many values to unpack" ); #else PyErr_Format( PyExc_ValueError, "too many values to unpack (expected 2)" ); #endif FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb ); goto try_except_handler_2; } goto try_end_1; // Exception handler code: try_except_handler_2:; exception_keeper_type_1 = exception_type; exception_keeper_value_1 = exception_value; exception_keeper_tb_1 = exception_tb; exception_keeper_lineno_1 = exception_lineno; exception_type = NULL; exception_value = NULL; exception_tb = NULL; exception_lineno = -1; Py_XDECREF( tmp_tuple_unpack_1__source_iter ); tmp_tuple_unpack_1__source_iter = NULL; Py_XDECREF( tmp_tuple_unpack_1__element_1 ); tmp_tuple_unpack_1__element_1 = NULL; Py_XDECREF( tmp_tuple_unpack_1__element_2 ); tmp_tuple_unpack_1__element_2 = NULL; // Re-raise. exception_type = exception_keeper_type_1; exception_value = exception_keeper_value_1; exception_tb = exception_keeper_tb_1; exception_lineno = exception_keeper_lineno_1; goto try_except_handler_1; // End of try: try_end_1:; tmp_assign_source_13 = tmp_tuple_unpack_1__element_1; UPDATE_STRING_DICT0( moduledict_pip$_vendor$requests$status_codes, (Nuitka_StringObject *)const_str_plain_code, tmp_assign_source_13 ); tmp_assign_source_14 = tmp_tuple_unpack_1__element_2; UPDATE_STRING_DICT0( moduledict_pip$_vendor$requests$status_codes, (Nuitka_StringObject *)const_str_plain_titles, tmp_assign_source_14 ); CHECK_OBJECT( (PyObject *)tmp_tuple_unpack_1__source_iter ); Py_DECREF( tmp_tuple_unpack_1__source_iter ); tmp_tuple_unpack_1__source_iter = NULL; Py_XDECREF( tmp_tuple_unpack_1__element_1 ); tmp_tuple_unpack_1__element_1 = NULL; Py_XDECREF( tmp_tuple_unpack_1__element_2 ); tmp_tuple_unpack_1__element_2 = NULL; tmp_iter_arg_3 = GET_STRING_DICT_VALUE( moduledict_pip$_vendor$requests$status_codes, (Nuitka_StringObject *)const_str_plain_titles ); if (unlikely( tmp_iter_arg_3 == NULL )) { tmp_iter_arg_3 = GET_STRING_DICT_VALUE( dict_builtin, (Nuitka_StringObject *)const_str_plain_titles ); } if ( tmp_iter_arg_3 == NULL ) { exception_type = PyExc_NameError; Py_INCREF( exception_type ); exception_value = PyUnicode_FromFormat( "name '%s' is not defined", "titles" ); exception_tb = NULL; NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb ); CHAIN_EXCEPTION( exception_value ); exception_lineno = 87; goto try_except_handler_1; } tmp_assign_source_15 = MAKE_ITERATOR( tmp_iter_arg_3 ); if ( tmp_assign_source_15 == NULL ) { assert( ERROR_OCCURRED() ); FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb ); exception_lineno = 87; goto try_except_handler_1; } { PyObject *old = tmp_for_loop_2__for_iterator; tmp_for_loop_2__for_iterator = tmp_assign_source_15; Py_XDECREF( old ); } // Tried code: loop_start_2:; tmp_next_source_2 = tmp_for_loop_2__for_iterator; tmp_assign_source_16 = ITERATOR_NEXT( tmp_next_source_2 ); if ( tmp_assign_source_16 == NULL ) { if ( CHECK_AND_CLEAR_STOP_ITERATION_OCCURRED() ) { goto loop_end_2; } else { FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb ); frame_module->f_lineno = 87; goto try_except_handler_3; } } { PyObject *old = tmp_for_loop_2__iter_value; tmp_for_loop_2__iter_value = tmp_assign_source_16; Py_XDECREF( old ); } tmp_assign_source_17 = tmp_for_loop_2__iter_value; UPDATE_STRING_DICT0( moduledict_pip$_vendor$requests$status_codes, (Nuitka_StringObject *)const_str_plain_title, tmp_assign_source_17 ); tmp_setattr_target_1 = GET_STRING_DICT_VALUE( moduledict_pip$_vendor$requests$status_codes, (Nuitka_StringObject *)const_str_plain_codes ); if (unlikely( tmp_setattr_target_1 == NULL )) { tmp_setattr_target_1 = GET_STRING_DICT_VALUE( dict_builtin, (Nuitka_StringObject *)const_str_plain_codes ); } if ( tmp_setattr_target_1 == NULL ) { exception_type = PyExc_NameError; Py_INCREF( exception_type ); exception_value = PyUnicode_FromFormat( "name '%s' is not defined", "codes" ); exception_tb = NULL; NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb ); CHAIN_EXCEPTION( exception_value ); exception_lineno = 88; goto try_except_handler_3; } tmp_setattr_attr_1 = GET_STRING_DICT_VALUE( moduledict_pip$_vendor$requests$status_codes, (Nuitka_StringObject *)const_str_plain_title ); if (unlikely( tmp_setattr_attr_1 == NULL )) { tmp_setattr_attr_1 = GET_STRING_DICT_VALUE( dict_builtin, (Nuitka_StringObject *)const_str_plain_title ); } if ( tmp_setattr_attr_1 == NULL ) { exception_type = PyExc_NameError; Py_INCREF( exception_type ); exception_value = PyUnicode_FromFormat( "name '%s' is not defined", "title" ); exception_tb = NULL; NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb ); CHAIN_EXCEPTION( exception_value ); exception_lineno = 88; goto try_except_handler_3; } tmp_setattr_value_1 = GET_STRING_DICT_VALUE( moduledict_pip$_vendor$requests$status_codes, (Nuitka_StringObject *)const_str_plain_code ); if (unlikely( tmp_setattr_value_1 == NULL )) { tmp_setattr_value_1 = GET_STRING_DICT_VALUE( dict_builtin, (Nuitka_StringObject *)const_str_plain_code ); } if ( tmp_setattr_value_1 == NULL ) { exception_type = PyExc_NameError; Py_INCREF( exception_type ); exception_value = PyUnicode_FromFormat( "name '%s' is not defined", "code" ); exception_tb = NULL; NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb ); CHAIN_EXCEPTION( exception_value ); exception_lineno = 88; goto try_except_handler_3; } tmp_unused = BUILTIN_SETATTR( tmp_setattr_target_1, tmp_setattr_attr_1, tmp_setattr_value_1 ); if ( tmp_unused == NULL ) { assert( ERROR_OCCURRED() ); FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb ); exception_lineno = 88; goto try_except_handler_3; } tmp_source_name_2 = GET_STRING_DICT_VALUE( moduledict_pip$_vendor$requests$status_codes, (Nuitka_StringObject *)const_str_plain_title ); if (unlikely( tmp_source_name_2 == NULL )) { tmp_source_name_2 = GET_STRING_DICT_VALUE( dict_builtin, (Nuitka_StringObject *)const_str_plain_title ); } if ( tmp_source_name_2 == NULL ) { exception_type = PyExc_NameError; Py_INCREF( exception_type ); exception_value = PyUnicode_FromFormat( "name '%s' is not defined", "title" ); exception_tb = NULL; NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb ); CHAIN_EXCEPTION( exception_value ); exception_lineno = 89; goto try_except_handler_3; } tmp_called_name_3 = LOOKUP_ATTRIBUTE( tmp_source_name_2, const_str_plain_startswith ); if ( tmp_called_name_3 == NULL ) { assert( ERROR_OCCURRED() ); FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb ); exception_lineno = 89; goto try_except_handler_3; } frame_module->f_lineno = 89; tmp_cond_value_1 = CALL_FUNCTION_WITH_ARGS1( tmp_called_name_3, &PyTuple_GET_ITEM( const_tuple_str_chr_92_tuple, 0 ) ); Py_DECREF( tmp_called_name_3 ); if ( tmp_cond_value_1 == NULL ) { assert( ERROR_OCCURRED() ); FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb ); exception_lineno = 89; goto try_except_handler_3; } tmp_cond_truth_1 = CHECK_IF_TRUE( tmp_cond_value_1 ); if ( tmp_cond_truth_1 == -1 ) { assert( ERROR_OCCURRED() ); FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb ); Py_DECREF( tmp_cond_value_1 ); exception_lineno = 89; goto try_except_handler_3; } Py_DECREF( tmp_cond_value_1 ); if ( tmp_cond_truth_1 == 1 ) { goto branch_no_1; } else { goto branch_yes_1; } branch_yes_1:; tmp_setattr_target_2 = GET_STRING_DICT_VALUE( moduledict_pip$_vendor$requests$status_codes, (Nuitka_StringObject *)const_str_plain_codes ); if (unlikely( tmp_setattr_target_2 == NULL )) { tmp_setattr_target_2 = GET_STRING_DICT_VALUE( dict_builtin, (Nuitka_StringObject *)const_str_plain_codes ); } if ( tmp_setattr_target_2 == NULL ) { exception_type = PyExc_NameError; Py_INCREF( exception_type ); exception_value = PyUnicode_FromFormat( "name '%s' is not defined", "codes" ); exception_tb = NULL; NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb ); CHAIN_EXCEPTION( exception_value ); exception_lineno = 90; goto try_except_handler_3; } tmp_source_name_3 = GET_STRING_DICT_VALUE( moduledict_pip$_vendor$requests$status_codes, (Nuitka_StringObject *)const_str_plain_title ); if (unlikely( tmp_source_name_3 == NULL )) { tmp_source_name_3 = GET_STRING_DICT_VALUE( dict_builtin, (Nuitka_StringObject *)const_str_plain_title ); } if ( tmp_source_name_3 == NULL ) { exception_type = PyExc_NameError; Py_INCREF( exception_type ); exception_value = PyUnicode_FromFormat( "name '%s' is not defined", "title" ); exception_tb = NULL; NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb ); CHAIN_EXCEPTION( exception_value ); exception_lineno = 90; goto try_except_handler_3; } tmp_called_name_4 = LOOKUP_ATTRIBUTE( tmp_source_name_3, const_str_plain_upper ); if ( tmp_called_name_4 == NULL ) { assert( ERROR_OCCURRED() ); FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb ); exception_lineno = 90; goto try_except_handler_3; } frame_module->f_lineno = 90; tmp_setattr_attr_2 = CALL_FUNCTION_NO_ARGS( tmp_called_name_4 ); Py_DECREF( tmp_called_name_4 ); if ( tmp_setattr_attr_2 == NULL ) { assert( ERROR_OCCURRED() ); FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb ); exception_lineno = 90; goto try_except_handler_3; } tmp_setattr_value_2 = GET_STRING_DICT_VALUE( moduledict_pip$_vendor$requests$status_codes, (Nuitka_StringObject *)const_str_plain_code ); if (unlikely( tmp_setattr_value_2 == NULL )) { tmp_setattr_value_2 = GET_STRING_DICT_VALUE( dict_builtin, (Nuitka_StringObject *)const_str_plain_code ); } if ( tmp_setattr_value_2 == NULL ) { Py_DECREF( tmp_setattr_attr_2 ); exception_type = PyExc_NameError; Py_INCREF( exception_type ); exception_value = PyUnicode_FromFormat( "name '%s' is not defined", "code" ); exception_tb = NULL; NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb ); CHAIN_EXCEPTION( exception_value ); exception_lineno = 90; goto try_except_handler_3; } tmp_unused = BUILTIN_SETATTR( tmp_setattr_target_2, tmp_setattr_attr_2, tmp_setattr_value_2 ); Py_DECREF( tmp_setattr_attr_2 ); if ( tmp_unused == NULL ) { assert( ERROR_OCCURRED() ); FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb ); exception_lineno = 90; goto try_except_handler_3; } branch_no_1:; if ( CONSIDER_THREADING() == false ) { assert( ERROR_OCCURRED() ); FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb ); exception_lineno = 87; goto try_except_handler_3; } goto loop_start_2; loop_end_2:; goto try_end_2; // Exception handler code: try_except_handler_3:; exception_keeper_type_2 = exception_type; exception_keeper_value_2 = exception_value; exception_keeper_tb_2 = exception_tb; exception_keeper_lineno_2 = exception_lineno; exception_type = NULL; exception_value = NULL; exception_tb = NULL; exception_lineno = -1; Py_XDECREF( tmp_for_loop_2__iter_value ); tmp_for_loop_2__iter_value = NULL; Py_XDECREF( tmp_for_loop_2__for_iterator ); tmp_for_loop_2__for_iterator = NULL; // Re-raise. exception_type = exception_keeper_type_2; exception_value = exception_keeper_value_2; exception_tb = exception_keeper_tb_2; exception_lineno = exception_keeper_lineno_2; goto try_except_handler_1; // End of try: try_end_2:; Py_XDECREF( tmp_for_loop_2__iter_value ); tmp_for_loop_2__iter_value = NULL; Py_XDECREF( tmp_for_loop_2__for_iterator ); tmp_for_loop_2__for_iterator = NULL; if ( CONSIDER_THREADING() == false ) { assert( ERROR_OCCURRED() ); FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb ); exception_lineno = 86; goto try_except_handler_1; } goto loop_start_1; loop_end_1:; goto try_end_3; // Exception handler code: try_except_handler_1:; exception_keeper_type_3 = exception_type; exception_keeper_value_3 = exception_value; exception_keeper_tb_3 = exception_tb; exception_keeper_lineno_3 = exception_lineno; exception_type = NULL; exception_value = NULL; exception_tb = NULL; exception_lineno = -1; Py_XDECREF( tmp_for_loop_1__iter_value ); tmp_for_loop_1__iter_value = NULL; Py_XDECREF( tmp_for_loop_1__for_iterator ); tmp_for_loop_1__for_iterator = NULL; // Re-raise. exception_type = exception_keeper_type_3; exception_value = exception_keeper_value_3; exception_tb = exception_keeper_tb_3; exception_lineno = exception_keeper_lineno_3; goto frame_exception_exit_1; // End of try: try_end_3:; // Restore frame exception if necessary. #if 0 RESTORE_FRAME_EXCEPTION( frame_module ); #endif popFrameStack(); assertFrameObject( frame_module ); Py_DECREF( frame_module ); goto frame_no_exception_1; frame_exception_exit_1:; #if 0 RESTORE_FRAME_EXCEPTION( frame_module ); #endif if ( exception_tb == NULL ) { exception_tb = MAKE_TRACEBACK( frame_module, exception_lineno ); } else if ( exception_tb->tb_frame != frame_module ) { PyTracebackObject *traceback_new = MAKE_TRACEBACK( frame_module, exception_lineno ); traceback_new->tb_next = exception_tb; exception_tb = traceback_new; } // Put the previous frame back on top. popFrameStack(); #if PYTHON_VERSION >= 340 frame_module->f_executing -= 1; #endif Py_DECREF( frame_module ); // Return the error. goto module_exception_exit; frame_no_exception_1:; Py_XDECREF( tmp_for_loop_1__iter_value ); tmp_for_loop_1__iter_value = NULL; Py_XDECREF( tmp_for_loop_1__for_iterator ); tmp_for_loop_1__for_iterator = NULL; return MOD_RETURN_VALUE( module_pip$_vendor$requests$status_codes ); module_exception_exit: RESTORE_ERROR_OCCURRED( exception_type, exception_value, exception_tb ); return MOD_RETURN_VALUE( NULL ); }
MOD_INIT_DECL( chardet$langthaimodel ) { #if defined(_NUITKA_EXE) || PYTHON_VERSION >= 300 static bool _init_done = false; // Modules might be imported repeatedly, which is to be ignored. if ( _init_done ) { return MOD_RETURN_VALUE( module_chardet$langthaimodel ); } else { _init_done = true; } #endif #ifdef _NUITKA_MODULE // In case of a stand alone extension module, need to call initialization // the init here because that's the first and only time we are going to get // called here. // Initialize the constant values used. _initBuiltinModule(); createGlobalConstants(); // Initialize the compiled types of Nuitka. PyType_Ready( &Nuitka_Generator_Type ); PyType_Ready( &Nuitka_Function_Type ); PyType_Ready( &Nuitka_Method_Type ); PyType_Ready( &Nuitka_Frame_Type ); #if PYTHON_VERSION >= 350 PyType_Ready( &Nuitka_Coroutine_Type ); PyType_Ready( &Nuitka_CoroutineWrapper_Type ); #endif #if PYTHON_VERSION < 300 _initSlotCompare(); #endif #if PYTHON_VERSION >= 270 _initSlotIternext(); #endif patchBuiltinModule(); patchTypeComparison(); // Enable meta path based loader if not already done. setupMetaPathBasedLoader(); #if PYTHON_VERSION >= 300 patchInspectModule(); #endif #endif createModuleConstants(); createModuleCodeObjects(); // puts( "in initchardet$langthaimodel" ); // Create the module object first. There are no methods initially, all are // added dynamically in actual code only. Also no "__doc__" is initially // set at this time, as it could not contain NUL characters this way, they // are instead set in early module code. No "self" for modules, we have no // use for it. #if PYTHON_VERSION < 300 module_chardet$langthaimodel = Py_InitModule4( "chardet.langthaimodel", // Module Name NULL, // No methods initially, all are added // dynamically in actual module code only. NULL, // No __doc__ is initially set, as it could // not contain NUL this way, added early in // actual code. NULL, // No self for modules, we don't use it. PYTHON_API_VERSION ); #else module_chardet$langthaimodel = PyModule_Create( &mdef_chardet$langthaimodel ); #endif moduledict_chardet$langthaimodel = (PyDictObject *)((PyModuleObject *)module_chardet$langthaimodel)->md_dict; CHECK_OBJECT( module_chardet$langthaimodel ); // Seems to work for Python2.7 out of the box, but for Python3, the module // doesn't automatically enter "sys.modules", so do it manually. #if PYTHON_VERSION >= 300 { int r = PyObject_SetItem( PySys_GetObject( (char *)"modules" ), const_str_digest_dc79ec5cbcd38530b7ee96bca471ee48, module_chardet$langthaimodel ); assert( r != -1 ); } #endif // For deep importing of a module we need to have "__builtins__", so we set // it ourselves in the same way than CPython does. Note: This must be done // before the frame object is allocated, or else it may fail. PyObject *module_dict = PyModule_GetDict( module_chardet$langthaimodel ); if ( PyDict_GetItem( module_dict, const_str_plain___builtins__ ) == NULL ) { PyObject *value = (PyObject *)builtin_module; // Check if main module, not a dict then. #if !defined(_NUITKA_EXE) || !0 value = PyModule_GetDict( value ); #endif #ifndef __NUITKA_NO_ASSERT__ int res = #endif PyDict_SetItem( module_dict, const_str_plain___builtins__, value ); assert( res == 0 ); } #if PYTHON_VERSION >= 330 PyDict_SetItem( module_dict, const_str_plain___loader__, metapath_based_loader ); #endif // Temp variables if any PyObject *exception_type = NULL, *exception_value = NULL; PyTracebackObject *exception_tb = NULL; NUITKA_MAY_BE_UNUSED int exception_lineno = -1; PyObject *tmp_assign_source_1; PyObject *tmp_assign_source_2; PyObject *tmp_assign_source_3; PyObject *tmp_assign_source_4; PyObject *tmp_assign_source_5; PyObject *tmp_assign_source_6; PyObject *tmp_assign_source_7; PyObject *tmp_dict_key_1; PyObject *tmp_dict_key_2; PyObject *tmp_dict_key_3; PyObject *tmp_dict_key_4; PyObject *tmp_dict_key_5; PyObject *tmp_dict_value_1; PyObject *tmp_dict_value_2; PyObject *tmp_dict_value_3; PyObject *tmp_dict_value_4; PyObject *tmp_dict_value_5; PyFrameObject *frame_module; // Module code. tmp_assign_source_1 = Py_None; UPDATE_STRING_DICT0( moduledict_chardet$langthaimodel, (Nuitka_StringObject *)const_str_plain___doc__, tmp_assign_source_1 ); tmp_assign_source_2 = const_str_digest_fab0ff0cfd28ba77212ac4129d2d6d3f; UPDATE_STRING_DICT0( moduledict_chardet$langthaimodel, (Nuitka_StringObject *)const_str_plain___file__, tmp_assign_source_2 ); tmp_assign_source_3 = Py_None; UPDATE_STRING_DICT0( moduledict_chardet$langthaimodel, (Nuitka_StringObject *)const_str_plain___cached__, tmp_assign_source_3 ); tmp_assign_source_4 = const_str_plain_chardet; UPDATE_STRING_DICT0( moduledict_chardet$langthaimodel, (Nuitka_StringObject *)const_str_plain___package__, tmp_assign_source_4 ); tmp_assign_source_5 = const_tuple_7d72fee6787d507d887d69cdea35a4a9_tuple; UPDATE_STRING_DICT0( moduledict_chardet$langthaimodel, (Nuitka_StringObject *)const_str_plain_TIS620CharToOrderMap, tmp_assign_source_5 ); tmp_assign_source_6 = const_tuple_d3af699605e5a0a7fd9bffcfaf0dd97e_tuple; UPDATE_STRING_DICT0( moduledict_chardet$langthaimodel, (Nuitka_StringObject *)const_str_plain_ThaiLangModel, tmp_assign_source_6 ); // Frame without reuse. frame_module = MAKE_MODULE_FRAME( codeobj_2c0e8ffc754dbed723c12963ef7fcab5, module_chardet$langthaimodel ); // Push the new frame as the currently active one, and we should be exclusively // owning it. pushFrameStack( frame_module ); assert( Py_REFCNT( frame_module ) == 1 ); #if PYTHON_VERSION >= 340 frame_module->f_executing += 1; #endif // Framed code: tmp_assign_source_7 = _PyDict_NewPresized( 5 ); tmp_dict_key_1 = const_str_plain_charToOrderMap; tmp_dict_value_1 = GET_STRING_DICT_VALUE( moduledict_chardet$langthaimodel, (Nuitka_StringObject *)const_str_plain_TIS620CharToOrderMap ); if (unlikely( tmp_dict_value_1 == NULL )) { tmp_dict_value_1 = GET_STRING_DICT_VALUE( dict_builtin, (Nuitka_StringObject *)const_str_plain_TIS620CharToOrderMap ); } if ( tmp_dict_value_1 == NULL ) { Py_DECREF( tmp_assign_source_7 ); exception_type = PyExc_NameError; Py_INCREF( exception_type ); exception_value = PyUnicode_FromFormat( "name '%s' is not defined", "TIS620CharToOrderMap" ); exception_tb = NULL; NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb ); CHAIN_EXCEPTION( exception_value ); exception_lineno = 193; goto frame_exception_exit_1; } PyDict_SetItem( tmp_assign_source_7, tmp_dict_key_1, tmp_dict_value_1 ); tmp_dict_key_2 = const_str_plain_precedenceMatrix; tmp_dict_value_2 = GET_STRING_DICT_VALUE( moduledict_chardet$langthaimodel, (Nuitka_StringObject *)const_str_plain_ThaiLangModel ); if (unlikely( tmp_dict_value_2 == NULL )) { tmp_dict_value_2 = GET_STRING_DICT_VALUE( dict_builtin, (Nuitka_StringObject *)const_str_plain_ThaiLangModel ); } if ( tmp_dict_value_2 == NULL ) { Py_DECREF( tmp_assign_source_7 ); exception_type = PyExc_NameError; Py_INCREF( exception_type ); exception_value = PyUnicode_FromFormat( "name '%s' is not defined", "ThaiLangModel" ); exception_tb = NULL; NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb ); CHAIN_EXCEPTION( exception_value ); exception_lineno = 194; goto frame_exception_exit_1; } PyDict_SetItem( tmp_assign_source_7, tmp_dict_key_2, tmp_dict_value_2 ); tmp_dict_key_3 = const_str_plain_mTypicalPositiveRatio; tmp_dict_value_3 = const_float_0_926386; PyDict_SetItem( tmp_assign_source_7, tmp_dict_key_3, tmp_dict_value_3 ); tmp_dict_key_4 = const_str_plain_keepEnglishLetter; tmp_dict_value_4 = Py_False; PyDict_SetItem( tmp_assign_source_7, tmp_dict_key_4, tmp_dict_value_4 ); tmp_dict_key_5 = const_str_plain_charsetName; tmp_dict_value_5 = const_str_digest_81abb6a16c2b4c1510e4bf593a6a3c99; PyDict_SetItem( tmp_assign_source_7, tmp_dict_key_5, tmp_dict_value_5 ); UPDATE_STRING_DICT1( moduledict_chardet$langthaimodel, (Nuitka_StringObject *)const_str_plain_TIS620ThaiModel, tmp_assign_source_7 ); // Restore frame exception if necessary. #if 0 RESTORE_FRAME_EXCEPTION( frame_module ); #endif popFrameStack(); assertFrameObject( frame_module ); Py_DECREF( frame_module ); goto frame_no_exception_1; frame_exception_exit_1:; #if 0 RESTORE_FRAME_EXCEPTION( frame_module ); #endif if ( exception_tb == NULL ) { exception_tb = MAKE_TRACEBACK( frame_module, exception_lineno ); } else if ( exception_tb->tb_frame != frame_module ) { PyTracebackObject *traceback_new = MAKE_TRACEBACK( frame_module, exception_lineno ); traceback_new->tb_next = exception_tb; exception_tb = traceback_new; } // Put the previous frame back on top. popFrameStack(); #if PYTHON_VERSION >= 340 frame_module->f_executing -= 1; #endif Py_DECREF( frame_module ); // Return the error. goto module_exception_exit; frame_no_exception_1:; return MOD_RETURN_VALUE( module_chardet$langthaimodel ); module_exception_exit: RESTORE_ERROR_OCCURRED( exception_type, exception_value, exception_tb ); return MOD_RETURN_VALUE( NULL ); }
PyObject * PyModule_Create2(struct PyModuleDef* module, int module_api_version) { PyObject *d, *v, *n; PyMethodDef *ml; const char* name; PyModuleObject *m; if (!Py_IsInitialized()) Py_FatalError("Interpreter not initialized (version mismatch?)"); if (PyType_Ready(&moduledef_type) < 0) return NULL; if (module->m_base.m_index == 0) { max_module_number++; Py_REFCNT(module) = 1; Py_TYPE(module) = &moduledef_type; module->m_base.m_index = max_module_number; } name = module->m_name; if (module_api_version != PYTHON_API_VERSION) { char message[512]; PyOS_snprintf(message, sizeof(message), api_version_warning, name, PYTHON_API_VERSION, name, module_api_version); if (PyErr_WarnEx(PyExc_RuntimeWarning, message, 1)) return NULL; } /* Make sure name is fully qualified. This is a bit of a hack: when the shared library is loaded, the module name is "package.module", but the module calls PyModule_Create*() with just "module" for the name. The shared library loader squirrels away the true name of the module in _Py_PackageContext, and PyModule_Create*() will substitute this (if the name actually matches). */ if (_Py_PackageContext != NULL) { char *p = strrchr(_Py_PackageContext, '.'); if (p != NULL && strcmp(module->m_name, p+1) == 0) { name = _Py_PackageContext; _Py_PackageContext = NULL; } } if ((m = (PyModuleObject*)PyModule_New(name)) == NULL) return NULL; if (module->m_size > 0) { m->md_state = PyMem_MALLOC(module->m_size); if (!m->md_state) { PyErr_NoMemory(); Py_DECREF(m); return NULL; } memset(m->md_state, 0, module->m_size); } d = PyModule_GetDict((PyObject*)m); if (module->m_methods != NULL) { n = PyUnicode_FromString(name); if (n == NULL) return NULL; for (ml = module->m_methods; ml->ml_name != NULL; ml++) { if ((ml->ml_flags & METH_CLASS) || (ml->ml_flags & METH_STATIC)) { PyErr_SetString(PyExc_ValueError, "module functions cannot set" " METH_CLASS or METH_STATIC"); Py_DECREF(n); return NULL; } v = PyCFunction_NewEx(ml, (PyObject*)m, n); if (v == NULL) { Py_DECREF(n); return NULL; } if (PyDict_SetItemString(d, ml->ml_name, v) != 0) { Py_DECREF(v); Py_DECREF(n); return NULL; } Py_DECREF(v); } Py_DECREF(n); } if (module->m_doc != NULL) { v = PyUnicode_FromString(module->m_doc); if (v == NULL || PyDict_SetItemString(d, "__doc__", v) != 0) { Py_XDECREF(v); return NULL; } Py_DECREF(v); } m->md_def = module; return (PyObject*)m; }
NUITKA_MAY_BE_UNUSED static bool BINARY_OPERATION_ADD_INPLACE( PyObject **operand1, PyObject *operand2 ) { assert( operand1 ); CHECK_OBJECT( *operand1 ); CHECK_OBJECT( operand2 ); #if PYTHON_VERSION < 300 // Something similar for Python3 should exist too. if ( PyInt_CheckExact( *operand1 ) && PyInt_CheckExact( operand2 ) ) { long a, b, i; a = PyInt_AS_LONG( *operand1 ); b = PyInt_AS_LONG( operand2 ); i = a + b; // Detect overflow, in which case, a "long" object would have to be // created, which we won't handle here. TODO: Add an else for that // case. if (likely(!( (i^a) < 0 && (i^b) < 0 ) )) { PyObject *result = PyInt_FromLong( i ); Py_DECREF( *operand1 ); *operand1 = result; return true; } } #endif #if PYTHON_VERSION < 300 if ( Py_REFCNT( *operand1 ) == 1 ) { // We more or less own the operand, so we might re-use its storage and // execute stuff in-place. if ( PyString_CheckExact( *operand1 ) && !PyString_CHECK_INTERNED( *operand1 ) && PyString_CheckExact( operand2 ) ) { return STRING_ADD_INCREMENTAL( operand1, operand2 ); } else if ( PyFloat_CheckExact( *operand1 ) && PyFloat_CheckExact( operand2 ) ) { return FLOAT_ADD_INCREMENTAL( operand1, operand2 ); } } // Strings are to be treated differently. if ( PyString_CheckExact( *operand1 ) && PyString_CheckExact( operand2 ) ) { PyString_Concat( operand1, operand2 ); return !ERROR_OCCURRED(); } #else if ( Py_REFCNT( *operand1 ) == 1 ) { // We more or less own the operand, so we might re-use its storage and // execute stuff in-place. if ( PyUnicode_CheckExact( *operand1 ) && !PyUnicode_CHECK_INTERNED( *operand1 ) && PyUnicode_CheckExact( operand2 ) ) { return UNICODE_ADD_INCREMENTAL( operand1, operand2 ); } else if ( PyFloat_CheckExact( *operand1 ) && PyFloat_CheckExact( operand2 ) ) { return FLOAT_ADD_INCREMENTAL( operand1, operand2 ); } } // Strings are to be treated differently. if ( PyUnicode_CheckExact( *operand1 ) && PyUnicode_CheckExact( operand2 ) ) { PyObject *result = PyUnicode_Concat( *operand1, operand2 ); if (unlikely( result == NULL )) { return false; } Py_DECREF( *operand1 ); *operand1 = result; return true; } #endif PyObject *result = PyNumber_InPlaceAdd( *operand1, operand2 ); if (unlikely( result == NULL )) { return false; } // We got an object handed, that we have to release. Py_DECREF( *operand1 ); // That's our return value then. As we use a dedicated variable, it's // OK that way. *operand1 = result; return true; }
static PyObject *impl_function_1_inner_of_function_1_permalink_of_module_django__db__models( Nuitka_FunctionObject *self, PyObject *_python_par_args, PyObject *_python_par_kwargs ) { // The context of the function. struct _context_function_1_inner_of_function_1_permalink_of_module_django__db__models_t *_python_context = (struct _context_function_1_inner_of_function_1_permalink_of_module_django__db__models_t *)self->m_context; // Local variable declarations. PyObjectLocalParameterVariableNoDel _python_var_args( _python_str_plain_args, _python_par_args ); PyObjectLocalParameterVariableNoDel _python_var_kwargs( _python_str_plain_kwargs, _python_par_kwargs ); PyObjectLocalVariable _python_var_bits( _python_str_plain_bits ); // Actual function code. static PyFrameObject *frame_function_1_inner_of_function_1_permalink_of_module_django__db__models = NULL; if ( isFrameUnusable( frame_function_1_inner_of_function_1_permalink_of_module_django__db__models ) ) { if ( frame_function_1_inner_of_function_1_permalink_of_module_django__db__models ) { #if _DEBUG_REFRAME puts( "reframe for function_1_inner_of_function_1_permalink_of_module_django__db__models" ); #endif Py_DECREF( frame_function_1_inner_of_function_1_permalink_of_module_django__db__models ); } frame_function_1_inner_of_function_1_permalink_of_module_django__db__models = MAKE_FRAME( _codeobj_ec88213e934abceb2e8b2a7b45f7eae5, _module_django__db__models ); } FrameGuard frame_guard( frame_function_1_inner_of_function_1_permalink_of_module_django__db__models ); try { assert( Py_REFCNT( frame_function_1_inner_of_function_1_permalink_of_module_django__db__models ) == 2 ); // Frame stack frame_guard.setLineNumber( 31 ); { PyObjectTempKeeper0 call_tmp1; PyObjectTempKeeper0 call_tmp2; _python_var_bits.assign1( ( call_tmp1.assign( _python_context->python_closure_func.asObject() ), call_tmp2.assign( _python_var_args.asObject() ), impl_function_1_complex_call_helper_star_list_star_dict_of_module___internal__( call_tmp1.asObject(), call_tmp2.asObject(), _python_var_kwargs.asObject1() ) ) ); } frame_guard.setLineNumber( 32 ); { PyObjectTempKeeper0 call_tmp4; PyObjectTempKeeper1 call_tmp5; return ( call_tmp4.assign( _python_context->python_closure_reverse.asObject() ), call_tmp5.assign( MAKE_TUPLE2( PyObjectTemporary( LOOKUP_SUBSCRIPT_CONST( _python_var_bits.asObject(), _python_int_0, 0 ) ).asObject(), Py_None ) ), impl_function_5_complex_call_helper_pos_star_list_of_module___internal__( call_tmp4.asObject(), call_tmp5.asObject(), LOOKUP_INDEX_SLICE( _python_var_bits.asObject(), 1, 3 ) ) ); } } catch ( PythonException &_exception ) { if ( !_exception.hasTraceback() ) { _exception.setTraceback( MAKE_TRACEBACK( frame_guard.getFrame() ) ); } else { _exception.addTraceback( frame_guard.getFrame0() ); } Py_XDECREF( frame_guard.getFrame0()->f_locals ); frame_guard.getFrame0()->f_locals = _python_var_kwargs.updateLocalsDict( _python_var_args.updateLocalsDict( _python_context->python_closure_reverse.updateLocalsDict( _python_context->python_closure_func.updateLocalsDict( _python_var_bits.updateLocalsDict( PyDict_New() ) ) ) ) ); if ( frame_guard.getFrame0() == frame_function_1_inner_of_function_1_permalink_of_module_django__db__models ) { Py_DECREF( frame_function_1_inner_of_function_1_permalink_of_module_django__db__models ); frame_function_1_inner_of_function_1_permalink_of_module_django__db__models = NULL; } _exception.toPython(); return NULL; } }
long int pyobj_refcnt(void *obj) { return Py_REFCNT((PyObject *)obj); }
/* * Update the current Fiber reference on the current thread. The first time this * function is called on a given (real) thread, the main Fiber is created. */ static Fiber * update_current(void) { Fiber *current, *previous; PyObject *exc, *val, *tb, *tstate_dict; restart: /* save current exception */ PyErr_Fetch(&exc, &val, &tb); /* get current Fiber from the active thread-state */ tstate_dict = PyThreadState_GetDict(); if (tstate_dict == NULL) { if (!PyErr_Occurred()) { PyErr_NoMemory(); } return NULL; } current = (Fiber *)PyDict_GetItem(tstate_dict, current_fiber_key); if (current) { /* found - remove it, to avoid keeping a ref */ Py_INCREF(current); PyDict_DelItem(tstate_dict, current_fiber_key); } else { /* first time we see this thread-state, create main Fiber */ current = fiber_create_main(); if (current == NULL) { Py_XDECREF(exc); Py_XDECREF(val); Py_XDECREF(tb); return NULL; } if (_global_state.current == NULL) { /* First time a main Fiber is allocated in any thread */ _global_state.current = current; } } ASSERT(current->ts_dict == tstate_dict); retry: Py_INCREF(current); previous = _global_state.current; _global_state.current = current; if (PyDict_GetItem(previous->ts_dict, current_fiber_key) != (PyObject *)previous) { /* save previous as the current Fiber of its own (real) thread */ if (PyDict_SetItem(previous->ts_dict, current_fiber_key, (PyObject*) previous) < 0) { Py_DECREF(previous); Py_DECREF(current); Py_XDECREF(exc); Py_XDECREF(val); Py_XDECREF(tb); return NULL; } Py_DECREF(previous); } ASSERT(Py_REFCNT(previous) >= 1); if (_global_state.current != current) { /* some Python code executed above and there was a thread switch, * so the global current points to some other Fiber again. We need to * delete current_fiber_key and retry. */ PyDict_DelItem(tstate_dict, current_fiber_key); goto retry; } /* release the extra reference */ Py_DECREF(current); /* restore current exception */ PyErr_Restore(exc, val, tb); /* thread switch could happen during PyErr_Restore, in that case there's nothing to do except restart from scratch. */ if (_global_state.current->ts_dict != tstate_dict) { goto restart; } return current; }
// The module function definitions. static PyObject *impl_function_1_CacheControl_of_pip$_vendor$cachecontrol$wrapper( Nuitka_FunctionObject const *self, PyObject **python_pars ) { // Preserve error status for checks #ifndef __NUITKA_NO_ASSERT__ NUITKA_MAY_BE_UNUSED bool had_error = ERROR_OCCURRED(); #endif // Local variable declarations. PyObject *par_sess = python_pars[ 0 ]; PyObject *par_cache = python_pars[ 1 ]; PyObject *par_cache_etags = python_pars[ 2 ]; PyObject *par_serializer = python_pars[ 3 ]; PyObject *par_heuristic = python_pars[ 4 ]; PyObject *var_adapter = NULL; PyObject *exception_type = NULL, *exception_value = NULL; PyTracebackObject *exception_tb = NULL; NUITKA_MAY_BE_UNUSED int exception_lineno = -1; PyObject *exception_keeper_type_1; PyObject *exception_keeper_value_1; PyTracebackObject *exception_keeper_tb_1; NUITKA_MAY_BE_UNUSED int exception_keeper_lineno_1; PyObject *tmp_args_element_name_1; PyObject *tmp_args_element_name_2; PyObject *tmp_args_element_name_3; PyObject *tmp_args_element_name_4; PyObject *tmp_args_name_1; PyObject *tmp_assign_source_1; PyObject *tmp_assign_source_2; PyObject *tmp_called_name_1; PyObject *tmp_called_name_2; PyObject *tmp_called_name_3; PyObject *tmp_called_name_4; PyObject *tmp_dict_key_1; PyObject *tmp_dict_key_2; PyObject *tmp_dict_key_3; PyObject *tmp_dict_value_1; PyObject *tmp_dict_value_2; PyObject *tmp_dict_value_3; PyObject *tmp_frame_locals; PyObject *tmp_kw_name_1; int tmp_or_left_truth_1; PyObject *tmp_or_left_value_1; PyObject *tmp_or_right_value_1; PyObject *tmp_return_value; PyObject *tmp_source_name_1; PyObject *tmp_source_name_2; PyObject *tmp_tuple_element_1; NUITKA_MAY_BE_UNUSED PyObject *tmp_unused; static PyFrameObject *cache_frame_function = NULL; PyFrameObject *frame_function; tmp_return_value = NULL; // Actual function code. // Tried code: MAKE_OR_REUSE_FRAME( cache_frame_function, codeobj_079a8ba6ceda22079d731bf3f2f28ee9, module_pip$_vendor$cachecontrol$wrapper ); frame_function = cache_frame_function; // Push the new frame as the currently active one. pushFrameStack( frame_function ); // Mark the frame object as in use, ref count 1 will be up for reuse. Py_INCREF( frame_function ); assert( Py_REFCNT( frame_function ) == 2 ); // Frame stack #if PYTHON_VERSION >= 340 frame_function->f_executing += 1; #endif // Framed code: tmp_or_left_value_1 = par_cache; tmp_or_left_truth_1 = CHECK_IF_TRUE( tmp_or_left_value_1 ); if ( tmp_or_left_truth_1 == -1 ) { assert( ERROR_OCCURRED() ); FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb ); exception_lineno = 11; goto frame_exception_exit_1; } if ( tmp_or_left_truth_1 == 1 ) { goto or_left_1; } else { goto or_right_1; } or_right_1:; tmp_called_name_1 = GET_STRING_DICT_VALUE( moduledict_pip$_vendor$cachecontrol$wrapper, (Nuitka_StringObject *)const_str_plain_DictCache ); if (unlikely( tmp_called_name_1 == NULL )) { tmp_called_name_1 = GET_STRING_DICT_VALUE( dict_builtin, (Nuitka_StringObject *)const_str_plain_DictCache ); } if ( tmp_called_name_1 == NULL ) { exception_type = PyExc_NameError; Py_INCREF( exception_type ); exception_value = PyUnicode_FromFormat( "name '%s' is not defined", "DictCache" ); exception_tb = NULL; NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb ); CHAIN_EXCEPTION( exception_value ); exception_lineno = 11; goto frame_exception_exit_1; } frame_function->f_lineno = 11; tmp_or_right_value_1 = CALL_FUNCTION_NO_ARGS( tmp_called_name_1 ); if ( tmp_or_right_value_1 == NULL ) { assert( ERROR_OCCURRED() ); FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb ); exception_lineno = 11; goto frame_exception_exit_1; } tmp_assign_source_1 = tmp_or_right_value_1; goto or_end_1; or_left_1:; Py_INCREF( tmp_or_left_value_1 ); tmp_assign_source_1 = tmp_or_left_value_1; or_end_1:; { PyObject *old = par_cache; par_cache = tmp_assign_source_1; Py_XDECREF( old ); } tmp_called_name_2 = GET_STRING_DICT_VALUE( moduledict_pip$_vendor$cachecontrol$wrapper, (Nuitka_StringObject *)const_str_plain_CacheControlAdapter ); if (unlikely( tmp_called_name_2 == NULL )) { tmp_called_name_2 = GET_STRING_DICT_VALUE( dict_builtin, (Nuitka_StringObject *)const_str_plain_CacheControlAdapter ); } if ( tmp_called_name_2 == NULL ) { exception_type = PyExc_NameError; Py_INCREF( exception_type ); exception_value = PyUnicode_FromFormat( "name '%s' is not defined", "CacheControlAdapter" ); exception_tb = NULL; NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb ); CHAIN_EXCEPTION( exception_value ); exception_lineno = 12; goto frame_exception_exit_1; } tmp_args_name_1 = PyTuple_New( 1 ); tmp_tuple_element_1 = par_cache; Py_INCREF( tmp_tuple_element_1 ); PyTuple_SET_ITEM( tmp_args_name_1, 0, tmp_tuple_element_1 ); tmp_kw_name_1 = _PyDict_NewPresized( 3 ); tmp_dict_key_1 = const_str_plain_cache_etags; tmp_dict_value_1 = par_cache_etags; PyDict_SetItem( tmp_kw_name_1, tmp_dict_key_1, tmp_dict_value_1 ); tmp_dict_key_2 = const_str_plain_serializer; tmp_dict_value_2 = par_serializer; PyDict_SetItem( tmp_kw_name_1, tmp_dict_key_2, tmp_dict_value_2 ); tmp_dict_key_3 = const_str_plain_heuristic; tmp_dict_value_3 = par_heuristic; PyDict_SetItem( tmp_kw_name_1, tmp_dict_key_3, tmp_dict_value_3 ); frame_function->f_lineno = 16; tmp_assign_source_2 = CALL_FUNCTION( tmp_called_name_2, tmp_args_name_1, tmp_kw_name_1 ); Py_DECREF( tmp_args_name_1 ); Py_DECREF( tmp_kw_name_1 ); if ( tmp_assign_source_2 == NULL ) { assert( ERROR_OCCURRED() ); FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb ); exception_lineno = 16; goto frame_exception_exit_1; } assert( var_adapter == NULL ); var_adapter = tmp_assign_source_2; tmp_source_name_1 = par_sess; tmp_called_name_3 = LOOKUP_ATTRIBUTE( tmp_source_name_1, const_str_plain_mount ); if ( tmp_called_name_3 == NULL ) { assert( ERROR_OCCURRED() ); FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb ); exception_lineno = 18; goto frame_exception_exit_1; } tmp_args_element_name_1 = const_str_digest_7c06a402579f6f9d9db7f3e04da983fc; tmp_args_element_name_2 = var_adapter; if ( tmp_args_element_name_2 == NULL ) { Py_DECREF( tmp_called_name_3 ); exception_type = PyExc_UnboundLocalError; Py_INCREF( exception_type ); exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "adapter" ); exception_tb = NULL; NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb ); CHAIN_EXCEPTION( exception_value ); exception_lineno = 18; goto frame_exception_exit_1; } frame_function->f_lineno = 18; { PyObject *call_args[] = { tmp_args_element_name_1, tmp_args_element_name_2 }; tmp_unused = CALL_FUNCTION_WITH_ARGS2( tmp_called_name_3, call_args ); } Py_DECREF( tmp_called_name_3 ); if ( tmp_unused == NULL ) { assert( ERROR_OCCURRED() ); FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb ); exception_lineno = 18; goto frame_exception_exit_1; } Py_DECREF( tmp_unused ); tmp_source_name_2 = par_sess; if ( tmp_source_name_2 == NULL ) { exception_type = PyExc_UnboundLocalError; Py_INCREF( exception_type ); exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "sess" ); exception_tb = NULL; NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb ); CHAIN_EXCEPTION( exception_value ); exception_lineno = 19; goto frame_exception_exit_1; } tmp_called_name_4 = LOOKUP_ATTRIBUTE( tmp_source_name_2, const_str_plain_mount ); if ( tmp_called_name_4 == NULL ) { assert( ERROR_OCCURRED() ); FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb ); exception_lineno = 19; goto frame_exception_exit_1; } tmp_args_element_name_3 = const_str_digest_504b77692b694460b8c25198a52c83ba; tmp_args_element_name_4 = var_adapter; if ( tmp_args_element_name_4 == NULL ) { Py_DECREF( tmp_called_name_4 ); exception_type = PyExc_UnboundLocalError; Py_INCREF( exception_type ); exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "adapter" ); exception_tb = NULL; NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb ); CHAIN_EXCEPTION( exception_value ); exception_lineno = 19; goto frame_exception_exit_1; } frame_function->f_lineno = 19; { PyObject *call_args[] = { tmp_args_element_name_3, tmp_args_element_name_4 }; tmp_unused = CALL_FUNCTION_WITH_ARGS2( tmp_called_name_4, call_args ); } Py_DECREF( tmp_called_name_4 ); if ( tmp_unused == NULL ) { assert( ERROR_OCCURRED() ); FETCH_ERROR_OCCURRED( &exception_type, &exception_value, &exception_tb ); exception_lineno = 19; goto frame_exception_exit_1; } Py_DECREF( tmp_unused ); tmp_return_value = par_sess; if ( tmp_return_value == NULL ) { exception_type = PyExc_UnboundLocalError; Py_INCREF( exception_type ); exception_value = PyUnicode_FromFormat( "local variable '%s' referenced before assignment", "sess" ); exception_tb = NULL; NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb ); CHAIN_EXCEPTION( exception_value ); exception_lineno = 21; goto frame_exception_exit_1; } Py_INCREF( tmp_return_value ); goto frame_return_exit_1; #if 0 RESTORE_FRAME_EXCEPTION( frame_function ); #endif // Put the previous frame back on top. popFrameStack(); #if PYTHON_VERSION >= 340 frame_function->f_executing -= 1; #endif Py_DECREF( frame_function ); goto frame_no_exception_1; frame_return_exit_1:; #if 0 RESTORE_FRAME_EXCEPTION( frame_function ); #endif popFrameStack(); #if PYTHON_VERSION >= 340 frame_function->f_executing -= 1; #endif Py_DECREF( frame_function ); goto try_return_handler_1; frame_exception_exit_1:; #if 0 RESTORE_FRAME_EXCEPTION( frame_function ); #endif { bool needs_detach = false; if ( exception_tb == NULL ) { exception_tb = MAKE_TRACEBACK( frame_function, exception_lineno ); needs_detach = true; } else if ( exception_lineno != -1 ) { PyTracebackObject *traceback_new = MAKE_TRACEBACK( frame_function, exception_lineno ); traceback_new->tb_next = exception_tb; exception_tb = traceback_new; needs_detach = true; } if (needs_detach) { tmp_frame_locals = PyDict_New(); if ( par_sess ) { int res = PyDict_SetItem( tmp_frame_locals, const_str_plain_sess, par_sess ); assert( res == 0 ); } if ( par_cache ) { int res = PyDict_SetItem( tmp_frame_locals, const_str_plain_cache, par_cache ); assert( res == 0 ); } if ( par_cache_etags ) { int res = PyDict_SetItem( tmp_frame_locals, const_str_plain_cache_etags, par_cache_etags ); assert( res == 0 ); } if ( par_serializer ) { int res = PyDict_SetItem( tmp_frame_locals, const_str_plain_serializer, par_serializer ); assert( res == 0 ); } if ( par_heuristic ) { int res = PyDict_SetItem( tmp_frame_locals, const_str_plain_heuristic, par_heuristic ); assert( res == 0 ); } if ( var_adapter ) { int res = PyDict_SetItem( tmp_frame_locals, const_str_plain_adapter, var_adapter ); assert( res == 0 ); } detachFrame( exception_tb, tmp_frame_locals ); } } popFrameStack(); #if PYTHON_VERSION >= 340 frame_function->f_executing -= 1; #endif Py_DECREF( frame_function ); // Return the error. goto try_except_handler_1; frame_no_exception_1:; // tried codes exits in all cases NUITKA_CANNOT_GET_HERE( function_1_CacheControl_of_pip$_vendor$cachecontrol$wrapper ); return NULL; // Return handler code: try_return_handler_1:; Py_XDECREF( par_sess ); par_sess = NULL; Py_XDECREF( par_cache ); par_cache = NULL; Py_XDECREF( par_cache_etags ); par_cache_etags = NULL; Py_XDECREF( par_serializer ); par_serializer = NULL; Py_XDECREF( par_heuristic ); par_heuristic = NULL; Py_XDECREF( var_adapter ); var_adapter = NULL; goto function_return_exit; // Exception handler code: try_except_handler_1:; exception_keeper_type_1 = exception_type; exception_keeper_value_1 = exception_value; exception_keeper_tb_1 = exception_tb; exception_keeper_lineno_1 = exception_lineno; exception_type = NULL; exception_value = NULL; exception_tb = NULL; exception_lineno = -1; Py_XDECREF( par_sess ); par_sess = NULL; Py_XDECREF( par_cache ); par_cache = NULL; Py_XDECREF( par_cache_etags ); par_cache_etags = NULL; Py_XDECREF( par_serializer ); par_serializer = NULL; Py_XDECREF( par_heuristic ); par_heuristic = NULL; Py_XDECREF( var_adapter ); var_adapter = NULL; // Re-raise. exception_type = exception_keeper_type_1; exception_value = exception_keeper_value_1; exception_tb = exception_keeper_tb_1; exception_lineno = exception_keeper_lineno_1; goto function_exception_exit; // End of try: // Return statement must have exited already. NUITKA_CANNOT_GET_HERE( function_1_CacheControl_of_pip$_vendor$cachecontrol$wrapper ); return NULL; function_exception_exit: assert( exception_type ); RESTORE_ERROR_OCCURRED( exception_type, exception_value, exception_tb ); return NULL; function_return_exit: CHECK_OBJECT( tmp_return_value ); assert( had_error || !ERROR_OCCURRED() ); return tmp_return_value; }
MOD_INIT_DECL( django$utils$simplejson ) { #if defined(_NUITKA_EXE) || PYTHON_VERSION >= 300 static bool _init_done = false; // Packages can be imported recursively in deep executables. if ( _init_done ) { return MOD_RETURN_VALUE( module_django$utils$simplejson ); } else { _init_done = true; } #endif #ifdef _NUITKA_MODULE // In case of a stand alone extension module, need to call initialization // the init here because that's the first and only time we are going to get // called here. // Initialize the constant values used. _initBuiltinModule(); _initConstants(); // Initialize the compiled types of Nuitka. PyType_Ready( &Nuitka_Generator_Type ); PyType_Ready( &Nuitka_Function_Type ); PyType_Ready( &Nuitka_Method_Type ); PyType_Ready( &Nuitka_Frame_Type ); #if PYTHON_VERSION < 300 initSlotCompare(); #endif patchBuiltinModule(); patchTypeComparison(); #endif #if _MODULE_UNFREEZER registerMetaPathBasedUnfreezer( meta_path_loader_entries ); #endif _initModuleConstants(); _initModuleCodeObjects(); // puts( "in initdjango$utils$simplejson" ); // Create the module object first. There are no methods initially, all are // added dynamically in actual code only. Also no "__doc__" is initially // set at this time, as it could not contain NUL characters this way, they // are instead set in early module code. No "self" for modules, we have no // use for it. #if PYTHON_VERSION < 300 module_django$utils$simplejson = Py_InitModule4( "django.utils.simplejson", // Module Name NULL, // No methods initially, all are added // dynamically in actual module code only. NULL, // No __doc__ is initially set, as it could // not contain NUL this way, added early in // actual code. NULL, // No self for modules, we don't use it. PYTHON_API_VERSION ); #else module_django$utils$simplejson = PyModule_Create( &mdef_django$utils$simplejson ); #endif moduledict_django$utils$simplejson = (PyDictObject *)((PyModuleObject *)module_django$utils$simplejson)->md_dict; assertObject( module_django$utils$simplejson ); // Seems to work for Python2.7 out of the box, but for Python3, the module // doesn't automatically enter "sys.modules", so do it manually. #if PYTHON_VERSION >= 300 { int r = PyObject_SetItem( PySys_GetObject( (char *)"modules" ), const_str_digest_8e395302c5225c24e16f9edd8dd95062, module_django$utils$simplejson ); assert( r != -1 ); } #endif // For deep importing of a module we need to have "__builtins__", so we set // it ourselves in the same way than CPython does. Note: This must be done // before the frame object is allocated, or else it may fail. PyObject *module_dict = PyModule_GetDict( module_django$utils$simplejson ); if ( PyDict_GetItem( module_dict, const_str_plain___builtins__ ) == NULL ) { PyObject *value = (PyObject *)builtin_module; // Check if main module, not a dict then. #if !defined(_NUITKA_EXE) || !0 value = PyModule_GetDict( value ); #endif #ifndef __NUITKA_NO_ASSERT__ int res = #endif PyDict_SetItem( module_dict, const_str_plain___builtins__, value ); assert( res == 0 ); } #if PYTHON_VERSION >= 330 #if _MODULE_UNFREEZER PyDict_SetItem( module_dict, const_str_plain___loader__, metapath_based_loader ); #else PyDict_SetItem( module_dict, const_str_plain___loader__, Py_None ); #endif #endif // Temp variables if any PyObjectTempVariable tmp_or_1__value_1; PyObjectTempVariable tmp_try_except_1__unhandled_indicator; PyObject *exception_type, *exception_value; PyTracebackObject *exception_tb; PyObject *exception_keeper_type_1; PyObject *exception_keeper_value_1; PyTracebackObject *exception_keeper_tb_1; PyObject *exception_keeper_type_2; PyObject *exception_keeper_value_2; PyTracebackObject *exception_keeper_tb_2; PyObject *exception_keeper_type_3; PyObject *exception_keeper_value_3; PyTracebackObject *exception_keeper_tb_3; PyObject *exception_keeper_type_4; PyObject *exception_keeper_value_4; PyTracebackObject *exception_keeper_tb_4; PyObject *tmp_assign_source_1; PyObject *tmp_assign_source_2; PyObject *tmp_assign_source_3; PyObject *tmp_assign_source_4; PyObject *tmp_assign_source_5; PyObject *tmp_assign_source_6; PyObject *tmp_assign_source_7; PyObject *tmp_assign_source_8; PyObject *tmp_assign_source_9; PyObject *tmp_assign_source_10; PyObject *tmp_assign_source_11; PyObject *tmp_assign_source_12; PyObject *tmp_assign_source_13; PyObject *tmp_call_arg_element_1; PyObject *tmp_call_arg_element_2; PyObject *tmp_call_kw_1; PyObject *tmp_call_pos_1; PyObject *tmp_called_1; PyObject *tmp_called_2; PyObject *tmp_called_3; PyObject *tmp_compare_left_1; PyObject *tmp_compare_left_2; PyObject *tmp_compare_right_1; PyObject *tmp_compare_right_2; PyObject *tmp_compexpr_left_1; PyObject *tmp_compexpr_right_1; int tmp_cond_truth_1; int tmp_cond_truth_2; PyObject *tmp_cond_value_1; PyObject *tmp_cond_value_2; int tmp_exc_match_exception_match_1; PyObject *tmp_hasattr_attr_1; PyObject *tmp_hasattr_value_1; PyObject *tmp_import_globals_1; PyObject *tmp_import_globals_2; PyObject *tmp_import_globals_3; PyObject *tmp_import_globals_4; PyObject *tmp_import_globals_5; PyObject *tmp_import_globals_6; PyObject *tmp_import_globals_7; PyObject *tmp_import_globals_8; PyObject *tmp_import_name_from_1; PyObject *tmp_import_name_from_2; PyObject *tmp_import_name_from_3; PyObject *tmp_import_name_from_4; bool tmp_is_1; bool tmp_result; PyObject *tmp_source_name_1; PyObject *tmp_source_name_2; PyObject *tmp_source_name_3; PyObject *tmp_source_name_4; PyObject *tmp_star_imported_1; PyObject *tmp_star_imported_2; int tmp_tried_lineno_1; int tmp_tried_lineno_2; PyObject *tmp_tuple_element_1; NUITKA_MAY_BE_UNUSED PyObject *tmp_unused; // Module code. tmp_assign_source_1 = Py_None; UPDATE_STRING_DICT0( moduledict_django$utils$simplejson, (Nuitka_StringObject *)const_str_plain___doc__, tmp_assign_source_1 ); tmp_assign_source_2 = const_str_digest_b263340febec452f7ce0d23d319dd69a; UPDATE_STRING_DICT0( moduledict_django$utils$simplejson, (Nuitka_StringObject *)const_str_plain___file__, tmp_assign_source_2 ); // Frame without reuse. PyFrameObject *frame_module = MAKE_FRAME( codeobj_525b0a67f88de51bd5157e3eb4d3fcf3, module_django$utils$simplejson ); // Push the new frame as the currently active one, and we should be exlusively // owning it. pushFrameStack( frame_module ); assert( Py_REFCNT( frame_module ) == 1 ); #if PYTHON_VERSION >= 340 frame_module->f_executing += 1; #endif // Framed code: tmp_import_globals_1 = ((PyModuleObject *)module_django$utils$simplejson)->md_dict; frame_module->f_lineno = 8; tmp_import_name_from_1 = IMPORT_MODULE( const_str_plain___future__, tmp_import_globals_1, tmp_import_globals_1, const_tuple_str_plain_absolute_import_tuple, const_int_0 ); if ( tmp_import_name_from_1 == NULL ) { assert( ERROR_OCCURED() ); PyErr_Fetch( &exception_type, &exception_value, (PyObject **)&exception_tb ); frame_module->f_lineno = 8; goto frame_exception_exit_1; } tmp_assign_source_3 = IMPORT_NAME( tmp_import_name_from_1, const_str_plain_absolute_import ); Py_DECREF( tmp_import_name_from_1 ); if ( tmp_assign_source_3 == NULL ) { assert( ERROR_OCCURED() ); PyErr_Fetch( &exception_type, &exception_value, (PyObject **)&exception_tb ); frame_module->f_lineno = 8; goto frame_exception_exit_1; } UPDATE_STRING_DICT1( moduledict_django$utils$simplejson, (Nuitka_StringObject *)const_str_plain_absolute_import, tmp_assign_source_3 ); tmp_import_globals_2 = ((PyModuleObject *)module_django$utils$simplejson)->md_dict; frame_module->f_lineno = 10; tmp_assign_source_4 = IMPORT_MODULE( const_str_plain_warnings, tmp_import_globals_2, tmp_import_globals_2, Py_None, const_int_0 ); if ( tmp_assign_source_4 == NULL ) { assert( ERROR_OCCURED() ); PyErr_Fetch( &exception_type, &exception_value, (PyObject **)&exception_tb ); frame_module->f_lineno = 10; goto frame_exception_exit_1; } UPDATE_STRING_DICT1( moduledict_django$utils$simplejson, (Nuitka_StringObject *)const_str_plain_warnings, tmp_assign_source_4 ); tmp_source_name_1 = GET_STRING_DICT_VALUE( moduledict_django$utils$simplejson, (Nuitka_StringObject *)const_str_plain_warnings ); if (unlikely( tmp_source_name_1 == NULL )) { tmp_source_name_1 = GET_STRING_DICT_VALUE( dict_builtin, (Nuitka_StringObject *)const_str_plain_warnings ); } if ( tmp_source_name_1 == NULL ) { exception_type = INCREASE_REFCOUNT( PyExc_NameError ); exception_value = UNSTREAM_STRING( &constant_bin[ 6021 ], 30, 0 ); exception_tb = NULL; frame_module->f_lineno = 11; goto frame_exception_exit_1; } tmp_called_1 = LOOKUP_ATTRIBUTE( tmp_source_name_1, const_str_plain_warn ); if ( tmp_called_1 == NULL ) { assert( ERROR_OCCURED() ); PyErr_Fetch( &exception_type, &exception_value, (PyObject **)&exception_tb ); frame_module->f_lineno = 11; goto frame_exception_exit_1; } tmp_call_pos_1 = PyTuple_New( 2 ); tmp_tuple_element_1 = const_str_digest_7169b7e65e78489e48321bf243165725; Py_INCREF( tmp_tuple_element_1 ); PyTuple_SET_ITEM( tmp_call_pos_1, 0, tmp_tuple_element_1 ); tmp_tuple_element_1 = GET_STRING_DICT_VALUE( moduledict_django$utils$simplejson, (Nuitka_StringObject *)const_str_plain_DeprecationWarning ); if (unlikely( tmp_tuple_element_1 == NULL )) { tmp_tuple_element_1 = GET_STRING_DICT_VALUE( dict_builtin, (Nuitka_StringObject *)const_str_plain_DeprecationWarning ); } if ( tmp_tuple_element_1 == NULL ) { Py_DECREF( tmp_called_1 ); Py_DECREF( tmp_call_pos_1 ); exception_type = INCREASE_REFCOUNT( PyExc_NameError ); exception_value = UNSTREAM_STRING( &constant_bin[ 6058 ], 40, 0 ); exception_tb = NULL; frame_module->f_lineno = 12; goto frame_exception_exit_1; } Py_INCREF( tmp_tuple_element_1 ); PyTuple_SET_ITEM( tmp_call_pos_1, 1, tmp_tuple_element_1 ); tmp_call_kw_1 = PyDict_Copy( const_dict_f154c9a58c9419d7e391901d7b7fe49e ); frame_module->f_lineno = 12; tmp_unused = CALL_FUNCTION( tmp_called_1, tmp_call_pos_1, tmp_call_kw_1 ); Py_DECREF( tmp_called_1 ); Py_DECREF( tmp_call_pos_1 ); Py_DECREF( tmp_call_kw_1 ); if ( tmp_unused == NULL ) { assert( ERROR_OCCURED() ); PyErr_Fetch( &exception_type, &exception_value, (PyObject **)&exception_tb ); frame_module->f_lineno = 12; goto frame_exception_exit_1; } Py_DECREF( tmp_unused ); tmp_assign_source_5 = Py_True; assert( tmp_try_except_1__unhandled_indicator.object == NULL ); tmp_try_except_1__unhandled_indicator.object = INCREASE_REFCOUNT( tmp_assign_source_5 ); // Tried code // Tried block of try/except tmp_import_globals_3 = ((PyModuleObject *)module_django$utils$simplejson)->md_dict; frame_module->f_lineno = 15; tmp_assign_source_6 = IMPORT_MODULE( const_str_plain_simplejson, tmp_import_globals_3, tmp_import_globals_3, Py_None, const_int_0 ); if ( tmp_assign_source_6 == NULL ) { assert( ERROR_OCCURED() ); PyErr_Fetch( &exception_type, &exception_value, (PyObject **)&exception_tb ); frame_module->f_lineno = 15; goto try_except_handler_1; } UPDATE_STRING_DICT1( moduledict_django$utils$simplejson, (Nuitka_StringObject *)const_str_plain_simplejson, tmp_assign_source_6 ); goto try_except_end_1; try_except_handler_1:; // Exception handler of try/except tmp_assign_source_7 = Py_False; if (tmp_try_except_1__unhandled_indicator.object == NULL) { tmp_try_except_1__unhandled_indicator.object = INCREASE_REFCOUNT( tmp_assign_source_7 ); } else { PyObject *old = tmp_try_except_1__unhandled_indicator.object; tmp_try_except_1__unhandled_indicator.object = INCREASE_REFCOUNT( tmp_assign_source_7 ); Py_DECREF( old ); } // Preserve existing published exception. PRESERVE_FRAME_EXCEPTION( frame_module ); if (exception_tb == NULL) { exception_tb = MAKE_TRACEBACK( INCREASE_REFCOUNT( frame_module ) ); } else if ( exception_tb->tb_frame != frame_module || exception_tb->tb_lineno != frame_module->f_lineno ) { exception_tb = ADD_TRACEBACK( frame_module, exception_tb ); } NORMALIZE_EXCEPTION( &exception_type, &exception_value, &exception_tb ); PUBLISH_EXCEPTION( &exception_type, &exception_value, &exception_tb ); tmp_compare_left_1 = PyThreadState_GET()->exc_type; tmp_compare_right_1 = PyExc_ImportError; tmp_exc_match_exception_match_1 = EXCEPTION_MATCH_BOOL( tmp_compare_left_1, tmp_compare_right_1 ); if ( tmp_exc_match_exception_match_1 == -1 ) { assert( ERROR_OCCURED() ); PyErr_Fetch( &exception_type, &exception_value, (PyObject **)&exception_tb ); frame_module->f_lineno = 16; goto try_finally_handler_1; } if (tmp_exc_match_exception_match_1 == 1) { goto branch_yes_1; } else { goto branch_no_1; } branch_yes_1:; tmp_assign_source_8 = Py_False; UPDATE_STRING_DICT0( moduledict_django$utils$simplejson, (Nuitka_StringObject *)const_str_plain_use_simplejson, tmp_assign_source_8 ); goto branch_end_1; branch_no_1:; RERAISE_EXCEPTION( &exception_type, &exception_value, &exception_tb ); if (exception_tb && exception_tb->tb_frame == frame_module) frame_module->f_lineno = exception_tb->tb_lineno; goto try_finally_handler_1; branch_end_1:; try_except_end_1:; tmp_compare_left_2 = tmp_try_except_1__unhandled_indicator.object; tmp_compare_right_2 = Py_True; tmp_is_1 = ( tmp_compare_left_2 == tmp_compare_right_2 ); if (tmp_is_1) { goto branch_yes_2; } else { goto branch_no_2; } branch_yes_2:; tmp_import_globals_4 = ((PyModuleObject *)module_django$utils$simplejson)->md_dict; frame_module->f_lineno = 21; tmp_import_name_from_2 = IMPORT_MODULE( const_str_plain_json, tmp_import_globals_4, tmp_import_globals_4, const_tuple_str_plain___version___tuple, const_int_0 ); if ( tmp_import_name_from_2 == NULL ) { assert( ERROR_OCCURED() ); PyErr_Fetch( &exception_type, &exception_value, (PyObject **)&exception_tb ); frame_module->f_lineno = 21; goto try_finally_handler_1; } tmp_assign_source_9 = IMPORT_NAME( tmp_import_name_from_2, const_str_plain___version__ ); Py_DECREF( tmp_import_name_from_2 ); if ( tmp_assign_source_9 == NULL ) { assert( ERROR_OCCURED() ); PyErr_Fetch( &exception_type, &exception_value, (PyObject **)&exception_tb ); frame_module->f_lineno = 21; goto try_finally_handler_1; } UPDATE_STRING_DICT1( moduledict_django$utils$simplejson, (Nuitka_StringObject *)const_str_plain_stdlib_json_version, tmp_assign_source_9 ); // Tried code tmp_assign_source_10 = NULL; // Tried code tmp_hasattr_value_1 = GET_STRING_DICT_VALUE( moduledict_django$utils$simplejson, (Nuitka_StringObject *)const_str_plain_simplejson ); if (unlikely( tmp_hasattr_value_1 == NULL )) { tmp_hasattr_value_1 = GET_STRING_DICT_VALUE( dict_builtin, (Nuitka_StringObject *)const_str_plain_simplejson ); } if ( tmp_hasattr_value_1 == NULL ) { exception_type = INCREASE_REFCOUNT( PyExc_NameError ); exception_value = UNSTREAM_STRING( &constant_bin[ 15633 ], 32, 0 ); exception_tb = NULL; frame_module->f_lineno = 22; goto try_finally_handler_3; } tmp_hasattr_attr_1 = const_str_plain__speedups; tmp_assign_source_11 = BUILTIN_HASATTR( tmp_hasattr_value_1, tmp_hasattr_attr_1 ); if ( tmp_assign_source_11 == NULL ) { assert( ERROR_OCCURED() ); PyErr_Fetch( &exception_type, &exception_value, (PyObject **)&exception_tb ); frame_module->f_lineno = 22; goto try_finally_handler_3; } assert( tmp_or_1__value_1.object == NULL ); tmp_or_1__value_1.object = INCREASE_REFCOUNT( tmp_assign_source_11 ); tmp_cond_value_1 = tmp_or_1__value_1.object; tmp_cond_truth_1 = CHECK_IF_TRUE( tmp_cond_value_1 ); if ( tmp_cond_truth_1 == -1 ) { assert( ERROR_OCCURED() ); PyErr_Fetch( &exception_type, &exception_value, (PyObject **)&exception_tb ); frame_module->f_lineno = 22; goto try_finally_handler_3; } if (tmp_cond_truth_1 == 1) { goto condexpr_true_1; } else { goto condexpr_false_1; } condexpr_true_1:; tmp_assign_source_10 = tmp_or_1__value_1.object; Py_INCREF( tmp_assign_source_10 ); goto condexpr_end_1; condexpr_false_1:; tmp_assign_source_10 = NULL; // Tried code tmp_result = tmp_or_1__value_1.object != NULL; if ( tmp_result == true ) { Py_DECREF( tmp_or_1__value_1.object ); tmp_or_1__value_1.object = NULL; } assert( tmp_result != false ); tmp_source_name_3 = GET_STRING_DICT_VALUE( moduledict_django$utils$simplejson, (Nuitka_StringObject *)const_str_plain_simplejson ); if (unlikely( tmp_source_name_3 == NULL )) { tmp_source_name_3 = GET_STRING_DICT_VALUE( dict_builtin, (Nuitka_StringObject *)const_str_plain_simplejson ); } if ( tmp_source_name_3 == NULL ) { exception_type = INCREASE_REFCOUNT( PyExc_NameError ); exception_value = UNSTREAM_STRING( &constant_bin[ 15633 ], 32, 0 ); exception_tb = NULL; frame_module->f_lineno = 23; goto try_finally_handler_4; } tmp_source_name_2 = LOOKUP_ATTRIBUTE( tmp_source_name_3, const_str_plain___version__ ); if ( tmp_source_name_2 == NULL ) { assert( ERROR_OCCURED() ); PyErr_Fetch( &exception_type, &exception_value, (PyObject **)&exception_tb ); frame_module->f_lineno = 23; goto try_finally_handler_4; } tmp_called_2 = LOOKUP_ATTRIBUTE( tmp_source_name_2, const_str_plain_split ); Py_DECREF( tmp_source_name_2 ); if ( tmp_called_2 == NULL ) { assert( ERROR_OCCURED() ); PyErr_Fetch( &exception_type, &exception_value, (PyObject **)&exception_tb ); frame_module->f_lineno = 23; goto try_finally_handler_4; } tmp_call_arg_element_1 = const_str_dot; frame_module->f_lineno = 23; tmp_compexpr_left_1 = CALL_FUNCTION_WITH_ARGS1( tmp_called_2, tmp_call_arg_element_1 ); Py_DECREF( tmp_called_2 ); if ( tmp_compexpr_left_1 == NULL ) { assert( ERROR_OCCURED() ); PyErr_Fetch( &exception_type, &exception_value, (PyObject **)&exception_tb ); frame_module->f_lineno = 23; goto try_finally_handler_4; } tmp_source_name_4 = GET_STRING_DICT_VALUE( moduledict_django$utils$simplejson, (Nuitka_StringObject *)const_str_plain_stdlib_json_version ); if (unlikely( tmp_source_name_4 == NULL )) { tmp_source_name_4 = GET_STRING_DICT_VALUE( dict_builtin, (Nuitka_StringObject *)const_str_plain_stdlib_json_version ); } if ( tmp_source_name_4 == NULL ) { Py_DECREF( tmp_compexpr_left_1 ); exception_type = INCREASE_REFCOUNT( PyExc_NameError ); exception_value = UNSTREAM_STRING( &constant_bin[ 27036 ], 41, 0 ); exception_tb = NULL; frame_module->f_lineno = 23; goto try_finally_handler_4; } tmp_called_3 = LOOKUP_ATTRIBUTE( tmp_source_name_4, const_str_plain_split ); if ( tmp_called_3 == NULL ) { assert( ERROR_OCCURED() ); PyErr_Fetch( &exception_type, &exception_value, (PyObject **)&exception_tb ); Py_DECREF( tmp_compexpr_left_1 ); frame_module->f_lineno = 23; goto try_finally_handler_4; } tmp_call_arg_element_2 = const_str_dot; frame_module->f_lineno = 23; tmp_compexpr_right_1 = CALL_FUNCTION_WITH_ARGS1( tmp_called_3, tmp_call_arg_element_2 ); Py_DECREF( tmp_called_3 ); if ( tmp_compexpr_right_1 == NULL ) { assert( ERROR_OCCURED() ); PyErr_Fetch( &exception_type, &exception_value, (PyObject **)&exception_tb ); Py_DECREF( tmp_compexpr_left_1 ); frame_module->f_lineno = 23; goto try_finally_handler_4; } tmp_assign_source_10 = RICH_COMPARE_GE( tmp_compexpr_left_1, tmp_compexpr_right_1 ); Py_DECREF( tmp_compexpr_left_1 ); Py_DECREF( tmp_compexpr_right_1 ); if ( tmp_assign_source_10 == NULL ) { assert( ERROR_OCCURED() ); PyErr_Fetch( &exception_type, &exception_value, (PyObject **)&exception_tb ); frame_module->f_lineno = 23; goto try_finally_handler_4; } // Final block of try/finally // Tried block ends with no exception occured, note that. exception_type = NULL; exception_value = NULL; exception_tb = NULL; try_finally_handler_4:; exception_keeper_type_1 = exception_type; exception_keeper_value_1 = exception_value; exception_keeper_tb_1 = exception_tb; exception_type = NULL; exception_value = NULL; exception_tb = NULL; // Re-reraise as necessary after finally was executed. // Reraise exception if any. if ( exception_keeper_type_1 != NULL ) { exception_type = exception_keeper_type_1; exception_value = exception_keeper_value_1; exception_tb = exception_keeper_tb_1; goto try_finally_handler_3; } goto finally_end_1; finally_end_1:; condexpr_end_1:; // Final block of try/finally // Tried block ends with no exception occured, note that. exception_type = NULL; exception_value = NULL; exception_tb = NULL; try_finally_handler_3:; exception_keeper_type_2 = exception_type; exception_keeper_value_2 = exception_value; exception_keeper_tb_2 = exception_tb; exception_type = NULL; exception_value = NULL; exception_tb = NULL; // Re-reraise as necessary after finally was executed. // Reraise exception if any. if ( exception_keeper_type_2 != NULL ) { exception_type = exception_keeper_type_2; exception_value = exception_keeper_value_2; exception_tb = exception_keeper_tb_2; goto try_finally_handler_2; } goto finally_end_2; finally_end_2:; UPDATE_STRING_DICT1( moduledict_django$utils$simplejson, (Nuitka_StringObject *)const_str_plain_use_simplejson, tmp_assign_source_10 ); // Final block of try/finally // Tried block ends with no exception occured, note that. exception_type = NULL; exception_value = NULL; exception_tb = NULL; try_finally_handler_2:; exception_keeper_type_3 = exception_type; exception_keeper_value_3 = exception_value; exception_keeper_tb_3 = exception_tb; exception_type = NULL; exception_value = NULL; exception_tb = NULL; tmp_tried_lineno_1 = frame_module->f_lineno; Py_XDECREF( tmp_or_1__value_1.object ); tmp_or_1__value_1.object = NULL; frame_module->f_lineno = tmp_tried_lineno_1; // Re-reraise as necessary after finally was executed. // Reraise exception if any. if ( exception_keeper_type_3 != NULL ) { exception_type = exception_keeper_type_3; exception_value = exception_keeper_value_3; exception_tb = exception_keeper_tb_3; goto try_finally_handler_1; } goto finally_end_3; finally_end_3:; branch_no_2:; // Final block of try/finally // Tried block ends with no exception occured, note that. exception_type = NULL; exception_value = NULL; exception_tb = NULL; try_finally_handler_1:; exception_keeper_type_4 = exception_type; exception_keeper_value_4 = exception_value; exception_keeper_tb_4 = exception_tb; exception_type = NULL; exception_value = NULL; exception_tb = NULL; tmp_tried_lineno_2 = frame_module->f_lineno; tmp_result = tmp_try_except_1__unhandled_indicator.object != NULL; if ( tmp_result == true ) { Py_DECREF( tmp_try_except_1__unhandled_indicator.object ); tmp_try_except_1__unhandled_indicator.object = NULL; } assert( tmp_result != false ); frame_module->f_lineno = tmp_tried_lineno_2; // Re-reraise as necessary after finally was executed. // Reraise exception if any. if ( exception_keeper_type_4 != NULL ) { exception_type = exception_keeper_type_4; exception_value = exception_keeper_value_4; exception_tb = exception_keeper_tb_4; goto frame_exception_exit_1; } goto finally_end_4; finally_end_4:; tmp_cond_value_2 = GET_STRING_DICT_VALUE( moduledict_django$utils$simplejson, (Nuitka_StringObject *)const_str_plain_use_simplejson ); if (unlikely( tmp_cond_value_2 == NULL )) { tmp_cond_value_2 = GET_STRING_DICT_VALUE( dict_builtin, (Nuitka_StringObject *)const_str_plain_use_simplejson ); } if ( tmp_cond_value_2 == NULL ) { exception_type = INCREASE_REFCOUNT( PyExc_NameError ); exception_value = UNSTREAM_STRING( &constant_bin[ 27077 ], 36, 0 ); exception_tb = NULL; frame_module->f_lineno = 26; goto frame_exception_exit_1; } tmp_cond_truth_2 = CHECK_IF_TRUE( tmp_cond_value_2 ); if ( tmp_cond_truth_2 == -1 ) { assert( ERROR_OCCURED() ); PyErr_Fetch( &exception_type, &exception_value, (PyObject **)&exception_tb ); frame_module->f_lineno = 26; goto frame_exception_exit_1; } if (tmp_cond_truth_2 == 1) { goto branch_yes_3; } else { goto branch_no_3; } branch_yes_3:; tmp_import_globals_5 = ((PyModuleObject *)module_django$utils$simplejson)->md_dict; frame_module->f_lineno = 27; tmp_star_imported_1 = IMPORT_MODULE( const_str_plain_simplejson, tmp_import_globals_5, tmp_import_globals_5, const_tuple_str_chr_42_tuple, const_int_0 ); if ( tmp_star_imported_1 == NULL ) { assert( ERROR_OCCURED() ); PyErr_Fetch( &exception_type, &exception_value, (PyObject **)&exception_tb ); frame_module->f_lineno = 27; goto frame_exception_exit_1; } tmp_result = IMPORT_MODULE_STAR( module_django$utils$simplejson, true, tmp_star_imported_1 ); if ( tmp_result == false ) { assert( ERROR_OCCURED() ); PyErr_Fetch( &exception_type, &exception_value, (PyObject **)&exception_tb ); Py_DECREF( tmp_star_imported_1 ); frame_module->f_lineno = 27; goto frame_exception_exit_1; } Py_DECREF( tmp_star_imported_1 ); tmp_import_globals_6 = ((PyModuleObject *)module_django$utils$simplejson)->md_dict; frame_module->f_lineno = 28; tmp_import_name_from_3 = IMPORT_MODULE( const_str_plain_simplejson, tmp_import_globals_6, tmp_import_globals_6, const_tuple_str_plain___version___tuple, const_int_0 ); if ( tmp_import_name_from_3 == NULL ) { assert( ERROR_OCCURED() ); PyErr_Fetch( &exception_type, &exception_value, (PyObject **)&exception_tb ); frame_module->f_lineno = 28; goto frame_exception_exit_1; } tmp_assign_source_12 = IMPORT_NAME( tmp_import_name_from_3, const_str_plain___version__ ); Py_DECREF( tmp_import_name_from_3 ); if ( tmp_assign_source_12 == NULL ) { assert( ERROR_OCCURED() ); PyErr_Fetch( &exception_type, &exception_value, (PyObject **)&exception_tb ); frame_module->f_lineno = 28; goto frame_exception_exit_1; } UPDATE_STRING_DICT1( moduledict_django$utils$simplejson, (Nuitka_StringObject *)const_str_plain___version__, tmp_assign_source_12 ); goto branch_end_3; branch_no_3:; tmp_import_globals_7 = ((PyModuleObject *)module_django$utils$simplejson)->md_dict; frame_module->f_lineno = 30; tmp_star_imported_2 = IMPORT_MODULE( const_str_plain_json, tmp_import_globals_7, tmp_import_globals_7, const_tuple_str_chr_42_tuple, const_int_0 ); if ( tmp_star_imported_2 == NULL ) { assert( ERROR_OCCURED() ); PyErr_Fetch( &exception_type, &exception_value, (PyObject **)&exception_tb ); frame_module->f_lineno = 30; goto frame_exception_exit_1; } tmp_result = IMPORT_MODULE_STAR( module_django$utils$simplejson, true, tmp_star_imported_2 ); if ( tmp_result == false ) { assert( ERROR_OCCURED() ); PyErr_Fetch( &exception_type, &exception_value, (PyObject **)&exception_tb ); Py_DECREF( tmp_star_imported_2 ); frame_module->f_lineno = 30; goto frame_exception_exit_1; } Py_DECREF( tmp_star_imported_2 ); tmp_import_globals_8 = ((PyModuleObject *)module_django$utils$simplejson)->md_dict; frame_module->f_lineno = 31; tmp_import_name_from_4 = IMPORT_MODULE( const_str_plain_json, tmp_import_globals_8, tmp_import_globals_8, const_tuple_str_plain___version___tuple, const_int_0 ); if ( tmp_import_name_from_4 == NULL ) { assert( ERROR_OCCURED() ); PyErr_Fetch( &exception_type, &exception_value, (PyObject **)&exception_tb ); frame_module->f_lineno = 31; goto frame_exception_exit_1; } tmp_assign_source_13 = IMPORT_NAME( tmp_import_name_from_4, const_str_plain___version__ ); Py_DECREF( tmp_import_name_from_4 ); if ( tmp_assign_source_13 == NULL ) { assert( ERROR_OCCURED() ); PyErr_Fetch( &exception_type, &exception_value, (PyObject **)&exception_tb ); frame_module->f_lineno = 31; goto frame_exception_exit_1; } UPDATE_STRING_DICT1( moduledict_django$utils$simplejson, (Nuitka_StringObject *)const_str_plain___version__, tmp_assign_source_13 ); branch_end_3:; // Restore frame exception if necessary. #if 1 RESTORE_FRAME_EXCEPTION( frame_module ); #endif popFrameStack(); assertFrameObject( frame_module ); Py_DECREF( frame_module ); goto frame_no_exception_1; frame_exception_exit_1:; #if 1 RESTORE_FRAME_EXCEPTION( frame_module ); #endif if ( exception_tb == NULL ) { exception_tb = MAKE_TRACEBACK( INCREASE_REFCOUNT( frame_module ) ); } else if ( exception_tb->tb_frame != frame_module ) { PyTracebackObject *traceback_new = (PyTracebackObject *)MAKE_TRACEBACK( INCREASE_REFCOUNT( frame_module ) ); traceback_new->tb_next = exception_tb; exception_tb = traceback_new; } // Put the previous frame back on top. popFrameStack(); #if PYTHON_VERSION >= 340 frame_module->f_executing -= 1; #endif Py_DECREF( frame_module ); // Return the error. goto module_exception_exit; frame_no_exception_1:; return MOD_RETURN_VALUE( module_django$utils$simplejson ); module_exception_exit: PyErr_Restore( exception_type, exception_value, (PyObject *)exception_tb ); return MOD_RETURN_VALUE( NULL ); }
PyObject * PyModule_Create2(struct PyModuleDef* module, int module_api_version) { PyObject *d, *v, *n; PyMethodDef *ml; const char* name; PyModuleObject *m; PyInterpreterState *interp = PyThreadState_Get()->interp; if (interp->modules == NULL) Py_FatalError("Python import machinery not initialized"); if (PyType_Ready(&moduledef_type) < 0) return NULL; if (module->m_base.m_index == 0) { max_module_number++; Py_REFCNT(module) = 1; Py_TYPE(module) = &moduledef_type; module->m_base.m_index = max_module_number; } name = module->m_name; if (module_api_version != PYTHON_API_VERSION && module_api_version != PYTHON_ABI_VERSION) { int err; err = PyErr_WarnFormat(PyExc_RuntimeWarning, 1, "Python C API version mismatch for module %.100s: " "This Python has API version %d, module %.100s has version %d.", name, PYTHON_API_VERSION, name, module_api_version); if (err) return NULL; } /* Make sure name is fully qualified. This is a bit of a hack: when the shared library is loaded, the module name is "package.module", but the module calls PyModule_Create*() with just "module" for the name. The shared library loader squirrels away the true name of the module in _Py_PackageContext, and PyModule_Create*() will substitute this (if the name actually matches). */ if (_Py_PackageContext != NULL) { char *p = strrchr(_Py_PackageContext, '.'); if (p != NULL && strcmp(module->m_name, p+1) == 0) { name = _Py_PackageContext; _Py_PackageContext = NULL; } } if ((m = (PyModuleObject*)PyModule_New(name)) == NULL) return NULL; if (module->m_size > 0) { m->md_state = PyMem_MALLOC(module->m_size); if (!m->md_state) { PyErr_NoMemory(); Py_DECREF(m); return NULL; } memset(m->md_state, 0, module->m_size); } d = PyModule_GetDict((PyObject*)m); if (module->m_methods != NULL) { n = PyUnicode_FromString(name); if (n == NULL) { Py_DECREF(m); return NULL; } for (ml = module->m_methods; ml->ml_name != NULL; ml++) { if ((ml->ml_flags & METH_CLASS) || (ml->ml_flags & METH_STATIC)) { PyErr_SetString(PyExc_ValueError, "module functions cannot set" " METH_CLASS or METH_STATIC"); Py_DECREF(n); Py_DECREF(m); return NULL; } v = PyCFunction_NewEx(ml, (PyObject*)m, n); if (v == NULL) { Py_DECREF(n); Py_DECREF(m); return NULL; } if (PyDict_SetItemString(d, ml->ml_name, v) != 0) { Py_DECREF(v); Py_DECREF(n); Py_DECREF(m); return NULL; } Py_DECREF(v); } Py_DECREF(n); } if (module->m_doc != NULL) { _Py_IDENTIFIER(__doc__); v = PyUnicode_FromString(module->m_doc); if (v == NULL || _PyDict_SetItemId(d, &PyId___doc__, v) != 0) { Py_XDECREF(v); Py_DECREF(m); return NULL; } Py_DECREF(v); } m->md_def = module; return (PyObject*)m; }