Jump to content
×
×
  • Create New...
  • 0

Python int too large to convert to C Long


AndreiYildirim

Question

  • Premium

Hi, i have this error when i try to open the game launcher.

 

0620 19:44:00510 :: ui
0620 19:44:00510 :: :2830: 
0620 19:44:00510 :: RuntimeWarning
0620 19:44:00510 :: : 
0620 19:44:00510 :: tp_compare didn't return -1 or -2 for exception
0620 19:44:00510 :: 

0620 19:44:00512 :: 
introLogin.py(line:509) __LoadScript
ui.py(line:2823) LoadScriptFile
ui.py(line:3013) LoadChildren
ui.py(line:3013) LoadChildren
ui.py(line:2830) LoadChildren

LoginWindow.__LoadScript.LoadObject - <type 'exceptions.OverflowError'>:Python int too large to convert to C long

0620 19:44:00512 :: ============================================================================================================
0620 19:44:00512 :: Abort!!!!


0620 19:44:00530 :: ============================================================================================================
0620 19:44:00530 :: Abort!!!!


Im using Windows 8.1 PRO x64 and a Distribution compiled launcher.

 

Does someone know how to fix this?

 

Kind regards!

Link to comment
Share on other sites

5 answers to this question

Recommended Posts

  • 0
  • Premium

But you're a programmer and you have a whole team which does C++, Lua and Python, which is enough to solve this problem... or at least that's you're saying here: http://metin2dev.org/board/index.php?/topic/7292-service-c-lua-and-python-scripting/

Whatever, check this: http://metin2dev.org/board/index.php?/topic/1237-compiled-binary-crashes-after-loading-screen/#comment-9232

Link to comment
Share on other sites

  • 0

But you're a programmer and you have a whole team which does C++, Lua and Python, which is enough to solve this problem... or at least that's you're saying here: http://metin2dev.org/board/index.php?/topic/7292-service-c-lua-and-python-scripting/

Whatever, check this: http://metin2dev.org/board/index.php?/topic/1237-compiled-binary-crashes-after-loading-screen/#comment-9232

​+1 You're right, it is the best programmer.

=)))

Link to comment
Share on other sites

  • 0
  • Moon

PythonUtils.cpp

 

#include "StdAfx.h"
#include "PythonUtils.h"

#define PyLong_AsLong PyLong_AsLongLong
#define PyLong_AsUnsignedLong PyLong_AsUnsignedLongLong

IPythonExceptionSender * g_pkExceptionSender = NULL;

bool __PyCallClassMemberFunc_ByCString(PyObject* poClass, const char* c_szFunc, PyObject* poArgs, PyObject** poRet);
bool __PyCallClassMemberFunc_ByPyString(PyObject* poClass, PyObject* poFuncName, PyObject* poArgs, PyObject** poRet);
bool __PyCallClassMemberFunc(PyObject* poClass, PyObject* poFunc, PyObject* poArgs, PyObject** poRet);

PyObject * Py_BadArgument()
{
        PyErr_BadArgument();
        return NULL;
}

PyObject * Py_BuildException(const char * c_pszErr, ...)
{
        if (!c_pszErr)
                PyErr_Clear();
        else
        {
                char szErrBuf[512+1];
                va_list args;
                va_start(args, c_pszErr);
                vsnprintf(szErrBuf, sizeof(szErrBuf), c_pszErr, args);
                va_end(args);

                PyErr_SetString(PyExc_RuntimeError, szErrBuf);
        }

        return Py_BuildNone();
        //return NULL;
}

PyObject * Py_BuildNone()
{
        Py_INCREF(Py_None);
        return Py_None;
}

void Py_ReleaseNone()
{
        Py_DECREF(Py_None);
}

bool PyTuple_GetObject(PyObject* poArgs, int pos, PyObject** ret)
{
        if (pos >= PyTuple_Size(poArgs))
                return false;

        PyObject * poItem = PyTuple_GetItem(poArgs, pos);

        if (!poItem)
                return false;
        
        *ret = poItem;
        return true;
}

bool PyTuple_GetLong(PyObject* poArgs, int pos, long* ret)
{
        if (pos >= PyTuple_Size(poArgs))
                return false;

        PyObject* poItem = PyTuple_GetItem(poArgs, pos);

        if (!poItem)
                return false;

        *ret = PyLong_AsLong(poItem);
        return true;
}

bool PyTuple_GetDouble(PyObject* poArgs, int pos, double* ret)
{
        if (pos >= PyTuple_Size(poArgs))
                return false;

        PyObject* poItem = PyTuple_GetItem(poArgs, pos);

        if (!poItem)
                return false;

        *ret = PyFloat_AsDouble(poItem);
        return true;
}

bool PyTuple_GetFloat(PyObject* poArgs, int pos, float* ret)
{
        if (pos >= PyTuple_Size(poArgs))
                return false;

        PyObject * poItem = PyTuple_GetItem(poArgs, pos);

        if (!poItem)
                return false;

        *ret = float(PyFloat_AsDouble(poItem));
        return true;
}

