[pypy-commit] pypy default: c89 syntax for msvc

mattip pypy.commits at gmail.com
Sat Jul 9 17:34:32 EDT 2016


Author: Matti Picus <matti.picus at gmail.com>
Branch: 
Changeset: r85644:bb6ab1bbb0e3
Date: 2016-07-09 16:42 -0400
http://bitbucket.org/pypy/pypy/changeset/bb6ab1bbb0e3/

Log:	c89 syntax for msvc

diff --git a/pypy/module/cpyext/test/test_bytearrayobject.py b/pypy/module/cpyext/test/test_bytearrayobject.py
--- a/pypy/module/cpyext/test/test_bytearrayobject.py
+++ b/pypy/module/cpyext/test/test_bytearrayobject.py
@@ -87,11 +87,12 @@
         module = self.import_extension('foo', [
             ("getbytearray", "METH_NOARGS",
              """
-                 PyObject* s1 = PyByteArray_FromStringAndSize("test", 4);
+                 const char *c;
+                 PyObject *s2, *s1 = PyByteArray_FromStringAndSize("test", 4);
                  if (s1 == NULL)
                      return NULL;
-                 const char* c = PyByteArray_AsString(s1);
-                 PyObject* s2 = PyByteArray_FromStringAndSize(c, 4);
+                 c = PyByteArray_AsString(s1);
+                 s2 = PyByteArray_FromStringAndSize(c, 4);
                  Py_DECREF(s1);
                  return s2;
              """),
diff --git a/pypy/module/cpyext/test/test_datetime.py b/pypy/module/cpyext/test/test_datetime.py
--- a/pypy/module/cpyext/test/test_datetime.py
+++ b/pypy/module/cpyext/test/test_datetime.py
@@ -176,13 +176,15 @@
              """),
             ("test_datetime_macros", "METH_NOARGS",
              """
+                 PyObject* obj;
+                 PyDateTime_DateTime *dt;
                  PyDateTime_IMPORT;
                  if (!PyDateTimeAPI) {
                      PyErr_SetString(PyExc_RuntimeError, "No PyDateTimeAPI");
                      return NULL;
                  }
-                 PyObject* obj = PyDateTime_FromDateAndTime(2000, 6, 6, 6, 6, 6, 6);
-                 PyDateTime_DateTime* dt = (PyDateTime_DateTime*)obj;
+                 obj = PyDateTime_FromDateAndTime(2000, 6, 6, 6, 6, 6, 6);
+                 dt = (PyDateTime_DateTime*)obj;
 
                  PyDateTime_GET_YEAR(obj);
                  PyDateTime_GET_YEAR(dt);
@@ -209,13 +211,15 @@
              """),
             ("test_time_macros", "METH_NOARGS",
              """
+                 PyObject* obj;
+                 PyDateTime_Time* t;
                  PyDateTime_IMPORT;
                  if (!PyDateTimeAPI) {
                      PyErr_SetString(PyExc_RuntimeError, "No PyDateTimeAPI");
                      return NULL;
                  }
-                 PyObject* obj = PyTime_FromTime(6, 6, 6, 6);
-                 PyDateTime_Time* t = (PyDateTime_Time*)obj;
+                 obj = PyTime_FromTime(6, 6, 6, 6);
+                 t = (PyDateTime_Time*)obj;
 
                  PyDateTime_TIME_GET_HOUR(obj);
                  PyDateTime_TIME_GET_HOUR(t);
@@ -233,13 +237,15 @@
              """),
             ("test_delta_macros", "METH_NOARGS",
              """
+                 PyObject* obj;
+                 PyDateTime_Delta* delta;
                  PyDateTime_IMPORT;
                  if (!PyDateTimeAPI) {
                      PyErr_SetString(PyExc_RuntimeError, "No PyDateTimeAPI");
                      return NULL;
                  }
-                 PyObject* obj = PyDelta_FromDSU(6, 6, 6);
-                 PyDateTime_Delta* delta = (PyDateTime_Delta*)obj;
+                 obj = PyDelta_FromDSU(6, 6, 6);
+                 delta = (PyDateTime_Delta*)obj;
 
 #if defined(PYPY_VERSION) || PY_VERSION_HEX >= 0x03030000
                  // These macros are only defined in CPython 3.x and PyPy.


More information about the pypy-commit mailing list