# HG changeset patch # User Atul Varma # Date 1250377993 25200 # Node ID b3cc704c035e1e77cd8600a232eb44aacb94567b # Parent e4f7cc6beafef9424dc49fd357e3c66f501484ce PYM_callFunction() now uses PyMem_Malloc() to dynamically allocate space for arguments on the heap, since MSVC doesn't seem to support dynamically-sized arrays on the stack. diff -r e4f7cc6beafe -r b3cc704c035e context.cpp --- a/context.cpp Sat Aug 15 15:51:55 2009 -0700 +++ b/context.cpp Sat Aug 15 16:13:13 2009 -0700 @@ -350,14 +350,20 @@ PYM_ENSURE_RUNTIME_MATCH(self->runtime, fun->base.runtime); uintN argc = PyTuple_Size(funcArgs); - jsval argv[argc]; + + jsval *argv = (jsval *) PyMem_Malloc(sizeof(jsval) * argc); + if (argv == NULL) + return PyErr_NoMemory(); + jsval *currArg = argv; for (unsigned int i = 0; i < argc; i++) { PyObject *item = PyTuple_GET_ITEM(funcArgs, i); if (item == NULL || - PYM_pyObjectToJsval(self, item, currArg) == -1) + PYM_pyObjectToJsval(self, item, currArg) == -1) { + PyMem_Free(argv); return NULL; + } currArg++; } @@ -373,6 +379,8 @@ argc, argv, &rval); Py_END_ALLOW_THREADS; + PyMem_Free(argv); + if (!result) { PYM_jsExceptionToPython(self); return NULL;