bool PyTuple_GetByte(PyObject* poArgs, int pos, unsigned char* ret)
{
        int val;
        bool result = PyTuple_GetInteger(poArgs,pos,&val);
        *ret = unsigned char(val);
        return result;
}

bool PyTuple_GetInteger(PyObject* poArgs, int pos, unsigned char* ret)
{
        int val;
        bool result = PyTuple_GetInteger(poArgs,pos,&val);
        *ret = unsigned char(val);
        return result;
}

bool PyTuple_GetInteger(PyObject* poArgs, int pos, WORD* ret)
{
        int val;
        bool result = PyTuple_GetInteger(poArgs,pos,&val);
        *ret = WORD(val);
        return result;
}

bool PyTuple_GetInteger(PyObject* poArgs, int pos, int* ret)
{
        if (pos >= PyTuple_Size(poArgs))
                return false;

        PyObject* poItem = PyTuple_GetItem(poArgs, pos);
        
        if (!poItem)
                return false;
        
        *ret = PyLong_AsLong(poItem);
        return true;
}

bool PyTuple_GetUnsignedLong(PyObject* poArgs, int pos, unsigned long* ret)
{
        if (pos >= PyTuple_Size(poArgs))
                return false;

        PyObject * poItem = PyTuple_GetItem(poArgs, pos);
        
        if (!poItem)
                return false;
        
        *ret = PyLong_AsUnsignedLong(poItem);
        return true;
}

bool PyTuple_GetUnsignedInteger(PyObject* poArgs, int pos, unsigned int* ret)
{
        if (pos >= PyTuple_Size(poArgs))
                return false;

        PyObject* poItem = PyTuple_GetItem(poArgs, pos);
        
        if (!poItem)
                return false;
        
        *ret = PyLong_AsUnsignedLong(poItem);
        return true;
}

bool PyTuple_GetString(PyObject* poArgs, int pos, char** ret)
{
        if (pos >= PyTuple_Size(poArgs))
                return false;

        PyObject* poItem = PyTuple_GetItem(poArgs, pos);

        if (!poItem)
                return false;

        if (!PyString_Check(poItem)) 
                return false;

        *ret = PyString_AsString(poItem);
        return true;
}

bool PyTuple_GetBoolean(PyObject* poArgs, int pos, bool* ret)
{
        if (pos >= PyTuple_Size(poArgs))
                return false;
        
        PyObject* poItem = PyTuple_GetItem(poArgs, pos);

        if (!poItem)
                return false;

        *ret = PyLong_AsLong(poItem) ? true : false;
        return true;
}

bool PyCallClassMemberFunc(PyObject* poClass, PyObject* poFunc, PyObject* poArgs)
{
        PyObject* poRet;

        // NOTE : NULL 체크 추가.. - [levites]
        if (!poClass)
        {
                Py_XDECREF(poArgs);
                return false;
        }

        if (!__PyCallClassMemberFunc(poClass, poFunc, poArgs, &poRet))
                return false;

        Py_DECREF(poRet);
        return true;
}

bool PyCallClassMemberFunc(PyObject* poClass, const char* c_szFunc, PyObject* poArgs)
{
        PyObject* poRet;

        // NOTE : NULL 체크 추가.. - [levites]
        if (!poClass)
        {
                Py_XDECREF(poArgs);
                return false;
        }

        if (!__PyCallClassMemberFunc_ByCString(poClass, c_szFunc, poArgs, &poRet))
                return false;

        Py_DECREF(poRet);
        return true;
}

bool PyCallClassMemberFunc_ByPyString(PyObject* poClass, PyObject* poFuncName, PyObject* poArgs)
{
        PyObject* poRet;

        // NOTE : NULL 체크 추가.. - [levites]
        if (!poClass)
        {
                Py_XDECREF(poArgs);
                return false;
        }

        if (!__PyCallClassMemberFunc_ByPyString(poClass, poFuncName, poArgs, &poRet))
                return false;
        
        Py_DECREF(poRet);
        return true;
}

bool PyCallClassMemberFunc(PyObject* poClass, const char* c_szFunc, PyObject* poArgs, bool* pisRet)
{
        PyObject* poRet;

        if (!__PyCallClassMemberFunc_ByCString(poClass, c_szFunc, poArgs, &poRet))
                return false;

        if (PyNumber_Check(poRet))
                *pisRet = (PyLong_AsLong(poRet) != 0);
        else
                *pisRet = true;

        Py_DECREF(poRet);
        return true;
}

bool PyCallClassMemberFunc(PyObject* poClass, const char* c_szFunc, PyObject* poArgs, long * plRetValue)
{
        PyObject* poRet;

        if (!__PyCallClassMemberFunc_ByCString(poClass, c_szFunc, poArgs, &poRet))
                return false;

        if (PyNumber_Check(poRet))
        {
                *plRetValue = PyLong_AsLong(poRet);
                Py_DECREF(poRet);
                return true;
        }

        Py_DECREF(poRet);
        return false;
}

