summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2020-03-15 10:36:59 +1300
committerNoel Power <npower@samba.org>2020-03-23 19:12:43 +0000
commit5c1867ba459c2eff0dfc99c92200aecc2d44df59 (patch)
treeb4d32c7bdfe1b79a715f66fd4eec328c5c7f5404
parent4764e8b4c7e459f6aa5861d26ffaec3a3026d77f (diff)
downloadsamba-5c1867ba459c2eff0dfc99c92200aecc2d44df59.tar.gz
py3: Remove #define PyInt_FromLong PyLong_FromLong
This allows us to end the use of Python 2/3 compatability macros. Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Noel Power
-rw-r--r--auth/credentials/pycredentials.c44
-rw-r--r--lib/ldb/pyldb.c7
-rw-r--r--lib/tdb/pytdb.c11
-rw-r--r--lib/tevent/pytevent.c4
-rw-r--r--libcli/nbt/pynbt.c4
-rw-r--r--libcli/security/pysecurity.c2
-rw-r--r--pidl/lib/Parse/Pidl/Samba4/Python.pm6
-rw-r--r--python/py3compat.h6
-rw-r--r--python/pyglue.c6
-rw-r--r--source3/libsmb/pylibsmb.c4
-rw-r--r--source3/passdb/py_passdb.c40
-rw-r--r--source4/auth/gensec/pygensec.c18
-rw-r--r--source4/dsdb/pydsdb.c8
-rw-r--r--source4/lib/messaging/pymessaging.c4
-rw-r--r--source4/lib/policy/pypolicy.c8
-rw-r--r--source4/lib/registry/pyregistry.c18
-rw-r--r--source4/lib/wmi/wmi_wrap.c4
-rw-r--r--source4/librpc/ndr/py_security.c2
-rw-r--r--source4/param/provision.c8
-rw-r--r--source4/param/pyparam.c2
20 files changed, 99 insertions, 107 deletions
diff --git a/auth/credentials/pycredentials.c b/auth/credentials/pycredentials.c
index 7427e286dca..fad07b84ba7 100644
--- a/auth/credentials/pycredentials.c
+++ b/auth/credentials/pycredentials.c
@@ -556,7 +556,7 @@ static PyObject *py_creds_get_kerberos_state(PyObject *self, PyObject *unused)
return NULL;
}
state = cli_credentials_get_kerberos_state(creds);
- return PyInt_FromLong(state);
+ return PyLong_FromLong(state);
}
static PyObject *py_creds_set_kerberos_state(PyObject *self, PyObject *args)
@@ -822,7 +822,7 @@ static PyObject *py_creds_get_gensec_features(PyObject *self, PyObject *args)
}
gensec_features = cli_credentials_get_gensec_features(creds);
- return PyInt_FromLong(gensec_features);
+ return PyLong_FromLong(gensec_features);
}
static PyObject *py_creds_new_client_authenticator(PyObject *self,
@@ -893,7 +893,7 @@ static PyObject *py_creds_get_secure_channel_type(PyObject *self, PyObject *args
channel_type = cli_credentials_get_secure_channel_type(creds);
- return PyInt_FromLong(channel_type);
+ return PyLong_FromLong(channel_type);
}
static PyObject *py_creds_encrypt_netr_crypt_password(PyObject *self,
@@ -1274,25 +1274,25 @@ MODULE_INIT_FUNC(credentials)
if (m == NULL)
return NULL;
- PyModule_AddObject(m, "UNINITIALISED", PyInt_FromLong(CRED_UNINITIALISED));
- PyModule_AddObject(m, "CALLBACK", PyInt_FromLong(CRED_CALLBACK));
- PyModule_AddObject(m, "GUESS_ENV", PyInt_FromLong(CRED_GUESS_ENV));
- PyModule_AddObject(m, "GUESS_FILE", PyInt_FromLong(CRED_GUESS_FILE));
- PyModule_AddObject(m, "CALLBACK_RESULT", PyInt_FromLong(CRED_CALLBACK_RESULT));
- PyModule_AddObject(m, "SPECIFIED", PyInt_FromLong(CRED_SPECIFIED));
-
- PyModule_AddObject(m, "AUTO_USE_KERBEROS", PyInt_FromLong(CRED_AUTO_USE_KERBEROS));
- PyModule_AddObject(m, "DONT_USE_KERBEROS", PyInt_FromLong(CRED_DONT_USE_KERBEROS));
- PyModule_AddObject(m, "MUST_USE_KERBEROS", PyInt_FromLong(CRED_MUST_USE_KERBEROS));
-
- PyModule_AddObject(m, "AUTO_KRB_FORWARDABLE", PyInt_FromLong(CRED_AUTO_KRB_FORWARDABLE));
- PyModule_AddObject(m, "NO_KRB_FORWARDABLE", PyInt_FromLong(CRED_NO_KRB_FORWARDABLE));
- PyModule_AddObject(m, "FORCE_KRB_FORWARDABLE", PyInt_FromLong(CRED_FORCE_KRB_FORWARDABLE));
- PyModule_AddObject(m, "CLI_CRED_NTLM2", PyInt_FromLong(CLI_CRED_NTLM2));
- PyModule_AddObject(m, "CLI_CRED_NTLMv2_AUTH", PyInt_FromLong(CLI_CRED_NTLMv2_AUTH));
- PyModule_AddObject(m, "CLI_CRED_LANMAN_AUTH", PyInt_FromLong(CLI_CRED_LANMAN_AUTH));
- PyModule_AddObject(m, "CLI_CRED_NTLM_AUTH", PyInt_FromLong(CLI_CRED_NTLM_AUTH));
- PyModule_AddObject(m, "CLI_CRED_CLEAR_AUTH", PyInt_FromLong(CLI_CRED_CLEAR_AUTH));
+ PyModule_AddObject(m, "UNINITIALISED", PyLong_FromLong(CRED_UNINITIALISED));
+ PyModule_AddObject(m, "CALLBACK", PyLong_FromLong(CRED_CALLBACK));
+ PyModule_AddObject(m, "GUESS_ENV", PyLong_FromLong(CRED_GUESS_ENV));
+ PyModule_AddObject(m, "GUESS_FILE", PyLong_FromLong(CRED_GUESS_FILE));
+ PyModule_AddObject(m, "CALLBACK_RESULT", PyLong_FromLong(CRED_CALLBACK_RESULT));
+ PyModule_AddObject(m, "SPECIFIED", PyLong_FromLong(CRED_SPECIFIED));
+
+ PyModule_AddObject(m, "AUTO_USE_KERBEROS", PyLong_FromLong(CRED_AUTO_USE_KERBEROS));
+ PyModule_AddObject(m, "DONT_USE_KERBEROS", PyLong_FromLong(CRED_DONT_USE_KERBEROS));
+ PyModule_AddObject(m, "MUST_USE_KERBEROS", PyLong_FromLong(CRED_MUST_USE_KERBEROS));
+
+ PyModule_AddObject(m, "AUTO_KRB_FORWARDABLE", PyLong_FromLong(CRED_AUTO_KRB_FORWARDABLE));
+ PyModule_AddObject(m, "NO_KRB_FORWARDABLE", PyLong_FromLong(CRED_NO_KRB_FORWARDABLE));
+ PyModule_AddObject(m, "FORCE_KRB_FORWARDABLE", PyLong_FromLong(CRED_FORCE_KRB_FORWARDABLE));
+ PyModule_AddObject(m, "CLI_CRED_NTLM2", PyLong_FromLong(CLI_CRED_NTLM2));
+ PyModule_AddObject(m, "CLI_CRED_NTLMv2_AUTH", PyLong_FromLong(CLI_CRED_NTLMv2_AUTH));
+ PyModule_AddObject(m, "CLI_CRED_LANMAN_AUTH", PyLong_FromLong(CLI_CRED_LANMAN_AUTH));
+ PyModule_AddObject(m, "CLI_CRED_NTLM_AUTH", PyLong_FromLong(CLI_CRED_NTLM_AUTH));
+ PyModule_AddObject(m, "CLI_CRED_CLEAR_AUTH", PyLong_FromLong(CLI_CRED_CLEAR_AUTH));
Py_INCREF(&PyCredentials);
PyModule_AddObject(m, "Credentials", (PyObject *)&PyCredentials);
diff --git a/lib/ldb/pyldb.c b/lib/ldb/pyldb.c
index a6069be46a9..eb879b98984 100644
--- a/lib/ldb/pyldb.c
+++ b/lib/ldb/pyldb.c
@@ -85,7 +85,6 @@ static struct ldb_message_element *PyObject_AsMessageElement(
static PyTypeObject PyLdbBytesType;
#if PY_MAJOR_VERSION >= 3
-#define PyInt_FromLong PyLong_FromLong
#define PYARG_STR_UNI "es"
@@ -2541,7 +2540,7 @@ static PyObject *py_ldb_result_get_count(PyLdbResultObject *self, void *closure)
return NULL;
}
size = PyList_Size(self->msgs);
- return PyInt_FromLong(size);
+ return PyLong_FromLong(size);
}
static PyGetSetDef py_ldb_result_getset[] = {
@@ -3080,7 +3079,7 @@ static PyObject *py_ldb_msg_element_get(PyLdbMessageElementObject *self, PyObjec
static PyObject *py_ldb_msg_element_flags(PyLdbMessageElementObject *self, PyObject *args)
{
struct ldb_message_element *el = pyldb_MessageElement_AsMessageElement(self);
- return PyInt_FromLong(el->flags);
+ return PyLong_FromLong(el->flags);
}
static PyObject *py_ldb_msg_element_set_flags(PyLdbMessageElementObject *self, PyObject *args)
@@ -4204,7 +4203,7 @@ static PyObject *py_string_to_time(PyObject *module, PyObject *args)
if (!PyArg_ParseTuple(args, "s", &str))
return NULL;
- return PyInt_FromLong(ldb_string_to_time(str));
+ return PyLong_FromLong(ldb_string_to_time(str));
}
static PyObject *py_valid_attr_name(PyObject *self, PyObject *args)
diff --git a/lib/tdb/pytdb.c b/lib/tdb/pytdb.c
index d00f3172f71..5ff1ef83117 100644
--- a/lib/tdb/pytdb.c
+++ b/lib/tdb/pytdb.c
@@ -32,7 +32,6 @@
#include <tdb.h>
#if PY_MAJOR_VERSION >= 3
-#define PyInt_FromLong PyLong_FromLong
#define Py_TPFLAGS_HAVE_ITER 0
#endif
@@ -547,7 +546,7 @@ static PyMethodDef tdb_object_methods[] = {
static PyObject *obj_get_hash_size(PyTdbObject *self, void *closure)
{
PyErr_TDB_RAISE_IF_CLOSED(self);
- return PyInt_FromLong(tdb_hash_size(self->ctx));
+ return PyLong_FromLong(tdb_hash_size(self->ctx));
}
static int obj_set_max_dead(PyTdbObject *self, PyObject *max_dead, void *closure)
@@ -562,19 +561,19 @@ static int obj_set_max_dead(PyTdbObject *self, PyObject *max_dead, void *closure
static PyObject *obj_get_map_size(PyTdbObject *self, void *closure)
{
PyErr_TDB_RAISE_IF_CLOSED(self);
- return PyInt_FromLong(tdb_map_size(self->ctx));
+ return PyLong_FromLong(tdb_map_size(self->ctx));
}
static PyObject *obj_get_freelist_size(PyTdbObject *self, void *closure)
{
PyErr_TDB_RAISE_IF_CLOSED(self);
- return PyInt_FromLong(tdb_freelist_size(self->ctx));
+ return PyLong_FromLong(tdb_freelist_size(self->ctx));
}
static PyObject *obj_get_flags(PyTdbObject *self, void *closure)
{
PyErr_TDB_RAISE_IF_CLOSED(self);
- return PyInt_FromLong(tdb_get_flags(self->ctx));
+ return PyLong_FromLong(tdb_get_flags(self->ctx));
}
static PyObject *obj_get_filename(PyTdbObject *self, void *closure)
@@ -586,7 +585,7 @@ static PyObject *obj_get_filename(PyTdbObject *self, void *closure)
static PyObject *obj_get_seqnum(PyTdbObject *self, void *closure)
{
PyErr_TDB_RAISE_IF_CLOSED(self);
- return PyInt_FromLong(tdb_get_seqnum(self->ctx));
+ return PyLong_FromLong(tdb_get_seqnum(self->ctx));
}
static PyObject *obj_get_text(PyTdbObject *self, void *closure)
diff --git a/lib/tevent/pytevent.c b/lib/tevent/pytevent.c
index 73a9bd736e7..dde6bd010c7 100644
--- a/lib/tevent/pytevent.c
+++ b/lib/tevent/pytevent.c
@@ -27,7 +27,7 @@
#include <tevent.h>
#if PY_MAJOR_VERSION >= 3
-#define PyInt_FromLong PyLong_FromLong
+#define PyLong_FromLong PyLong_FromLong
#endif
/* discard signature of 'func' in favour of 'target_sig' */
@@ -709,7 +709,7 @@ static PyTypeObject TeventReq_Type = {
static PyObject *py_tevent_queue_get_length(TeventQueue_Object *self,
PyObject *Py_UNUSED(ignored))
{
- return PyInt_FromLong(tevent_queue_length(self->queue));
+ return PyLong_FromLong(tevent_queue_length(self->queue));
}
static PyGetSetDef py_tevent_queue_getsetters[] = {
diff --git a/libcli/nbt/pynbt.c b/libcli/nbt/pynbt.c
index d9659e898d7..d8a781b5290 100644
--- a/libcli/nbt/pynbt.c
+++ b/libcli/nbt/pynbt.c
@@ -322,7 +322,7 @@ static PyObject *py_nbt_name_register(PyObject *self, PyObject *args, PyObject *
PyTuple_SetItem(ret, 2, PyUnicode_FromString(io.out.reply_addr));
- PyTuple_SetItem(ret, 3, PyInt_FromLong(io.out.rcode));
+ PyTuple_SetItem(ret, 3, PyLong_FromLong(io.out.rcode));
return ret;
}
@@ -378,7 +378,7 @@ static PyObject *py_nbt_name_refresh(PyObject *self, PyObject *args, PyObject *k
PyTuple_SetItem(ret, 2, PyUnicode_FromString(io.out.reply_addr));
- PyTuple_SetItem(ret, 3, PyInt_FromLong(io.out.rcode));
+ PyTuple_SetItem(ret, 3, PyLong_FromLong(io.out.rcode));
return ret;
}
diff --git a/libcli/security/pysecurity.c b/libcli/security/pysecurity.c
index fcef6007d54..9f4aa147c6a 100644
--- a/libcli/security/pysecurity.c
+++ b/libcli/security/pysecurity.c
@@ -65,7 +65,7 @@ static PyObject *py_se_access_check(PyObject *module, PyObject *args, PyObject *
PyErr_NTSTATUS_IS_ERR_RAISE(nt_status);
}
- return PyInt_FromLong(access_granted);
+ return PyLong_FromLong(access_granted);
}
static PyMethodDef py_security_methods[] = {
diff --git a/pidl/lib/Parse/Pidl/Samba4/Python.pm b/pidl/lib/Parse/Pidl/Samba4/Python.pm
index 93ab67f5f3c..12ddd046062 100644
--- a/pidl/lib/Parse/Pidl/Samba4/Python.pm
+++ b/pidl/lib/Parse/Pidl/Samba4/Python.pm
@@ -538,7 +538,7 @@ sub PythonFunctionStruct($$$$)
$self->indent;
$self->pidl("");
$self->pidl("");
- $self->pidl("return PyInt_FromLong($fn->{OPNUM});");
+ $self->pidl("return PyLong_FromLong($fn->{OPNUM});");
$self->deindent;
$self->pidl("}");
$self->pidl("");
@@ -2039,7 +2039,7 @@ sub ConvertScalarToPython($$$$)
}
if ($ctypename =~ /^(char|int|int8|int16|int32|time_t)$/) {
- return "PyInt_FromLong($cvar)";
+ return "PyLong_FromLong($cvar)";
}
# Needed to ensure unsigned values in a 32 or 16 bit enum is
@@ -2051,7 +2051,7 @@ sub ConvertScalarToPython($$$$)
}
if ($ctypename =~ /^(uint|uint8|uint16|uint1632)$/) {
- return "PyInt_FromLong((uint16_t)$cvar)";
+ return "PyLong_FromLong((uint16_t)$cvar)";
}
if ($ctypename eq "DATA_BLOB") {
diff --git a/python/py3compat.h b/python/py3compat.h
index ef20be18090..ea5366a8434 100644
--- a/python/py3compat.h
+++ b/python/py3compat.h
@@ -29,8 +29,6 @@
* "PyBytes_*" work like in Python 3; on Python 2 they are aliased to their
* PyString_* names.
*
- * "PyInt_*" works like PyLong_*
- *
* Syntax for module initialization is as in Python 3, except the entrypoint
* function definition and declaration:
* PyMODINIT_FUNC PyInit_modulename(void);
@@ -70,10 +68,6 @@
(PyUnicode_Check(pystr) || PyBytes_Check(pystr))
-/* Ints */
-
-#define PyInt_FromLong PyLong_FromLong
-
/* Module init */
#define MODULE_INIT_FUNC(name) \
diff --git a/python/pyglue.c b/python/pyglue.c
index 83b968bad8c..ef1419fbd88 100644
--- a/python/pyglue.c
+++ b/python/pyglue.c
@@ -131,7 +131,7 @@ static PyObject *py_nttime2unix(PyObject *self, PyObject *args)
t = nt_time_to_unix(nt);
- return PyInt_FromLong((uint64_t)t);
+ return PyLong_FromLong((uint64_t)t);
}
static PyObject *py_nttime2string(PyObject *self, PyObject *args)
@@ -169,7 +169,7 @@ static PyObject *py_set_debug_level(PyObject *self, PyObject *args)
static PyObject *py_get_debug_level(PyObject *self,
PyObject *Py_UNUSED(ignored))
{
- return PyInt_FromLong(debuglevel_get());
+ return PyLong_FromLong(debuglevel_get());
}
static PyObject *py_fault_setup(PyObject *self,
@@ -314,7 +314,7 @@ static PyObject *py_strcasecmp_m(PyObject *self, PyObject *args)
cmp_result = strcasecmp_m(s1, s2);
PyMem_Free(discard_const_p(char, s1));
PyMem_Free(discard_const_p(char, s2));
- return PyInt_FromLong(cmp_result);
+ return PyLong_FromLong(cmp_result);
}
static PyObject *py_strstr_m(PyObject *self, PyObject *args)
diff --git a/source3/libsmb/pylibsmb.c b/source3/libsmb/pylibsmb.c
index c09df917251..e61ca5c1993 100644
--- a/source3/libsmb/pylibsmb.c
+++ b/source3/libsmb/pylibsmb.c
@@ -682,7 +682,7 @@ static PyObject *py_cli_settimeout(struct py_cli_state *self, PyObject *args)
omsecs = cli_set_timeout(self->cli, nmsecs);
- return PyInt_FromLong(omsecs);
+ return PyLong_FromLong(omsecs);
}
static PyObject *py_cli_create(struct py_cli_state *self, PyObject *args,
@@ -1683,7 +1683,7 @@ MODULE_INIT_FUNC(libsmb_samba_internal)
Py_INCREF(&py_cli_state_type);
PyModule_AddObject(m, "Conn", (PyObject *)&py_cli_state_type);
-#define ADD_FLAGS(val) PyModule_AddObject(m, #val, PyInt_FromLong(val))
+#define ADD_FLAGS(val) PyModule_AddObject(m, #val, PyLong_FromLong(val))
ADD_FLAGS(FILE_ATTRIBUTE_READONLY);
ADD_FLAGS(FILE_ATTRIBUTE_HIDDEN);
diff --git a/source3/passdb/py_passdb.c b/source3/passdb/py_passdb.c
index 0525c44dfaf..6b7d2a0a7b8 100644
--- a/source3/passdb/py_passdb.c
+++ b/source3/passdb/py_passdb.c
@@ -62,7 +62,7 @@ static PyObject *py_samu_get_logon_time(PyObject *obj, void *closure)
struct samu *sam_acct = (struct samu *)pytalloc_get_ptr(obj);
PyObject *py_logon_time;
- py_logon_time = PyInt_FromLong(pdb_get_logon_time(sam_acct));
+ py_logon_time = PyLong_FromLong(pdb_get_logon_time(sam_acct));
talloc_free(frame);
return py_logon_time;
}
@@ -87,7 +87,7 @@ static PyObject *py_samu_get_logoff_time(PyObject *obj, void *closure)
struct samu *sam_acct = (struct samu *)pytalloc_get_ptr(obj);
PyObject *py_logoff_time;
- py_logoff_time = PyInt_FromLong(pdb_get_logoff_time(sam_acct));
+ py_logoff_time = PyLong_FromLong(pdb_get_logoff_time(sam_acct));
talloc_free(frame);
return py_logoff_time;
}
@@ -112,7 +112,7 @@ static PyObject *py_samu_get_kickoff_time(PyObject *obj, void *closure)
struct samu *sam_acct = (struct samu *)pytalloc_get_ptr(obj);
PyObject *py_kickoff_time;
- py_kickoff_time = PyInt_FromLong(pdb_get_kickoff_time(sam_acct));
+ py_kickoff_time = PyLong_FromLong(pdb_get_kickoff_time(sam_acct));
talloc_free(frame);
return py_kickoff_time;
}
@@ -137,7 +137,7 @@ static PyObject *py_samu_get_bad_password_time(PyObject *obj, void *closure)
struct samu *sam_acct = (struct samu *)pytalloc_get_ptr(obj);
PyObject *py_bad_password_time;
- py_bad_password_time = PyInt_FromLong(pdb_get_bad_password_time(sam_acct));
+ py_bad_password_time = PyLong_FromLong(pdb_get_bad_password_time(sam_acct));
talloc_free(frame);
return py_bad_password_time;
}
@@ -162,7 +162,7 @@ static PyObject *py_samu_get_pass_last_set_time(PyObject *obj, void *closure)
struct samu *sam_acct = (struct samu *)pytalloc_get_ptr(obj);
PyObject *py_pass_last_set_time;
- py_pass_last_set_time = PyInt_FromLong(pdb_get_pass_last_set_time(sam_acct));
+ py_pass_last_set_time = PyLong_FromLong(pdb_get_pass_last_set_time(sam_acct));
talloc_free(frame);
return py_pass_last_set_time;
}
@@ -187,7 +187,7 @@ static PyObject *py_samu_get_pass_can_change_time(PyObject *obj, void *closure)
struct samu *sam_acct = (struct samu *)pytalloc_get_ptr(obj);
PyObject *py_pass_can_change_time;
- py_pass_can_change_time = PyInt_FromLong(pdb_get_pass_can_change_time(sam_acct));
+ py_pass_can_change_time = PyLong_FromLong(pdb_get_pass_can_change_time(sam_acct));
talloc_free(frame);
return py_pass_can_change_time;
}
@@ -212,7 +212,7 @@ static PyObject *py_samu_get_pass_must_change_time(PyObject *obj, void *closure)
struct samu *sam_acct = (struct samu *)pytalloc_get_ptr(obj);
PyObject *py_pass_must_change_time;
- py_pass_must_change_time = PyInt_FromLong(pdb_get_pass_must_change_time(sam_acct));
+ py_pass_must_change_time = PyLong_FromLong(pdb_get_pass_must_change_time(sam_acct));
talloc_free(frame);
return py_pass_must_change_time;
}
@@ -819,7 +819,7 @@ static PyObject *py_samu_get_acct_ctrl(PyObject *obj, void *closure)
struct samu *sam_acct = (struct samu *)pytalloc_get_ptr(obj);
PyObject *py_acct_ctrl;
- py_acct_ctrl = PyInt_FromLong(pdb_get_acct_ctrl(sam_acct));
+ py_acct_ctrl = PyLong_FromLong(pdb_get_acct_ctrl(sam_acct));
talloc_free(frame);
return py_acct_ctrl;
}
@@ -844,7 +844,7 @@ static PyObject *py_samu_get_logon_divs(PyObject *obj, void *closure)
struct samu *sam_acct = (struct samu *)pytalloc_get_ptr(obj);
PyObject *py_logon_divs;
- py_logon_divs = PyInt_FromLong(pdb_get_logon_divs(sam_acct));
+ py_logon_divs = PyLong_FromLong(pdb_get_logon_divs(sam_acct));
talloc_free(frame);
return py_logon_divs;
}
@@ -869,7 +869,7 @@ static PyObject *py_samu_get_hours_len(PyObject *obj, void *closure)
struct samu *sam_acct = (struct samu *)pytalloc_get_ptr(obj);
PyObject *py_hours_len;
- py_hours_len = PyInt_FromLong(pdb_get_hours_len(sam_acct));
+ py_hours_len = PyLong_FromLong(pdb_get_hours_len(sam_acct));
talloc_free(frame);
return py_hours_len;
}
@@ -909,7 +909,7 @@ static PyObject *py_samu_get_hours(PyObject *obj, void *closure)
}
for (i=0; i<hours_len; i++) {
- PyList_SetItem(py_hours, i, PyInt_FromLong(hours[i]));
+ PyList_SetItem(py_hours, i, PyLong_FromLong(hours[i]));
}
talloc_free(frame);
return py_hours;
@@ -957,7 +957,7 @@ static PyObject *py_samu_get_bad_password_count(PyObject *obj, void *closure)
struct samu *sam_acct = (struct samu *)pytalloc_get_ptr(obj);
PyObject *py_bad_password_count;
- py_bad_password_count = PyInt_FromLong(pdb_get_bad_password_count(sam_acct));
+ py_bad_password_count = PyLong_FromLong(pdb_get_bad_password_count(sam_acct));
talloc_free(frame);
return py_bad_password_count;
}
@@ -982,7 +982,7 @@ static PyObject *py_samu_get_logon_count(PyObject *obj, void *closure)
struct samu *sam_acct = (struct samu *)pytalloc_get_ptr(obj);
PyObject *py_logon_count;
- py_logon_count = PyInt_FromLong(pdb_get_logon_count(sam_acct));
+ py_logon_count = PyLong_FromLong(pdb_get_logon_count(sam_acct));
talloc_free(frame);
return py_logon_count;
}
@@ -1007,7 +1007,7 @@ static PyObject *py_samu_get_country_code(PyObject *obj, void *closure)
struct samu *sam_acct = (struct samu *)pytalloc_get_ptr(obj);
PyObject *py_country_code;
- py_country_code = PyInt_FromLong(pdb_get_country_code(sam_acct));
+ py_country_code = PyLong_FromLong(pdb_get_country_code(sam_acct));
talloc_free(frame);
return py_country_code;
}
@@ -1032,7 +1032,7 @@ static PyObject *py_samu_get_code_page(PyObject *obj, void *closure)
struct samu *sam_acct = (struct samu *)pytalloc_get_ptr(obj);
PyObject *py_code_page;
- py_code_page = PyInt_FromLong(pdb_get_code_page(sam_acct));
+ py_code_page = PyLong_FromLong(pdb_get_code_page(sam_acct));
talloc_free(frame);
return py_code_page;
}
@@ -1321,7 +1321,7 @@ static PyObject *py_groupmap_get_sid_name_use(PyObject *obj, void *closure)
GROUP_MAP *group_map = (GROUP_MAP *)pytalloc_get_ptr(obj);
PyObject *py_sid_name_use;
- py_sid_name_use = PyInt_FromLong(group_map->sid_name_use);
+ py_sid_name_use = PyLong_FromLong(group_map->sid_name_use);
talloc_free(frame);
return py_sid_name_use;
}
@@ -1631,7 +1631,7 @@ static PyObject *py_pdb_create_user(PyObject *self, PyObject *args)
}
talloc_free(frame);
- return PyInt_FromLong(rid);
+ return PyLong_FromLong(rid);
}
static PyObject *py_pdb_delete_user(PyObject *self, PyObject *args)
@@ -1933,7 +1933,7 @@ static PyObject *py_pdb_create_dom_group(PyObject *self, PyObject *args)
}
talloc_free(frame);
- return PyInt_FromLong(group_rid);
+ return PyLong_FromLong(group_rid);
}
@@ -2330,7 +2330,7 @@ static PyObject *py_pdb_create_alias(PyObject *self, PyObject *args)
}
talloc_free(frame);
- return PyInt_FromLong(rid);
+ return PyLong_FromLong(rid);
}
@@ -3007,7 +3007,7 @@ static PyObject *py_pdb_new_rid(PyObject *self, PyObject *unused)
}
talloc_free(frame);
- return PyInt_FromLong(rid);
+ return PyLong_FromLong(rid);
}
diff --git a/source4/auth/gensec/pygensec.c b/source4/auth/gensec/pygensec.c
index 986f32904e7..a73ca9302dd 100644
--- a/source4/auth/gensec/pygensec.c
+++ b/source4/auth/gensec/pygensec.c
@@ -450,7 +450,7 @@ static PyObject *py_gensec_max_update_size(PyObject *self,
struct gensec_security *security = pytalloc_get_type(self, struct gensec_security);
unsigned int max_update_size = gensec_max_update_size(security);
- return PyInt_FromLong(max_update_size);
+ return PyLong_FromLong(max_update_size);
}
static PyObject *py_gensec_update(PyObject *self, PyObject *args)
@@ -720,14 +720,14 @@ MODULE_INIT_FUNC(gensec)
if (m == NULL)
return NULL;
- PyModule_AddObject(m, "FEATURE_SESSION_KEY", PyInt_FromLong(GENSEC_FEATURE_SESSION_KEY));
- PyModule_AddObject(m, "FEATURE_SIGN", PyInt_FromLong(GENSEC_FEATURE_SIGN));
- PyModule_AddObject(m, "FEATURE_SEAL", PyInt_FromLong(GENSEC_FEATURE_SEAL));
- PyModule_AddObject(m, "FEATURE_DCE_STYLE", PyInt_FromLong(GENSEC_FEATURE_DCE_STYLE));
- PyModule_AddObject(m, "FEATURE_ASYNC_REPLIES", PyInt_FromLong(GENSEC_FEATURE_ASYNC_REPLIES));
- PyModule_AddObject(m, "FEATURE_DATAGRAM_MODE", PyInt_FromLong(GENSEC_FEATURE_DATAGRAM_MODE));
- PyModule_AddObject(m, "FEATURE_SIGN_PKT_HEADER", PyInt_FromLong(GENSEC_FEATURE_SIGN_PKT_HEADER));
- PyModule_AddObject(m, "FEATURE_NEW_SPNEGO", PyInt_FromLong(GENSEC_FEATURE_NEW_SPNEGO));
+ PyModule_AddObject(m, "FEATURE_SESSION_KEY", PyLong_FromLong(GENSEC_FEATURE_SESSION_KEY));
+ PyModule_AddObject(m, "FEATURE_SIGN", PyLong_FromLong(GENSEC_FEATURE_SIGN));
+ PyModule_AddObject(m, "FEATURE_SEAL", PyLong_FromLong(GENSEC_FEATURE_SEAL));
+ PyModule_AddObject(m, "FEATURE_DCE_STYLE", PyLong_FromLong(GENSEC_FEATURE_DCE_STYLE));
+ PyModule_AddObject(m, "FEATURE_ASYNC_REPLIES", PyLong_FromLong(GENSEC_FEATURE_ASYNC_REPLIES));
+ PyModule_AddObject(m, "FEATURE_DATAGRAM_MODE", PyLong_FromLong(GENSEC_FEATURE_DATAGRAM_MODE));
+ PyModule_AddObject(m, "FEATURE_SIGN_PKT_HEADER", PyLong_FromLong(GENSEC_FEATURE_SIGN_PKT_HEADER));
+ PyModule_AddObject(m, "FEATURE_NEW_SPNEGO", PyLong_FromLong(GENSEC_FEATURE_NEW_SPNEGO));
Py_INCREF(&Py_Security);
PyModule_AddObject(m, "Security", (PyObject *)&Py_Security);
diff --git a/source4/dsdb/pydsdb.c b/source4/dsdb/pydsdb.c
index f173a355997..fd25347c229 100644
--- a/source4/dsdb/pydsdb.c
+++ b/source4/dsdb/pydsdb.c
@@ -366,7 +366,7 @@ static PyObject *py_dsdb_get_systemFlags_from_lDAPDisplayName(PyObject *self, Py
return NULL;
}
- return PyInt_FromLong(attribute->systemFlags);
+ return PyLong_FromLong(attribute->systemFlags);
}
/*
@@ -398,7 +398,7 @@ static PyObject *py_dsdb_get_linkId_from_lDAPDisplayName(PyObject *self, PyObjec
return NULL;
}
- return PyInt_FromLong(attribute->linkID);
+ return PyLong_FromLong(attribute->linkID);
}
/*
@@ -1164,7 +1164,7 @@ static PyObject *py_dsdb_allocate_rid(PyObject *self, PyObject *args)
TALLOC_FREE(rid_return);
TALLOC_FREE(ext_res);
- return PyInt_FromLong(rid);
+ return PyLong_FromLong(rid);
}
static PyObject *py_dns_delete_tombstones(PyObject *self, PyObject *args)
@@ -1499,7 +1499,7 @@ MODULE_INIT_FUNC(dsdb)
if (m == NULL)
return NULL;
-#define ADD_DSDB_FLAG(val) PyModule_AddObject(m, #val, PyInt_FromLong(val))
+#define ADD_DSDB_FLAG(val) PyModule_AddObject(m, #val, PyLong_FromLong(val))
/* "userAccountControl" flags */
ADD_DSDB_FLAG(UF_NORMAL_ACCOUNT);
diff --git a/source4/lib/messaging/pymessaging.c b/source4/lib/messaging/pymessaging.c
index e6b9c770dfd..148c941a3a2 100644
--- a/source4/lib/messaging/pymessaging.c
+++ b/source4/lib/messaging/pymessaging.c
@@ -544,8 +544,8 @@ MODULE_INIT_FUNC(messaging)
Py_INCREF((PyObject *)&imessaging_Type);
PyModule_AddObject(mod, "Messaging", (PyObject *)&imessaging_Type);
- PyModule_AddObject(mod, "IRPC_CALL_TIMEOUT", PyInt_FromLong(IRPC_CALL_TIMEOUT));
- PyModule_AddObject(mod, "IRPC_CALL_TIMEOUT_INF", PyInt_FromLong(IRPC_CALL_TIMEOUT_INF));
+ PyModule_AddObject(mod, "IRPC_CALL_TIMEOUT", PyLong_FromLong(IRPC_CALL_TIMEOUT));
+ PyModule_AddObject(mod, "IRPC_CALL_TIMEOUT_INF", PyLong_FromLong(IRPC_CALL_TIMEOUT_INF));
return mod;
}
diff --git a/source4/lib/policy/pypolicy.c b/source4/lib/policy/pypolicy.c
index 038fa0428c3..ca25d190134 100644
--- a/source4/lib/policy/pypolicy.c
+++ b/source4/lib/policy/pypolicy.c
@@ -163,12 +163,12 @@ MODULE_INIT_FUNC(policy)
return m;
PyModule_AddObject(m, "GPO_FLAG_USER_DISABLE",
- PyInt_FromLong(GPO_FLAG_USER_DISABLE));
+ PyLong_FromLong(GPO_FLAG_USER_DISABLE));
PyModule_AddObject(m, "GPO_MACHINE_USER_DISABLE",
- PyInt_FromLong(GPO_FLAG_MACHINE_DISABLE));
+ PyLong_FromLong(GPO_FLAG_MACHINE_DISABLE));
PyModule_AddObject(m, "GPLINK_OPT_DISABLE",
- PyInt_FromLong(GPLINK_OPT_DISABLE ));
+ PyLong_FromLong(GPLINK_OPT_DISABLE ));
PyModule_AddObject(m, "GPLINK_OPT_ENFORCE ",
- PyInt_FromLong(GPLINK_OPT_ENFORCE ));
+ PyLong_FromLong(GPLINK_OPT_ENFORCE ));
return m;
}
diff --git a/source4/lib/registry/pyregistry.c b/source4/lib/registry/pyregistry.c
index 5b02a79787d..b08cf4f09e7 100644
--- a/source4/lib/registry/pyregistry.c
+++ b/source4/lib/registry/pyregistry.c
@@ -471,15 +471,15 @@ MODULE_INIT_FUNC(registry)
if (m == NULL)
return NULL;
- PyModule_AddObject(m, "HKEY_CLASSES_ROOT", PyInt_FromLong(HKEY_CLASSES_ROOT));
- PyModule_AddObject(m, "HKEY_CURRENT_USER", PyInt_FromLong(HKEY_CURRENT_USER));
- PyModule_AddObject(m, "HKEY_LOCAL_MACHINE", PyInt_FromLong(HKEY_LOCAL_MACHINE));
- PyModule_AddObject(m, "HKEY_USERS", PyInt_FromLong(HKEY_USERS));
- PyModule_AddObject(m, "HKEY_PERFORMANCE_DATA", PyInt_FromLong(HKEY_PERFORMANCE_DATA));
- PyModule_AddObject(m, "HKEY_CURRENT_CONFIG", PyInt_FromLong(HKEY_CURRENT_CONFIG));
- PyModule_AddObject(m, "HKEY_DYN_DATA", PyInt_FromLong(HKEY_DYN_DATA));
- PyModule_AddObject(m, "HKEY_PERFORMANCE_TEXT", PyInt_FromLong(HKEY_PERFORMANCE_TEXT));
- PyModule_AddObject(m, "HKEY_PERFORMANCE_NLSTEXT", PyInt_FromLong(HKEY_PERFORMANCE_NLSTEXT));
+ PyModule_AddObject(m, "HKEY_CLASSES_ROOT", PyLong_FromLong(HKEY_CLASSES_ROOT));
+ PyModule_AddObject(m, "HKEY_CURRENT_USER", PyLong_FromLong(HKEY_CURRENT_USER));
+ PyModule_AddObject(m, "HKEY_LOCAL_MACHINE", PyLong_FromLong(HKEY_LOCAL_MACHINE));
+ PyModule_AddObject(m, "HKEY_USERS", PyLong_FromLong(HKEY_USERS));
+ PyModule_AddObject(m, "HKEY_PERFORMANCE_DATA", PyLong_FromLong(HKEY_PERFORMANCE_DATA));
+ PyModule_AddObject(m, "HKEY_CURRENT_CONFIG", PyLong_FromLong(HKEY_CURRENT_CONFIG));
+ PyModule_AddObject(m, "HKEY_DYN_DATA", PyLong_FromLong(HKEY_DYN_DATA));
+ PyModule_AddObject(m, "HKEY_PERFORMANCE_TEXT", PyLong_FromLong(HKEY_PERFORMANCE_TEXT));
+ PyModule_AddObject(m, "HKEY_PERFORMANCE_NLSTEXT", PyLong_FromLong(HKEY_PERFORMANCE_NLSTEXT));
Py_INCREF(&PyRegistry);
PyModule_AddObject(m, "Registry", (PyObject *)&PyRegistry);
diff --git a/source4/lib/wmi/wmi_wrap.c b/source4/lib/wmi/wmi_wrap.c
index 6732f4ed5cb..f8200bac92a 100644
--- a/source4/lib/wmi/wmi_wrap.c
+++ b/source4/lib/wmi/wmi_wrap.c
@@ -2803,14 +2803,14 @@ SWIG_AsVal_unsigned_SS_int (PyObject * obj, unsigned int *val)
}
- #define SWIG_From_long PyInt_FromLong
+ #define SWIG_From_long PyLong_FromLong
SWIGINTERNINLINE PyObject*
SWIG_From_unsigned_SS_long (unsigned long value)
{
return (value > LONG_MAX) ?
- PyLong_FromUnsignedLong(value) : PyInt_FromLong((long)(value));
+ PyLong_FromUnsignedLong(value) : PyLong_FromLong((long)(value));
}
diff --git a/source4/librpc/ndr/py_security.c b/source4/librpc/ndr/py_security.c
index 26989c1a433..19bfdd56559 100644
--- a/source4/librpc/ndr/py_security.c
+++ b/source4/librpc/ndr/py_security.c
@@ -456,7 +456,7 @@ static PyObject *py_privilege_id(PyObject *self, PyObject *args)
if (!PyArg_ParseTuple(args, "s", &name))
return NULL;
- return PyInt_FromLong(sec_privilege_id(name));
+ return PyLong_FromLong(sec_privilege_id(name));
}
static PyObject *py_random_sid(PyObject *self,
diff --git a/source4/param/provision.c b/source4/param/provision.c
index 93d00d84495..e0b7c690e07 100644
--- a/source4/param/provision.c
+++ b/source4/param/provision.c
@@ -253,14 +253,14 @@ NTSTATUS provision_bare(TALLOC_CTX *mem_ctx, struct loadparm_context *lp_ctx,
if (!dict_insert(parameters,
"debuglevel",
- PyInt_FromLong(DEBUGLEVEL))) {
+ PyLong_FromLong(DEBUGLEVEL))) {
status = NT_STATUS_UNSUCCESSFUL;
goto out;
}
if (!dict_insert(parameters,
"use_ntvfs",
- PyInt_FromLong(settings->use_ntvfs))) {
+ PyLong_FromLong(settings->use_ntvfs))) {
status = NT_STATUS_UNSUCCESSFUL;
goto out;
}
@@ -441,14 +441,14 @@ NTSTATUS provision_store_self_join(TALLOC_CTX *mem_ctx, struct loadparm_context
if (!dict_insert(parameters,
"secure_channel_type",
- PyInt_FromLong(settings->secure_channel_type))) {
+ PyLong_FromLong(settings->secure_channel_type))) {
status = NT_STATUS_UNSUCCESSFUL;
goto out;
}
if (!dict_insert(parameters,
"key_version_number",
- PyInt_FromLong(settings->key_version_number))) {
+ PyLong_FromLong(settings->key_version_number))) {
status = NT_STATUS_UNSUCCESSFUL;
goto out;
}
diff --git a/source4/param/pyparam.c b/source4/param/pyparam.c
index a251b024ebb..63da7d64242 100644
--- a/source4/param/pyparam.c
+++ b/source4/param/pyparam.c
@@ -348,7 +348,7 @@ static PyObject *py_lp_dump_a_parameter(PyObject *self, PyObject *args)
static PyObject *py_lp_log_level(PyObject *self, PyObject *unused)
{
int ret = debuglevel_get();
- return PyInt_FromLong(ret);
+ return PyLong_FromLong(ret);
}