py3: Remove PyStr_Type() compatability macro
authorAndrew Bartlett <abartlet@samba.org>
Fri, 7 Jun 2019 08:27:34 +0000 (10:27 +0200)
committerNoel Power <npower@samba.org>
Mon, 24 Jun 2019 17:24:26 +0000 (17:24 +0000)
We no longer need Samba to be py2/py3 compatible so we choose to return to the standard
function names.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Noel Power <noel.power@suse.com>
python/py3compat.h
source3/passdb/py_passdb.c

index a131cbef3682014de0b8e316ff24146913b6ffbf..a66e940001d148dbe5909ff2fef0252c196505d5 100644 (file)
@@ -54,7 +54,6 @@
 
 /* Strings */
 
-#define PyStr_Type PyUnicode_Type
 #define PyStr_Check PyUnicode_Check
 #define PyStr_FromString PyUnicode_FromString
 #define PyStr_FromStringAndSize PyUnicode_FromStringAndSize
index 30273141eb7e94f70428c5e27bbc16d91f0c7c0f..aa5458211e1f9e93f86261f11e0edf589791e9ba 100644 (file)
@@ -249,7 +249,7 @@ static int py_samu_set_username(PyObject *obj, PyObject *value, void *closure)
        TALLOC_CTX *frame = talloc_stackframe();
        struct samu *sam_acct = (struct samu *)pytalloc_get_ptr(obj);
 
-       PY_CHECK_TYPE(&PyStr_Type, value, return -1;);
+       PY_CHECK_TYPE(&PyUnicode_Type, value, return -1;);
        if (!pdb_set_username(sam_acct, PyStr_AsString(value), PDB_CHANGED)) {
                talloc_free(frame);
                return -1;
@@ -280,7 +280,7 @@ static int py_samu_set_domain(PyObject *obj, PyObject *value, void *closure)
        TALLOC_CTX *frame = talloc_stackframe();
        struct samu *sam_acct = (struct samu *)pytalloc_get_ptr(obj);
 
-       PY_CHECK_TYPE(&PyStr_Type, value, return -1;);
+       PY_CHECK_TYPE(&PyUnicode_Type, value, return -1;);
        if (!pdb_set_domain(sam_acct, PyStr_AsString(value), PDB_CHANGED)) {
                talloc_free(frame);
                return -1;
@@ -311,7 +311,7 @@ static int py_samu_set_nt_username(PyObject *obj, PyObject *value, void *closure
        TALLOC_CTX *frame = talloc_stackframe();
        struct samu *sam_acct = (struct samu *)pytalloc_get_ptr(obj);
 
-       PY_CHECK_TYPE(&PyStr_Type, value, return -1;);
+       PY_CHECK_TYPE(&PyUnicode_Type, value, return -1;);
        if (!pdb_set_nt_username(sam_acct, PyStr_AsString(value), PDB_CHANGED)) {
                talloc_free(frame);
                return -1;
@@ -342,7 +342,7 @@ static int py_samu_set_full_name(PyObject *obj, PyObject *value, void *closure)
        TALLOC_CTX *frame = talloc_stackframe();
        struct samu *sam_acct = (struct samu *)pytalloc_get_ptr(obj);
 
-       PY_CHECK_TYPE(&PyStr_Type, value, return -1;);
+       PY_CHECK_TYPE(&PyUnicode_Type, value, return -1;);
        if (!pdb_set_fullname(sam_acct, PyStr_AsString(value), PDB_CHANGED)) {
                talloc_free(frame);
                return -1;
@@ -373,7 +373,7 @@ static int py_samu_set_home_dir(PyObject *obj, PyObject *value, void *closure)
        TALLOC_CTX *frame = talloc_stackframe();
        struct samu *sam_acct = (struct samu *)pytalloc_get_ptr(obj);
 
-       PY_CHECK_TYPE(&PyStr_Type, value, return -1;);
+       PY_CHECK_TYPE(&PyUnicode_Type, value, return -1;);
        if (!pdb_set_homedir(sam_acct, PyStr_AsString(value), PDB_CHANGED)) {
                talloc_free(frame);
                return -1;
@@ -404,7 +404,7 @@ static int py_samu_set_dir_drive(PyObject *obj, PyObject *value, void *closure)
        TALLOC_CTX *frame = talloc_stackframe();
        struct samu *sam_acct = (struct samu *)pytalloc_get_ptr(obj);
 
-       PY_CHECK_TYPE(&PyStr_Type, value, return -1;);
+       PY_CHECK_TYPE(&PyUnicode_Type, value, return -1;);
        if (!pdb_set_dir_drive(sam_acct, PyStr_AsString(value), PDB_CHANGED)) {
                talloc_free(frame);
                return -1;
@@ -435,7 +435,7 @@ static int py_samu_set_logon_script(PyObject *obj, PyObject *value, void *closur
        TALLOC_CTX *frame = talloc_stackframe();
        struct samu *sam_acct = (struct samu *)pytalloc_get_ptr(obj);
 
-       PY_CHECK_TYPE(&PyStr_Type, value, return -1;);
+       PY_CHECK_TYPE(&PyUnicode_Type, value, return -1;);
        if (!pdb_set_logon_script(sam_acct, PyStr_AsString(value), PDB_CHANGED)) {
                talloc_free(frame);
                return -1;
@@ -466,7 +466,7 @@ static int py_samu_set_profile_path(PyObject *obj, PyObject *value, void *closur
        TALLOC_CTX *frame = talloc_stackframe();
        struct samu *sam_acct = (struct samu *)pytalloc_get_ptr(obj);
 
-       PY_CHECK_TYPE(&PyStr_Type, value, return -1;);
+       PY_CHECK_TYPE(&PyUnicode_Type, value, return -1;);
        if (!pdb_set_profile_path(sam_acct, PyStr_AsString(value), PDB_CHANGED)) {
                talloc_free(frame);
                return -1;
@@ -497,7 +497,7 @@ static int py_samu_set_acct_desc(PyObject *obj, PyObject *value, void *closure)
        TALLOC_CTX *frame = talloc_stackframe();
        struct samu *sam_acct = (struct samu *)pytalloc_get_ptr(obj);
 
-       PY_CHECK_TYPE(&PyStr_Type, value, return -1;);
+       PY_CHECK_TYPE(&PyUnicode_Type, value, return -1;);
        if (!pdb_set_acct_desc(sam_acct, PyStr_AsString(value), PDB_CHANGED)) {
                talloc_free(frame);
                return -1;
@@ -528,7 +528,7 @@ static int py_samu_set_workstations(PyObject *obj, PyObject *value, void *closur
        TALLOC_CTX *frame = talloc_stackframe();
        struct samu *sam_acct = (struct samu *)pytalloc_get_ptr(obj);
 
-       PY_CHECK_TYPE(&PyStr_Type, value, return -1;);
+       PY_CHECK_TYPE(&PyUnicode_Type, value, return -1;);
        if (!pdb_set_workstations(sam_acct, PyStr_AsString(value), PDB_CHANGED)) {
                talloc_free(frame);
                return -1;
@@ -559,7 +559,7 @@ static int py_samu_set_comment(PyObject *obj, PyObject *value, void *closure)
        TALLOC_CTX *frame = talloc_stackframe();
        struct samu *sam_acct = (struct samu *)pytalloc_get_ptr(obj);
 
-       PY_CHECK_TYPE(&PyStr_Type, value, return -1;);
+       PY_CHECK_TYPE(&PyUnicode_Type, value, return -1;);
        if (!pdb_set_comment(sam_acct, PyStr_AsString(value), PDB_CHANGED)) {
                talloc_free(frame);
                return -1;
@@ -590,7 +590,7 @@ static int py_samu_set_munged_dial(PyObject *obj, PyObject *value, void *closure
        TALLOC_CTX *frame = talloc_stackframe();
        struct samu *sam_acct = (struct samu *)pytalloc_get_ptr(obj);
 
-       PY_CHECK_TYPE(&PyStr_Type, value, return -1;);
+       PY_CHECK_TYPE(&PyUnicode_Type, value, return -1;);
        if (!pdb_set_munged_dial(sam_acct, PyStr_AsString(value), PDB_CHANGED)) {
                talloc_free(frame);
                return -1;
@@ -1357,7 +1357,7 @@ static int py_groupmap_set_nt_name(PyObject *obj, PyObject *value, void *closure
        TALLOC_CTX *frame = talloc_stackframe();
        GROUP_MAP *group_map = (GROUP_MAP *)pytalloc_get_ptr(obj);
 
-       PY_CHECK_TYPE(&PyStr_Type, value, return -1;);
+       PY_CHECK_TYPE(&PyUnicode_Type, value, return -1;);
        if (value == Py_None) {
                fstrcpy(group_map->nt_name, NULL);
        } else {
@@ -1387,7 +1387,7 @@ static int py_groupmap_set_comment(PyObject *obj, PyObject *value, void *closure
        TALLOC_CTX *frame = talloc_stackframe();
        GROUP_MAP *group_map = (GROUP_MAP *)pytalloc_get_ptr(obj);
 
-       PY_CHECK_TYPE(&PyStr_Type, value, return -1;);
+       PY_CHECK_TYPE(&PyUnicode_Type, value, return -1;);
        if (value == Py_None) {
                fstrcpy(group_map->comment, NULL);
        } else {