static int _p_object_newindex_set(lua_State *L, py_object *pobj, int keyn, int valuen) { lua_Object lkey = lua_getparam(L, keyn); PyObject *key = lua_stack_convert(L, keyn, lkey); if (!key) luaL_argerror(L, 1, "failed to convert key"); lua_Object lval = lua_getparam(L, valuen); if (!lua_isnil(L, lval)) { PyObject *value = lua_stack_convert(L, valuen, lval); if (!value) { if (!is_object_container(L, lkey)) Py_DECREF(key); luaL_argerror(L, 1, "failed to convert value"); } // setitem (obj[0] = 1) if int else setattr(obj.val = 1) if (pobj->asindx) { if (PyObject_SetItem(pobj->object, key, value) == -1) { if (!is_object_container(L, lkey)) Py_DECREF(key); if (!is_object_container(L, lval)) Py_DECREF(value); lua_new_error(L, "failed to set item"); } } else if (PyObject_SetAttr(pobj->object, key, value) == -1) { if (!is_object_container(L, lkey)) Py_DECREF(key); if (!is_object_container(L, lval)) Py_DECREF(value); lua_new_error(L, "failed to set attribute"); } if (!is_object_container(L, lval)) Py_DECREF(value); } else { if (PyObject_DelItem(pobj->object, key) == -1) { if (!is_object_container(L, lkey)) Py_DECREF(key); lua_new_error(L, "failed to delete item"); } } if (!is_object_container(L, lkey)) Py_DECREF(key); return 0; }
static int map_to_dict(PyObject *map, Py_ssize_t nmap, PyObject *dict, PyObject **values, int deref) { Py_ssize_t j; assert(PyTuple_Check(map)); assert(PyDict_Check(dict)); assert(PyTuple_Size(map) >= nmap); for (j = nmap; --j >= 0; ) { PyObject *key = PyTuple_GET_ITEM(map, j); PyObject *value = values[j]; assert(PyUnicode_Check(key)); if (deref) { assert(PyCell_Check(value)); value = PyCell_GET(value); } if (value == NULL) { if (PyObject_DelItem(dict, key) != 0) { if (PyErr_ExceptionMatches(PyExc_KeyError)) PyErr_Clear(); else return -1; } } else { if (PyObject_SetItem(dict, key, value) != 0) return -1; } } return 0; }
static foreign_t python_assign_item(term_t parent, term_t indx, term_t tobj) { PyObject *pF, *pI; PyObject *p; // get Scope ... pI = term_to_python(indx, true); // got Scope.Exp // get Scope ... p = term_to_python(parent, true); // Exp // get Scope ... pF = term_to_python(parent, true); // Exp if (!pI || !p) { { return false; } } else if (PyObject_SetItem(p, pI, pF)) { PyErr_Print(); { return false; } } Py_DecRef(pI); Py_DecRef(p); { return true; } }
static int _p_object_newindex_set(lua_State *L, py_object *obj, int keyn, int valuen) { PyObject *value; PyObject *key = LuaConvert(L, keyn); if (!key) luaL_argerror(L, 1, "failed to convert key"); lua_Object lobj = lua_getparam(L, valuen); if (!lua_isnil(L, lobj)) { value = LuaConvert(L, valuen); if (!value) { Py_DECREF(key); luaL_argerror(L, 1, "failed to convert value"); } // setitem (obj[0] = 1) if int else setattr(obj.val = 1) if (obj->asindx) { if (PyObject_SetItem(obj->o, key, value) == -1) { PyErr_Print(); lua_error(L, "failed to set item"); } } else if (PyObject_SetAttr(obj->o, key, value) == -1) { PyErr_Print(); lua_error(L, "failed to set item"); } Py_DECREF(value); } else { if (PyObject_DelItem(obj->o, key) == -1) { PyErr_Print(); lua_error(L, "failed to delete item"); } } Py_DECREF(key); return 0; }
static void map_to_dict(PyObject *map, Py_ssize_t nmap, PyObject *dict, PyObject **values, int deref) { Py_ssize_t j; assert(PyTuple_Check(map)); assert(PyDict_Check(dict)); assert(PyTuple_Size(map) >= nmap); for (j = nmap; --j >= 0; ) { PyObject *key = PyTuple_GET_ITEM(map, j); PyObject *value = values[j]; assert(PyString_Check(key)); if (deref) { assert(PyCell_Check(value)); value = PyCell_GET(value); } if (value == NULL) { if (PyObject_DelItem(dict, key) != 0) PyErr_Clear(); } else { if (PyObject_SetItem(dict, key, value) != 0) PyErr_Clear(); } } }
int set_all(PyObject *target, PyObject *item) { int i, n; n = PyObject_Length(target); if(n < 0) { return -1; } for(i=0; i<n; ++i) { PyObject *index = PyInt_FromLong(i); if(index == NULL) { return -1; } if(PyObject_SetItem(target, index, item) < 0) { Py_DECREF(index); return -1; } Py_DECREF(index); } return 0; }
static int PLy_result_ass_subscript(PyObject *arg, PyObject *item, PyObject *value) { PLyResultObject *ob = (PLyResultObject *) arg; return PyObject_SetItem(ob->rows, item, value); }
static int _p_object_newindex_set(lua_State *L, py_object *obj, int keyn, int valuen) { PyObject *value; PyObject *key = LuaConvert(L, keyn); if (!key) { return luaL_argerror(L, 1, "failed to convert key"); } if (!lua_isnil(L, valuen)) { value = LuaConvert(L, valuen); if (!value) { Py_DECREF(key); return luaL_argerror(L, 1, "failed to convert value"); } if (PyObject_SetItem(obj->o, key, value) == -1) { PyErr_Print(); luaL_error(L, "failed to set item"); } Py_DECREF(value); } else { if (PyObject_DelItem(obj->o, key) == -1) { PyErr_Print(); luaL_error(L, "failed to delete item"); } } Py_DECREF(key); return 0; }
static int wrap_setitem(PyObject *self, PyObject *key, PyObject *value) { if (value == NULL) return PyObject_DelItem(Proxy_GET_OBJECT(self), key); else return PyObject_SetItem(Proxy_GET_OBJECT(self), key, value); }
static void _setMsg(PyObject *messages, UErrorCode code, const char *msg) { PyObject *pycode = PyInt_FromLong((long) code); PyObject *pymsg = PyString_FromString(msg); PyObject_SetItem(messages, pycode, pymsg); Py_DECREF(pycode); Py_DECREF(pymsg); }
static int Proxy_setitem(ProxyObject *self, PyObject *key, PyObject* value) { Proxy__ENSURE_WRAPPED_OR_RETURN_MINUS1(self); if (value == NULL) return PyObject_DelItem(self->wrapped, key); else return PyObject_SetItem(self->wrapped, key, value); }
static PyObject * pickle___setstate__(PyObject *self, PyObject *state) { PyObject *slots=NULL; if (PyTuple_Check(state)) { if (!PyArg_ParseTuple(state, "OO:__setstate__", &state, &slots)) return NULL; } if (state != Py_None) { PyObject **dict; PyObject *d_key, *d_value; Py_ssize_t i; dict = _PyObject_GetDictPtr(self); if (!dict) { PyErr_SetString(PyExc_TypeError, "this object has no instance dictionary"); return NULL; } if (!*dict) { *dict = PyDict_New(); if (!*dict) return NULL; } PyDict_Clear(*dict); i = 0; while (PyDict_Next(state, &i, &d_key, &d_value)) { /* normally the keys for instance attributes are interned. we should try to do that here. */ if (NATIVE_CHECK_EXACT(d_key)) { Py_INCREF(d_key); INTERN_INPLACE(&d_key); Py_DECREF(d_key); } if (PyObject_SetItem(*dict, d_key, d_value) < 0) return NULL; } } if (slots && pickle_setattrs_from_dict(self, slots) < 0) return NULL; Py_INCREF(Py_None); return Py_None; }
static int proxy_setitem(PyWeakReference *proxy, PyObject *key, PyObject *value) { if (!proxy_checkref(proxy)) return -1; if (value == NULL) return PyObject_DelItem(PyWeakref_GET_OBJECT(proxy), key); else return PyObject_SetItem(PyWeakref_GET_OBJECT(proxy), key, value); }
static int thunk_setitem(PyObject *self, PyObject *key, PyObject *value) { PyObject *val; if (!(val = _strict_eval_borrowed(self))) { return -1; } PyObject_SetItem(val, key, value); return 0; }
static int __Pyx_SetItemInt(PyObject *o, Py_ssize_t i, PyObject *v) { PyTypeObject *t = o->ob_type; int r; if (t->tp_as_sequence && t->tp_as_sequence->sq_item) r = PySequence_SetItem(o, i, v); else { PyObject *j = PyInt_FromLong(i); if (!j) return -1; r = PyObject_SetItem(o, j, v); Py_DECREF(j); } return r; }
int PyMapping_SetItemString( PyObject *o, char *key, PyObject *value) { PyObject *okey; int r; if( ! key) return Py_ReturnNullError(),-1; if (!(okey=PyString_FromString(key))) return -1; r = PyObject_SetItem(o,okey,value); if (--( okey )->ob_refcnt != 0) ; else (*( okey )->ob_type->tp_dealloc)((PyObject *)( okey )) ; return r; }
/* {{{ pip_zobject_to_pyobject(zval **obj) Convert a PHP (Zend) object to a Python object */ PyObject * pip_zobject_to_pyobject(zval **obj) { PyObject *dict, *item, *str; zval **entry; char *string_key; long num_key; /* * At this point, we represent a PHP object as a dictionary of * its properties. In the future, we may provide a true object * conversion (which is entirely possible, but it's more work * that I plan on doing right now). */ dict = PyDict_New(); /* Start at the beginning of the object properties hash */ zend_hash_internal_pointer_reset(Z_OBJPROP_PP(obj)); /* Iterate over the hash's elements */ while (zend_hash_get_current_data(Z_OBJPROP_PP(obj), (void **)&entry) == SUCCESS) { /* Convert the PHP value to its Python equivalent (recursion) */ item = pip_zval_to_pyobject(entry); switch (zend_hash_get_current_key(Z_OBJPROP_PP(obj), &string_key, &num_key, 0)) { case HASH_KEY_IS_STRING: PyDict_SetItemString(dict, string_key, item); break; case HASH_KEY_IS_LONG: str = PyString_FromFormat("%d", num_key); PyObject_SetItem(dict, str, item); Py_DECREF(str); break; case HASH_KEY_NON_EXISTANT: php_error(E_ERROR, "No array key"); break; } /* Advance to the next entry */ zend_hash_move_forward(Z_OBJPROP_PP(obj)); } return dict; }
static PyObject* Capsule_instantiate(CapsuleObject* self, PyObject* args) { PyObject* addr2refct = GetAddrRefCt(); auto_pyobject ptr = GetPointer(self->capsule); auto_pyobject refct = PyObject_GetItem(addr2refct, *ptr); auto_pyobject inc = PyNumber_InPlaceAdd(*refct, ConstantOne); PyObject *obj = PyObject_CallFunctionObjArgs(Capsule_GetClass(self), self, NULL); if (obj == NULL) return NULL; if (PyObject_SetItem(addr2refct, *ptr, *inc)) { Py_DECREF(obj); return NULL; } return obj; }
int PyMapping_SetItemString(PyObject *o, char *key, PyObject *value) { PyObject *okey; int r; if (key == NULL) { null_error(); return -1; } okey = PyString_FromString(key); if (okey == NULL) return -1; r = PyObject_SetItem(o, okey, value); Py_DECREF(okey); return r; }
PyObject *updateLocalsDict( PyObject *locals_dict ) const { if ( this->isInitialized() ) { #if PYTHON_VERSION < 300 int status = PyDict_SetItem( #else int status = PyObject_SetItem( #endif locals_dict, this->getVariableName(), this->asObject0() ); if (unlikely( status == -1 )) { throw PythonException(); } }
static void map_to_dict(PyObject *map, Py_ssize_t nmap, PyObject *dict, PyObject **values, Py_ssize_t deref) { Py_ssize_t j; for (j = nmap; --j >= 0; ) { PyObject *key = PyTuple_GET_ITEM(map, j); PyObject *value = values[j]; if (deref) value = PyCell_GET(value); if (value == NULL) { if (PyObject_DelItem(dict, key) != 0) PyErr_Clear(); } else { if (PyObject_SetItem(dict, key, value) != 0) PyErr_Clear(); } } }
static PyObject* WrapCore(PyObject *oldCap, bool owned) { auto_pyobject cap = PyObject_CallFunctionObjArgs(GetCapsuleClass(), oldCap, NULL); auto_pyobject cls = PyObject_CallMethod(*cap, "get_class", ""); auto_pyobject addr = GetPointer(oldCap); // look up cached object auto_pyobject cache_cls = PyObject_GetItem(GetCache(), *cls); Assert(*cache_cls); PyObject* obj = NULL; obj = PyObject_GetItem(*cache_cls, *addr); if (obj) { /* cache hit */ } else { if (!PyErr_ExceptionMatches(PyExc_KeyError)) return NULL; /* cache miss */ PyErr_Clear(); if (!owned) { auto_pyobject hasDtor = PyObject_CallMethod(*cls, "_has_dtor", ""); if (PyObject_IsTrue(*hasDtor)) { auto_pyobject name = GetName(oldCap); auto_pyobject key = PyTuple_Pack(2, *name, *addr); auto_pyobject val = PyObject_GetAttrString(*cls, "_delete_"); int ok = PyDict_SetItem(GetAddrDtorDict(), *key, *val); Assert(ok != -1); } } obj = PyObject_CallMethod(*cap, "instantiate", ""); int ok = PyObject_SetItem(*cache_cls, *addr, obj); Assert(ok != -1); } Assert(obj); return obj; }
static PyObject * pickle_copy_dict(PyObject *state) { PyObject *copy, *key, *value; char *ckey; Py_ssize_t pos = 0; Py_ssize_t nr; copy = PyDict_New(); if (copy == NULL) return NULL; if (state == NULL) return copy; while ((nr = PyDict_Next(state, &pos, &key, &value))) { if (nr < 0) goto err; if (key && PyString_Check(key)) { ckey = PyString_AS_STRING(key); if (*ckey == '_' && (ckey[1] == 'v' || ckey[1] == 'p') && ckey[2] == '_') /* skip volatile and persistent */ continue; } if (key != NULL && value != NULL && (PyObject_SetItem(copy, key, value) < 0) ) goto err; } return copy; err: Py_DECREF(copy); return NULL; }
JSBool set_prop(JSContext* jscx, JSObject* jsobj, jsval key, jsval* rval) { Context* pycx = NULL; PyObject* pykey = NULL; PyObject* pyval = NULL; JSBool ret = JS_FALSE; pycx = (Context*) JS_GetContextPrivate(jscx); if(pycx == NULL) { JS_ReportError(jscx, "Failed to get Python context."); goto done; } // Bail if there's no registered global handler. if(pycx->global == NULL) { ret = JS_TRUE; goto done; } pykey = js2py(pycx, key); if(pykey == NULL) goto done; if(Context_has_access(pycx, jscx, pycx->global, pykey) <= 0) goto done; pyval = js2py(pycx, *rval); if(pyval == NULL) goto done; if(PyObject_SetItem(pycx->global, pykey, pyval) < 0) goto done; ret = JS_TRUE; done: Py_XDECREF(pykey); Py_XDECREF(pyval); return ret; }
// TODO: Have mapping.hpp NUITKA_MAY_BE_UNUSED static bool MAPPING_SYNC_FROM_VARIABLE( PyObject *mapping, PyObject *key, PyObject *value ) { if ( value ) { int res = PyObject_SetItem( mapping, key, value ); return res == 0; } else { PyObject *test_value = PyObject_GetItem( mapping, key ); if ( test_value ) { Py_DECREF( test_value ); int res = PyObject_DelItem( mapping, key ); return res == 0; } else { PyErr_Clear(); return true; } } }
/** * Set a value for an entity attribute. If py_value == NULL then clear the attribute. * If the attribute exists and is a list, append this value to the list. * * NOTE: This function will Py_XDECREF(py_value). */ qd_error_t qd_entity_set_py(qd_entity_t* entity, const char* attribute, PyObject* py_value) { qd_error_clear(); int result = 0; PyObject *py_key = PyString_FromString(attribute); if (py_key) { if (py_value == NULL) { /* Delete the attribute */ result = PyObject_DelItem((PyObject*)entity, py_key); PyErr_Clear(); /* Ignore error if it isn't there. */ } else { PyObject *old = PyObject_GetItem((PyObject*)entity, py_key); PyErr_Clear(); /* Ignore error if it isn't there. */ if (old && PyList_Check(old)) /* Add to list */ result = PyList_Append(old, py_value); else /* Set attribute */ result = PyObject_SetItem((PyObject*)entity, py_key, py_value); Py_XDECREF(old); } } Py_XDECREF(py_key); Py_XDECREF(py_value); return (py_key == NULL || result < 0) ? qd_error_py() : QD_ERROR_NONE; }
MOD_INIT_DECL( Crypto$Util ) { #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$Util ); } 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$Util" ); // 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$Util = Py_InitModule4( "Crypto.Util", // 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$Util = PyModule_Create( &mdef_Crypto$Util ); #endif moduledict_Crypto$Util = (PyDictObject *)((PyModuleObject *)module_Crypto$Util)->md_dict; assertObject( module_Crypto$Util ); // 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_84c8a7acde99de10deb810738421e657, module_Crypto$Util ); 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$Util ); 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 *tmp_assign_source_1; PyObject *tmp_assign_source_2; PyObject *tmp_assign_source_3; PyObject *tmp_assign_source_4; PyObject *tmp_assign_source_5; // Module code. tmp_assign_source_1 = const_str_digest_2d19cbaeda533a9f2ae817323976daff; UPDATE_STRING_DICT0( moduledict_Crypto$Util, (Nuitka_StringObject *)const_str_plain___doc__, tmp_assign_source_1 ); tmp_assign_source_2 = const_str_digest_ede8c8f1dce1a60961ad7994cb95ec71; UPDATE_STRING_DICT0( moduledict_Crypto$Util, (Nuitka_StringObject *)const_str_plain___file__, tmp_assign_source_2 ); tmp_assign_source_3 = LIST_COPY( const_list_str_digest_8cacdff8c7fede7c8e3e11000eea2cbe_list ); UPDATE_STRING_DICT1( moduledict_Crypto$Util, (Nuitka_StringObject *)const_str_plain___path__, tmp_assign_source_3 ); tmp_assign_source_4 = LIST_COPY( const_list_c9502e80b601e4836ea5b2f226787166_list ); UPDATE_STRING_DICT1( moduledict_Crypto$Util, (Nuitka_StringObject *)const_str_plain___all__, tmp_assign_source_4 ); tmp_assign_source_5 = const_str_digest_e716a6839c8454d1d77f5308c1bdd157; UPDATE_STRING_DICT0( moduledict_Crypto$Util, (Nuitka_StringObject *)const_str_plain___revision__, tmp_assign_source_5 ); return MOD_RETURN_VALUE( module_Crypto$Util ); }
static PyObject * pickle_copy_dict(PyObject *state) { PyObject *copy, *key, *value; char *ckey; Py_ssize_t pos = 0; copy = PyDict_New(); if (!copy) return NULL; if (!state) return copy; while (PyDict_Next(state, &pos, &key, &value)) { int is_special; #ifdef PY3K if (key && PyUnicode_Check(key)) { PyObject *converted = convert_name(key); ckey = PyBytes_AS_STRING(converted); #else if (key && PyBytes_Check(key)) { ckey = PyBytes_AS_STRING(key); #endif is_special = (*ckey == '_' && (ckey[1] == 'v' || ckey[1] == 'p') && ckey[2] == '_'); #ifdef PY3K Py_DECREF(converted); #endif if (is_special) /* skip volatile and persistent */ continue; } if (PyObject_SetItem(copy, key, value) < 0) goto err; } return copy; err: Py_DECREF(copy); return NULL; } static char pickle___getstate__doc[] = "Get the object serialization state\n" "\n" "If the object has no assigned slots and has no instance dictionary, then \n" "None is returned.\n" "\n" "If the object has no assigned slots and has an instance dictionary, then \n" "the a copy of the instance dictionary is returned. The copy has any items \n" "with names starting with '_v_' or '_p_' ommitted.\n" "\n" "If the object has assigned slots, then a two-element tuple is returned. \n" "The first element is either None or a copy of the instance dictionary, \n" "as described above. The second element is a dictionary with items \n" "for each of the assigned slots.\n" ; static PyObject * pickle___getstate__(PyObject *self) { PyObject *slotnames=NULL, *slots=NULL, *state=NULL; PyObject **dictp; int n=0; slotnames = pickle_slotnames(Py_TYPE(self)); if (!slotnames) return NULL; dictp = _PyObject_GetDictPtr(self); if (dictp) state = pickle_copy_dict(*dictp); else { state = Py_None; Py_INCREF(state); } if (slotnames != Py_None) { int i; slots = PyDict_New(); if (!slots) goto end; for (i = 0; i < PyList_GET_SIZE(slotnames); i++) { PyObject *name, *value; char *cname; int is_special; name = PyList_GET_ITEM(slotnames, i); #ifdef PY3K if (PyUnicode_Check(name)) { PyObject *converted = convert_name(name); cname = PyBytes_AS_STRING(converted); #else if (PyBytes_Check(name)) { cname = PyBytes_AS_STRING(name); #endif is_special = (*cname == '_' && (cname[1] == 'v' || cname[1] == 'p') && cname[2] == '_'); #ifdef PY3K Py_DECREF(converted); #endif if (is_special) /* skip volatile and persistent */ { continue; } } /* Unclear: Will this go through our getattr hook? */ value = PyObject_GetAttr(self, name); if (value == NULL) PyErr_Clear(); else { int err = PyDict_SetItem(slots, name, value); Py_DECREF(value); if (err < 0) goto end; n++; } } } if (n) state = Py_BuildValue("(NO)", state, slots); end: Py_XDECREF(slotnames); Py_XDECREF(slots); return state; } static int pickle_setattrs_from_dict(PyObject *self, PyObject *dict) { PyObject *key, *value; Py_ssize_t pos = 0; if (!PyDict_Check(dict)) { PyErr_SetString(PyExc_TypeError, "Expected dictionary"); return -1; } while (PyDict_Next(dict, &pos, &key, &value)) { if (PyObject_SetAttr(self, key, value) < 0) return -1; } return 0; }
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 ); }
MOD_INIT_DECL( pip$_vendor$requests$packages$urllib3$packages ) { #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$packages$urllib3$packages ); } 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$packages$urllib3$packages" ); // 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$packages$urllib3$packages = Py_InitModule4( "pip._vendor.requests.packages.urllib3.packages", // 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$packages$urllib3$packages = PyModule_Create( &mdef_pip$_vendor$requests$packages$urllib3$packages ); #endif moduledict_pip$_vendor$requests$packages$urllib3$packages = (PyDictObject *)((PyModuleObject *)module_pip$_vendor$requests$packages$urllib3$packages)->md_dict; CHECK_OBJECT( module_pip$_vendor$requests$packages$urllib3$packages ); // 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_717e0aa5e359f200231896bcbab797ab, module_pip$_vendor$requests$packages$urllib3$packages ); 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$packages$urllib3$packages ); 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_assign_source_8; PyObject *tmp_import_globals_1; PyObject *tmp_import_name_from_1; PyFrameObject *frame_module; // Module code. tmp_assign_source_1 = Py_None; UPDATE_STRING_DICT0( moduledict_pip$_vendor$requests$packages$urllib3$packages, (Nuitka_StringObject *)const_str_plain___doc__, tmp_assign_source_1 ); tmp_assign_source_2 = const_str_digest_2fda06de9b427b74c9496097feae88ce; UPDATE_STRING_DICT0( moduledict_pip$_vendor$requests$packages$urllib3$packages, (Nuitka_StringObject *)const_str_plain___file__, tmp_assign_source_2 ); tmp_assign_source_3 = LIST_COPY( const_list_str_digest_d3e5a07139fdaf41b1ccc2e249a03040_list ); UPDATE_STRING_DICT1( moduledict_pip$_vendor$requests$packages$urllib3$packages, (Nuitka_StringObject *)const_str_plain___path__, tmp_assign_source_3 ); tmp_assign_source_4 = Py_None; UPDATE_STRING_DICT0( moduledict_pip$_vendor$requests$packages$urllib3$packages, (Nuitka_StringObject *)const_str_plain___cached__, tmp_assign_source_4 ); tmp_assign_source_5 = const_str_digest_717e0aa5e359f200231896bcbab797ab; UPDATE_STRING_DICT0( moduledict_pip$_vendor$requests$packages$urllib3$packages, (Nuitka_StringObject *)const_str_plain___package__, tmp_assign_source_5 ); tmp_assign_source_6 = PyObject_GetAttrString(PyImport_ImportModule("__future__"), "absolute_import"); UPDATE_STRING_DICT0( moduledict_pip$_vendor$requests$packages$urllib3$packages, (Nuitka_StringObject *)const_str_plain_absolute_import, tmp_assign_source_6 ); // Frame without reuse. frame_module = MAKE_MODULE_FRAME( codeobj_690c45c406de567b9656102a490ecf48, module_pip$_vendor$requests$packages$urllib3$packages ); // 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$packages$urllib3$packages)->md_dict; frame_module->f_lineno = 3; tmp_import_name_from_1 = IMPORT_MODULE( const_str_empty, tmp_import_globals_1, tmp_import_globals_1, const_tuple_str_plain_ssl_match_hostname_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_7 = IMPORT_NAME( tmp_import_name_from_1, const_str_plain_ssl_match_hostname ); Py_DECREF( tmp_import_name_from_1 ); if ( tmp_assign_source_7 == 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$packages$urllib3$packages, (Nuitka_StringObject *)const_str_plain_ssl_match_hostname, 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:; tmp_assign_source_8 = const_tuple_str_plain_ssl_match_hostname_tuple; UPDATE_STRING_DICT0( moduledict_pip$_vendor$requests$packages$urllib3$packages, (Nuitka_StringObject *)const_str_plain___all__, tmp_assign_source_8 ); return MOD_RETURN_VALUE( module_pip$_vendor$requests$packages$urllib3$packages ); module_exception_exit: RESTORE_ERROR_OCCURRED( exception_type, exception_value, exception_tb ); return MOD_RETURN_VALUE( NULL ); }