Author: mattip <[email protected]>
Branch: cpyext-ext
Changeset: r83319:ca63eb4f0726
Date: 2016-03-24 01:42 +0200
http://bitbucket.org/pypy/pypy/changeset/ca63eb4f0726/
Log: fixes for win32
diff --git a/pypy/module/cpyext/include/floatobject.h
b/pypy/module/cpyext/include/floatobject.h
--- a/pypy/module/cpyext/include/floatobject.h
+++ b/pypy/module/cpyext/include/floatobject.h
@@ -3,6 +3,13 @@
#ifndef Py_FLOATOBJECT_H
#define Py_FLOATOBJECT_H
+
+#ifdef _MSC_VER
+#include <math.h>
+#include <float.h>
+#define copysign _copysign
+#endif
+
#ifdef __cplusplus
extern "C" {
#endif
diff --git a/pypy/module/cpyext/test/foo3.c b/pypy/module/cpyext/test/foo3.c
--- a/pypy/module/cpyext/test/foo3.c
+++ b/pypy/module/cpyext/test/foo3.c
@@ -3,8 +3,9 @@
PyObject* foo3type_tp_new(PyTypeObject* metatype, PyObject* args, PyObject*
kwds)
{
+ PyObject* newType;
printf("in foo3type_tp_new, preprocessing...\n");
- PyObject* newType = PyType_Type.tp_new(metatype, args, kwds);
+ newType = PyType_Type.tp_new(metatype, args, kwds);
printf("in foo3type_tp_new, postprocessing...\n");
return newType;
}
@@ -62,8 +63,6 @@
/* Initialize this module. */
#ifdef __GNUC__
extern __attribute__((visibility("default")))
-#else
-extern __declspec(dllexport)
#endif
PyMODINIT_FUNC
diff --git a/pypy/module/cpyext/test/test_bytesobject.py
b/pypy/module/cpyext/test/test_bytesobject.py
--- a/pypy/module/cpyext/test/test_bytesobject.py
+++ b/pypy/module/cpyext/test/test_bytesobject.py
@@ -25,14 +25,15 @@
"""
PyObject* s = PyString_FromString("Hello world");
int result = 0;
+ size_t expected_size;
if(PyString_Size(s) == 11) {
result = 1;
}
#ifdef PYPY_VERSION
- size_t expected_size = sizeof(void*)*7;
+ expected_size = sizeof(void*)*7;
#else
- size_t expected_size = 37;
+ expected_size = 37;
#endif
if(s->ob_type->tp_basicsize != expected_size)
{
diff --git a/pypy/module/cpyext/test/test_pyerrors.py
b/pypy/module/cpyext/test/test_pyerrors.py
--- a/pypy/module/cpyext/test/test_pyerrors.py
+++ b/pypy/module/cpyext/test/test_pyerrors.py
@@ -1,3 +1,4 @@
+import pytest
import sys
import StringIO
@@ -101,6 +102,7 @@
instance = space.call_function(space.w_ValueError)
assert api.PyExceptionInstance_Class(instance) is space.w_ValueError
+ @pytest.mark.skipif("sys.platform == 'win32'")
def test_interrupt_occurred(self, space, api):
assert not api.PyOS_InterruptOccurred()
import signal, os
diff --git a/pypy/module/cpyext/test/test_unicodeobject.py
b/pypy/module/cpyext/test/test_unicodeobject.py
--- a/pypy/module/cpyext/test/test_unicodeobject.py
+++ b/pypy/module/cpyext/test/test_unicodeobject.py
@@ -190,14 +190,14 @@
ar[0] = rffi.cast(PyObject, py_uni)
api.PyUnicode_Resize(ar, 3)
py_uni = rffi.cast(PyUnicodeObject, ar[0])
- assert py_uni.c_length == 3
+ assert py_uni.c_size == 3
assert py_uni.c_str[1] == u'b'
assert py_uni.c_str[3] == u'\x00'
# the same for growing
ar[0] = rffi.cast(PyObject, py_uni)
api.PyUnicode_Resize(ar, 10)
py_uni = rffi.cast(PyUnicodeObject, ar[0])
- assert py_uni.c_length == 10
+ assert py_uni.c_size == 10
assert py_uni.c_str[1] == 'b'
assert py_uni.c_str[10] == '\x00'
Py_DecRef(space, ar[0])
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit