Hi All,

I am trying to port    PyArg_ParseTupleAndKeywords(args, kwds,
"|O:tasklet", kwlist, &func)
from stackless python2.7.5 to python2.7.9  for my specific project
requirement. however I get compile time error "SystemError:
Python/getargs.c:1435: bad argument to internal function"




......
.......
/root/usr/lib -Xlinker -rpath-link -Xlinker /home/temp/root/lib
-Xlinker -export-dynamic -o python \
        Modules/python.o \
        libpython2.7.a -ldl  -lutil   -lm
./python-host -S -m sysconfig --generate-posix-vars ;\
if test $? -ne 0 ; then \
    echo "generate-posix-vars failed" ; \
    rm -f ./pybuilddir.txt ; \
    exit 1 ; \
fi
SystemError: Python/getargs.c:1435: bad argument to internal function
generate-posix-vars failed
make[1]: *** [pybuilddir.txt] Error 1
make[1]: Leaving directory
`/home/temp/src/sys/3rdparty/python/stackless-279-export'
../../../../mk/makerules-configure,make,make_install:154: recipe for
target '/home/temp/src/sys/3rdparty/python/stackless-279-export/python'
failed
make: *** [/home/temp/src/sys/3rdparty/python/stackless-279-export/python]
Error 2
make: *** Deleting file
'/home/temp/src/sys/3rdparty/python/stackless-279-export/python'
/home/temp/python>



This seems to be a run time err but force to check at compile somehow
with " python-host sysconfig" but not sure how. can any one help me
understanding how this checking is done
at compile time ? how can i  avoid this error ?






--- stackless-279-export_org/Stackless/module/taskletobject.c
2016-07-19 05:05:50.194679706 +0530
+++ stackless-279-export/Stackless/module/taskletobject.c
2016-07-21 01:54:28.829913276 +0530
@@ -361,12 +361,21 @@
 {
     PyThreadState *ts = PyThreadState_GET();
     PyTaskletObject *t;
+    PyFunctionObject *func = NULL;
+    static char *kwlist[] = {"func", NULL};

     /* we always need a cstate, so be sure to initialize */
     if (ts->st.initial_stub == NULL) {
         PyMethodDef def = {"__new__", (PyCFunction)tasklet_new, METH_NOARGS};
         return PyStackless_CallCMethod_Main(&def, (PyObject*)type, NULL);
     }
+
+    if (!PyArg_ParseTupleAndKeywords(args, kwds, "|O:tasklet", kwlist, &func))
+        return NULL;
+
+    if ((PyObject *)func != NULL && !PyCallable_Check((PyObject *)func))
+          TYPE_ERROR("tasklet function must be a callable", NULL);
+
     if (type == NULL)
         type = &PyTasklet_Type;
     t = (PyTaskletObject *) type->tp_alloc(type, 0);
@@ -376,6 +385,8 @@
     t->next = NULL;
     t->prev = NULL;
     t->f.frame = NULL;
+    if (func == NULL)
+        func = Py_None;
     Py_INCREF(Py_None);
     t->tempval = Py_None;
     t->tsk_weakreflist = NULL;
@@ -390,6 +401,10 @@
             return NULL;
         }
     }














thanks.

_______________________________________________
Stackless mailing list
Stackless@stackless.com
http://www.stackless.com/mailman/listinfo/stackless

Reply via email to