/*
 *	이 함수를 직접 호출하지 않도록 한다.
 *	부득이 하게 직접 호출할 경우에는 반드시 false 가 리턴 됐을 때
 *	Py_DECREF(poArgs); 를 해준다.
 */
bool __PyCallClassMemberFunc_ByCString(PyObject* poClass, const char* c_szFunc, PyObject* poArgs, PyObject** ppoRet)
{
        if (!poClass) 
        {
                Py_XDECREF(poArgs);
                return false;
        }

        PyObject * poFunc = PyObject_GetAttrString(poClass, (char *)c_szFunc);	// New Reference

        if (!poFunc)
        {		
                PyErr_Clear();
                Py_XDECREF(poArgs);
                return false;
        }

        if (!PyCallable_Check(poFunc)) 
        {
                Py_DECREF(poFunc);
                Py_XDECREF(poArgs);
                return false;
        }

        PyObject * poRet = PyObject_CallObject(poFunc, poArgs);	// New Reference

        if (!poRet)
        {
                if (g_pkExceptionSender)
                        g_pkExceptionSender->Clear();

                PyErr_Print();

                if (g_pkExceptionSender)
                        g_pkExceptionSender->Send();

                Py_DECREF(poFunc);
                Py_XDECREF(poArgs);
                return false;
        }

        *ppoRet = poRet;

        Py_DECREF(poFunc);
        Py_XDECREF(poArgs);
        return true;
}

bool __PyCallClassMemberFunc_ByPyString(PyObject* poClass, PyObject* poFuncName, PyObject* poArgs, PyObject** ppoRet)
{
        if (!poClass) 
        {
                Py_XDECREF(poArgs);
                return false;
        }

        PyObject * poFunc = PyObject_GetAttr(poClass, poFuncName);	// New Reference

        if (!poFunc)
        {		
                PyErr_Clear();
                Py_XDECREF(poArgs);
                return false;
        }

        if (!PyCallable_Check(poFunc)) 
        {
                Py_DECREF(poFunc);
                Py_XDECREF(poArgs);
                return false;
        }

        PyObject * poRet = PyObject_CallObject(poFunc, poArgs);	// New Reference

        if (!poRet)
        {
                if (g_pkExceptionSender)
                        g_pkExceptionSender->Clear();

                PyErr_Print();

                if (g_pkExceptionSender)
                        g_pkExceptionSender->Send();

                Py_DECREF(poFunc);
                Py_XDECREF(poArgs);
                return false;
        }

        *ppoRet = poRet;

        Py_DECREF(poFunc);
        Py_XDECREF(poArgs);
        return true;
}

bool __PyCallClassMemberFunc(PyObject* poClass, PyObject * poFunc, PyObject* poArgs, PyObject** ppoRet)
{
        if (!poClass) 
        {
                Py_XDECREF(poArgs);
                return false;
        }

        if (!poFunc)
        {		
                PyErr_Clear();
                Py_XDECREF(poArgs);
                return false;
        }

        if (!PyCallable_Check(poFunc)) 
        {
                Py_DECREF(poFunc);
                Py_XDECREF(poArgs);
                return false;
        }

        PyObject * poRet = PyObject_CallObject(poFunc, poArgs);	// New Reference

        if (!poRet)
        {
                PyErr_Print();
                Py_DECREF(poFunc);
                Py_XDECREF(poArgs);
                return false;
        }

        *ppoRet = poRet;

        Py_DECREF(poFunc);
        Py_XDECREF(poArgs);
        return true;
}

 

If you are say something like i am programmer etc. you must already know those things. Of course i don't blame you about this. Some people may forget something sometime.

Kind Regards

Ken

Edited by Ken
Small changes
  • Love 3

Do not be sorry, be better.

Link to comment
Share on other sites

  • 0
  • Premium

But you're a programmer and you have a whole team which does C++, Lua and Python, which is enough to solve this problem... or at least that's you're saying here: http://metin2dev.org/board/index.php?/topic/7292-service-c-lua-and-python-scripting/

Whatever, check this: http://metin2dev.org/board/index.php?/topic/1237-compiled-binary-crashes-after-loading-screen/#comment-9232

But you're a programmer and you have a whole team which does C++, Lua and Python, which is enough to solve this problem... or at least that's you're saying here: http://metin2dev.org/board/index.php?/topic/7292-service-c-lua-and-python-scripting/

Whatever, check this: http://metin2dev.org/board/index.php?/topic/1237-compiled-binary-crashes-after-loading-screen/#comment-9232

​+1 You're right, it is the best programmer.

=)))

#CloseRequest, thanks for your support and judgement about my service and about my team. I would recommend you not to comment about my service or my team as you are not one of our clients. EVERYONE can comment out about something.

 

Kind regards!

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.