]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
py3: Remove #define PyInt_Check PyLong_Check
authorAndrew Bartlett <abartlet@samba.org>
Sat, 14 Mar 2020 21:04:52 +0000 (10:04 +1300)
committerNoel Power <npower@samba.org>
Mon, 23 Mar 2020 19:12:43 +0000 (19:12 +0000)
This will allow us to remove some unused code in the PIDL-generated
python bindings.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Noel Power <npower@samba.org>
lib/tdb/pytdb.c
libcli/nbt/pynbt.c
pidl/lib/Parse/Pidl/Samba4/Python.pm
python/py3compat.h
source4/lib/wmi/wmi.i
source4/lib/wmi/wmi_wrap.c
source4/librpc/rpc/pyrpc.c

index 74e80f95ec505fbcd284e1ef8380cd2a7e2bec9a..7211d466a71495c7afb3d9164f9fb4f28728d570 100644 (file)
@@ -33,7 +33,6 @@
 
 #if PY_MAJOR_VERSION >= 3
 #define PyInt_FromLong PyLong_FromLong
-#define PyInt_Check PyLong_Check
 #define PyInt_AsLong PyLong_AsLong
 #define Py_TPFLAGS_HAVE_ITER 0
 #endif
@@ -555,7 +554,7 @@ static PyObject *obj_get_hash_size(PyTdbObject *self, void *closure)
 static int obj_set_max_dead(PyTdbObject *self, PyObject *max_dead, void *closure)
 {
        PyErr_TDB_RAISE_RETURN_MINUS_1_IF_CLOSED(self);
-       if (!PyInt_Check(max_dead))
+       if (!PyLong_Check(max_dead))
                return -1;
        tdb_set_max_dead(self->ctx, PyInt_AsLong(max_dead));
        return 0;
index a562f6dcb5ef86e8586e1a1c8f30062bf6341bce..1148da7289dbf0cb60dfe823126292da25cbdc06 100644 (file)
@@ -79,7 +79,7 @@ static bool PyObject_AsDestinationTuple(PyObject *obj, const char **dest_addr, u
                if (PyTuple_Size(obj) == 1) {
                        *dest_port = NBT_NAME_SERVICE_PORT;
                        return true;
-               } else if (PyInt_Check(PyTuple_GetItem(obj, 1))) {
+               } else if (PyLong_Check(PyTuple_GetItem(obj, 1))) {
                        *dest_port = PyInt_AsLong(PyTuple_GetItem(obj, 1));
                        return true;
                } else {
index 84d4dade512db7a5ded39e07cef09a14eca818bf..b2a65cc7376f73cb3640d0485406a97a07300913 100644 (file)
@@ -1754,7 +1754,7 @@ sub ConvertObjectFromPythonData($$$$$$;$$)
                $self->pidl("}");
                $self->pidl("$target = test_var;");
                $self->deindent;
-               $self->pidl("} else if (PyInt_Check($cvar)) {");
+               $self->pidl("} else if (PyLong_Check($cvar)) {");
                $self->indent;
                $self->pidl("long test_var;");
                $self->pidl("test_var = PyInt_AsLong($cvar);");
@@ -1806,7 +1806,7 @@ sub ConvertObjectFromPythonData($$$$$$;$$)
                $self->pidl("}");
                $self->pidl("$target = test_var;");
                $self->deindent;
-               $self->pidl("} else if (PyInt_Check($cvar)) {");
+               $self->pidl("} else if (PyLong_Check($cvar)) {");
                $self->indent;
                $self->pidl("long test_var;");
                $self->pidl("test_var = PyInt_AsLong($cvar);");
index d2adb24c6a210a2ad58624292e9dd55d743de3eb..30982a802937bad7d1123d896483ff9b19cdc360 100644 (file)
@@ -73,7 +73,6 @@
 /* Ints */
 
 #define PyInt_Type PyLong_Type
-#define PyInt_Check PyLong_Check
 #define PyInt_FromLong PyLong_FromLong
 #define PyInt_AsLong PyLong_AsLong
 
index 2c8bbe517ebc83e518aa09d634d62d122689bb75..b23ed6152cf39f6de994222b4ed084638cca3a73 100644 (file)
@@ -302,7 +302,7 @@ typedef struct IEnumWbemClassObject {
 %typemap(in, numinputs=1) (uint32_t uCount, struct WbemClassObject **apObjects, uint32_t *puReturned) (uint32_t uReturned) {
         if (PyLong_Check($input))
                $1 = PyLong_AsUnsignedLong($input);
-        else if (PyInt_Check($input))
+        else if (PyLong_Check($input))
                $1 = PyInt_AsLong($input);
         else {
             PyErr_SetString(PyExc_TypeError,"Expected a long or an int");
index 0fd94300ba3907880fab94f70dfc0a5afbc4a858..c44eeefccee57086710d0a6c15066fd453da8c45 100644 (file)
@@ -2670,7 +2670,7 @@ SWIG_AsVal_double (PyObject *obj, double *val)
   if (PyFloat_Check(obj)) {
     if (val) *val = PyFloat_AsDouble(obj);
     return SWIG_OK;
-  } else if (PyInt_Check(obj)) {
+  } else if (PyLong_Check(obj)) {
     if (val) *val = PyInt_AsLong(obj);
     return SWIG_OK;
   } else if (PyLong_Check(obj)) {
@@ -2746,7 +2746,7 @@ SWIG_CanCastAsInteger(double *d, double min, double max) {
 SWIGINTERN int
 SWIG_AsVal_unsigned_SS_long (PyObject *obj, unsigned long *val) 
 {
-  if (PyInt_Check(obj)) {
+  if (PyLong_Check(obj)) {
     long v = PyInt_AsLong(obj);
     if (v >= 0) {
       if (val) *val = v;
@@ -2824,7 +2824,7 @@ SWIG_From_unsigned_SS_int  (unsigned int value)
 SWIGINTERN int
 SWIG_AsVal_long (PyObject *obj, long* val)
 {
-  if (PyInt_Check(obj)) {
+  if (PyLong_Check(obj)) {
     if (val) *val = PyInt_AsLong(obj);
     return SWIG_OK;
   } else if (PyLong_Check(obj)) {
@@ -3607,7 +3607,7 @@ SWIGINTERN PyObject *_wrap_IEnumWbemClassObject_SmartNext(PyObject *SWIGUNUSEDPA
   {
     if (PyLong_Check(obj2))
     arg4 = PyLong_AsUnsignedLong(obj2);
-    else if (PyInt_Check(obj2))
+    else if (PyLong_Check(obj2))
     arg4 = PyInt_AsLong(obj2);
     else {
       PyErr_SetString(PyExc_TypeError,"Expected a long or an int");
index 3f2f7154fa781c4309bb82aca1350f9983c26035..33841ae0f119777bc755a0b2511f596919f40e32 100644 (file)
@@ -73,7 +73,7 @@ static bool ndr_syntax_from_py_object(PyObject *object, struct ndr_syntax_id *sy
                }
 
                item = PyTuple_GetItem(object, 1);
-               if (!PyInt_Check(item)) {
+               if (!PyLong_Check(item)) {
                        PyErr_SetString(PyExc_ValueError, "Expected version as second element in tuple");
                        return false;
                }