Permalink
Browse files

fix: Visual Studio does not support VLAs (issue #1)

Stupid compiler, hopefully it's happy with "static int".

BTW we fix a warning: PyObject_Hash returns Py_hash_t nowadays
since (python 3.2).

see #1

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
  • Loading branch information...
rudimeier committed Mar 17, 2017
1 parent 8400572 commit 764ed0dc1f77c68e4a6998688d2e8340704fd237
Showing with 3 additions and 3 deletions.
  1. +3 −3 jcc/sources/jcc.cpp
View
@@ -194,11 +194,11 @@ static PyObject *t_jccenv_isShared(PyObject *self)
static PyObject *t_jccenv_strhash(PyObject *self, PyObject *arg)
{
long hash = PyObject_Hash(arg);
size_t hexdig = sizeof(long) * 2;
unsigned long hash = (unsigned long)PyObject_Hash(arg);
static const size_t hexdig = sizeof(hash) * 2;
char buffer[hexdig + 1];
sprintf(buffer, "%0*lx", (int)hexdig, (unsigned long)hash);
sprintf(buffer, "%0*lx", (int)hexdig, hash);
return PyUnicode_FromStringAndSize(buffer, hexdig);
}

0 comments on commit 764ed0d

Please sign in to comment.