raw_input() quick fix part I (bltinmodule.c)

Help
2006-02-06
2013-05-30
  • For raw_input() to work, I modified
    builtin_raw_input() in bltinmodule.c with:

    /*------------ bltinmodule_mod.c ------------*/
    char* RawInputChar(char* prompt);

    static PyObject *
    builtin_raw_input(PyObject *self, PyObject *args)
    {
        PyObject *v = NULL;
        char *s;
        int len;

        if (PyArg_UnpackTuple(args, "[raw_]input", 0, 1, &v))
        {
            PyObject *po;
            char *prompt;
            if (v != NULL) {
                po = PyObject_Str(v);
                if (po == NULL)
                    return NULL;
                prompt = PyString_AsString(po);
                if (prompt == NULL)
                    return NULL;
            }
            else {
                po = NULL;
                prompt = "";
            }

            s = RawInputChar(prompt);

            Py_XDECREF(po);

            len = strlen(s);
            return PyString_FromStringAndSize(s, len);
        }
        return NULL;
    }

     
    • Sherif
      Sherif
      2006-07-03

      how can i make it work ?

       
    • PythonCE-2.4.3-20060430 still has this problem.

      I did fix it by modification to
        $src\Python\bltinmodule.c ...replace builtin_raw_input()
        $src\PC\dl_nt.c ...add RawInputChar() for dynamic dialog

      This change is made to "python24.dll" only.
      Total size: 67K

      I can email to you by request.
      Sorry, I don't know how to contribute to the project.
      Anyone can help?

      --santiwk