Changeset: 75de8e07676a for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=75de8e07676a
Modified Files:
        NT/rules.msc
        sql/backends/monet5/UDF/pyapi/pyheader.h
        sql/backends/monet5/UDF/pyapi/type_conversion.c
Branch: Aug2018
Log Message:

Port pyapi3 to Windows.


diffs (52 lines):

diff --git a/NT/rules.msc b/NT/rules.msc
--- a/NT/rules.msc
+++ b/NT/rules.msc
@@ -185,8 +185,13 @@ R.lib: "$(libr_DLL)"
 !ENDIF
 
 !IFDEF HAVE_LIBPY
-libpy_LIBS = $(PYTHON2DIR)\libs\python27.lib
-libpy_CFLAGS = -DHAVE_LIBPY -I$(PYTHON2DIR)\include 
-I$(PYTHON2DIR)\Lib\site-packages\numpy\core\include
+libpy_LIBS = "$(PYTHON2DIR)\libs\python27.lib"
+libpy_CFLAGS = -DHAVE_LIBPY "-I$(PYTHON2DIR)\include" 
"-I$(PYTHON2DIR)\Lib\site-packages\numpy\core\include"
+!ENDIF
+
+!IFDEF HAVE_LIBPY3
+libpy3_LIBS = "$(PYTHON3DIR)\libs\python37.lib"
+libpy3_CFLAGS = -DHAVE_LIBPY3 "-I$(PYTHON3DIR)\include" 
"-I$(PYTHON3DIR)\Lib\site-packages\numpy\core\include"
 !ENDIF
 
 # some programs we use, probably no need to edit
diff --git a/sql/backends/monet5/UDF/pyapi/pyheader.h 
b/sql/backends/monet5/UDF/pyapi/pyheader.h
--- a/sql/backends/monet5/UDF/pyapi/pyheader.h
+++ b/sql/backends/monet5/UDF/pyapi/pyheader.h
@@ -57,7 +57,7 @@
 
 // DLL Export Flags
 #ifdef WIN32
-#ifndef LIBPYAPI
+#if !defined(LIBPYAPI) && !defined(LIBPYAPI3)
 #define pyapi_export extern __declspec(dllimport)
 #else
 #define pyapi_export extern __declspec(dllexport)
diff --git a/sql/backends/monet5/UDF/pyapi/type_conversion.c 
b/sql/backends/monet5/UDF/pyapi/type_conversion.c
--- a/sql/backends/monet5/UDF/pyapi/type_conversion.c
+++ b/sql/backends/monet5/UDF/pyapi/type_conversion.c
@@ -272,7 +272,7 @@ str pyobject_to_##type(PyObject **pyobj,
                PyLongObject *p = (PyLongObject*) ptr;                          
\
                inttpe h = 0;                                                   
\
                inttpe prev = 0;                                                
\
-               int i = Py_SIZE(p);                                             
\
+               Py_ssize_t i = Py_SIZE(p);                                      
        \
                int sign = i < 0 ? -1 : 1;                                      
\
                i *= sign;                                                      
\
                while (--i >= 0) {                                              
\
@@ -284,7 +284,7 @@ str pyobject_to_##type(PyObject **pyobj,
                }                                                               
\
                *value = (type)(h * sign);                                      
\
        } else if (PyBool_Check(ptr)) {                                 \
-               *value = ptr == Py_True ? 1 : 0;                                
\
+               *value = ptr == Py_True ? (type) 1 : (type) 0;                  
\
        } else if (PyFloat_CheckExact(ptr)) {                           \
                *value = isnan(((PyFloatObject*)ptr)->ob_fval) ? type##_nil : 
(type) ((PyFloatObject*)ptr)->ob_fval; \
        } else if (PyUnicode_CheckExact(ptr)) {                         \
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to