diff options
author | Andrew Bartlett <abartlet@samba.org> | 2019-06-07 10:45:52 +0200 |
---|---|---|
committer | Noel Power <npower@samba.org> | 2019-06-24 17:24:27 +0000 |
commit | 34f9a089d8d3a8971b2f7ee45f6d8e823a52a193 (patch) | |
tree | e82a39e5c36f4c9fc1ec7074f82ead6d9221315a /source4/param | |
parent | f498c819664e9df658651d39f616f5b4d62b4750 (diff) | |
download | samba-34f9a089d8d3a8971b2f7ee45f6d8e823a52a193.tar.gz |
py3: Remove PyStr_FromString() compatability macro
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>
Diffstat (limited to 'source4/param')
-rw-r--r-- | source4/param/provision.c | 42 | ||||
-rw-r--r-- | source4/param/pyparam.c | 32 |
2 files changed, 37 insertions, 37 deletions
diff --git a/source4/param/provision.c b/source4/param/provision.c index 85671f80b87..177fb93f18c 100644 --- a/source4/param/provision.c +++ b/source4/param/provision.c @@ -45,7 +45,7 @@ static bool dict_insert(PyObject* dict, static PyObject *provision_module(void) { - PyObject *name = PyStr_FromString("samba.provision"); + PyObject *name = PyUnicode_FromString("samba.provision"); PyObject *mod = NULL; if (name == NULL) return NULL; @@ -56,7 +56,7 @@ static PyObject *provision_module(void) static PyObject *schema_module(void) { - PyObject *name = PyStr_FromString("samba.schema"); + PyObject *name = PyUnicode_FromString("samba.schema"); PyObject *mod = NULL; if (name == NULL) return NULL; @@ -67,7 +67,7 @@ static PyObject *schema_module(void) static PyObject *ldb_module(void) { - PyObject *name = PyStr_FromString("ldb"); + PyObject *name = PyUnicode_FromString("ldb"); PyObject *mod = NULL; if (name == NULL) return NULL; @@ -152,7 +152,7 @@ NTSTATUS provision_bare(TALLOC_CTX *mem_ctx, struct loadparm_context *lp_ctx, configfile = lpcfg_configfile(lp_ctx); if (configfile != NULL) { if (!dict_insert(parameters, "smbconf", - PyStr_FromString(configfile))) { + PyUnicode_FromString(configfile))) { status = NT_STATUS_UNSUCCESSFUL; goto out; } @@ -160,40 +160,40 @@ NTSTATUS provision_bare(TALLOC_CTX *mem_ctx, struct loadparm_context *lp_ctx, if (!dict_insert(parameters, "rootdn", - PyStr_FromString(settings->root_dn_str))) { + PyUnicode_FromString(settings->root_dn_str))) { status = NT_STATUS_UNSUCCESSFUL; goto out; } if (settings->targetdir != NULL) { if (!dict_insert(parameters, "targetdir", - PyStr_FromString(settings->targetdir))) { + PyUnicode_FromString(settings->targetdir))) { status = NT_STATUS_UNSUCCESSFUL; goto out; } } if (!dict_insert(parameters, "hostname", - PyStr_FromString(settings->netbios_name))) { + PyUnicode_FromString(settings->netbios_name))) { status = NT_STATUS_UNSUCCESSFUL; goto out; } if (!dict_insert(parameters, "domain", - PyStr_FromString(settings->domain))) { + PyUnicode_FromString(settings->domain))) { status = NT_STATUS_UNSUCCESSFUL; goto out; } if (!dict_insert(parameters, "realm", - PyStr_FromString(settings->realm))) { + PyUnicode_FromString(settings->realm))) { status = NT_STATUS_UNSUCCESSFUL; goto out; } if (settings->root_dn_str) { if (!dict_insert(parameters, "rootdn", - PyStr_FromString(settings->root_dn_str))) { + PyUnicode_FromString(settings->root_dn_str))) { status = NT_STATUS_UNSUCCESSFUL; goto out; } @@ -202,7 +202,7 @@ NTSTATUS provision_bare(TALLOC_CTX *mem_ctx, struct loadparm_context *lp_ctx, if (settings->domain_dn_str) { if (!dict_insert(parameters, "domaindn", - PyStr_FromString(settings->domain_dn_str))) { + PyUnicode_FromString(settings->domain_dn_str))) { status = NT_STATUS_UNSUCCESSFUL; goto out; } @@ -211,7 +211,7 @@ NTSTATUS provision_bare(TALLOC_CTX *mem_ctx, struct loadparm_context *lp_ctx, if (settings->schema_dn_str) { if (!dict_insert(parameters, "schemadn", - PyStr_FromString(settings->schema_dn_str))) { + PyUnicode_FromString(settings->schema_dn_str))) { status = NT_STATUS_UNSUCCESSFUL; goto out; } @@ -219,7 +219,7 @@ NTSTATUS provision_bare(TALLOC_CTX *mem_ctx, struct loadparm_context *lp_ctx, if (settings->config_dn_str) { if (!dict_insert(parameters, "configdn", - PyStr_FromString(settings->config_dn_str))) { + PyUnicode_FromString(settings->config_dn_str))) { status = NT_STATUS_UNSUCCESSFUL; goto out; } @@ -227,7 +227,7 @@ NTSTATUS provision_bare(TALLOC_CTX *mem_ctx, struct loadparm_context *lp_ctx, if (settings->server_dn_str) { if (!dict_insert(parameters, "serverdn", - PyStr_FromString(settings->server_dn_str))) { + PyUnicode_FromString(settings->server_dn_str))) { status = NT_STATUS_UNSUCCESSFUL; goto out; } @@ -235,7 +235,7 @@ NTSTATUS provision_bare(TALLOC_CTX *mem_ctx, struct loadparm_context *lp_ctx, if (settings->site_name) { if (!dict_insert(parameters, "sitename", - PyStr_FromString(settings->site_name))) { + PyUnicode_FromString(settings->site_name))) { status = NT_STATUS_UNSUCCESSFUL; goto out; } @@ -243,7 +243,7 @@ NTSTATUS provision_bare(TALLOC_CTX *mem_ctx, struct loadparm_context *lp_ctx, if (!dict_insert(parameters, "machinepass", - PyStr_FromString(settings->machine_password))){ + PyUnicode_FromString(settings->machine_password))){ status = NT_STATUS_UNSUCCESSFUL; goto out; } @@ -403,27 +403,27 @@ NTSTATUS provision_store_self_join(TALLOC_CTX *mem_ctx, struct loadparm_context } if (!dict_insert(parameters, "domain", - PyStr_FromString(settings->domain_name))) { + PyUnicode_FromString(settings->domain_name))) { status = NT_STATUS_UNSUCCESSFUL; goto out; } if (settings->realm != NULL) { if (!dict_insert(parameters, "realm", - PyStr_FromString(settings->realm))) { + PyUnicode_FromString(settings->realm))) { status = NT_STATUS_UNSUCCESSFUL; goto out; } } if (!dict_insert(parameters, "machinepass", - PyStr_FromString(settings->machine_password))) { + PyUnicode_FromString(settings->machine_password))) { status = NT_STATUS_UNSUCCESSFUL; goto out; } if (!dict_insert(parameters, "netbiosname", - PyStr_FromString(settings->netbios_name))) { + PyUnicode_FromString(settings->netbios_name))) { status = NT_STATUS_UNSUCCESSFUL; goto out; } @@ -527,7 +527,7 @@ struct ldb_context *provision_get_schema(TALLOC_CTX *mem_ctx, if (schema_dn) { if (!dict_insert(parameters, "schemadn", - PyStr_FromString(schema_dn))) { + PyUnicode_FromString(schema_dn))) { return NULL; } } diff --git a/source4/param/pyparam.c b/source4/param/pyparam.c index df0879a3c71..cf7423ddec3 100644 --- a/source4/param/pyparam.c +++ b/source4/param/pyparam.c @@ -63,7 +63,7 @@ static PyObject *py_lp_ctx_get_helper(struct loadparm_context *lp_ctx, const cha if (value == NULL) { return NULL; } - return PyStr_FromString(value); + return PyUnicode_FromString(value); } parm = lpcfg_parm_struct(lp_ctx, param_name); @@ -83,7 +83,7 @@ static PyObject *py_lp_ctx_get_helper(struct loadparm_context *lp_ctx, const cha value = lpcfg_get_parametric(lp_ctx, NULL, type, option); if (value == NULL) return NULL; - return PyStr_FromString(value); + return PyUnicode_FromString(value); } else { /* its a global parameter */ parm = lpcfg_parm_struct(lp_ctx, param_name); @@ -103,7 +103,7 @@ static PyObject *py_lp_ctx_get_helper(struct loadparm_context *lp_ctx, const cha return PyStr_FromFormat("%c", *(char *)parm_ptr); case P_STRING: case P_USTRING: - return PyStr_FromString(*(char **)parm_ptr); + return PyUnicode_FromString(*(char **)parm_ptr); case P_BOOL: return PyBool_FromLong(*(bool *)parm_ptr); case P_BOOLREV: @@ -115,7 +115,7 @@ static PyObject *py_lp_ctx_get_helper(struct loadparm_context *lp_ctx, const cha case P_ENUM: for (i=0; parm->enum_list[i].name; i++) { if (*(int *)parm_ptr == parm->enum_list[i].value) { - return PyStr_FromString(parm->enum_list[i].name); + return PyUnicode_FromString(parm->enum_list[i].name); } } return NULL; @@ -133,7 +133,7 @@ static PyObject *py_lp_ctx_get_helper(struct loadparm_context *lp_ctx, const cha pylist = PyList_New(str_list_length(strlist)); for (j = 0; strlist[j]; j++) PyList_SetItem(pylist, j, - PyStr_FromString(strlist[j])); + PyUnicode_FromString(strlist[j])); return pylist; } } @@ -225,7 +225,7 @@ static PyObject *py_lp_ctx_private_path(PyObject *self, PyObject *args) return NULL; path = lpcfg_private_path(NULL, PyLoadparmContext_AsLoadparmContext(self), name); - ret = PyStr_FromString(path); + ret = PyUnicode_FromString(path); talloc_free(path); return ret; @@ -240,7 +240,7 @@ static PyObject *py_lp_ctx_services(PyObject *self, PyObject *unused) for (i = 0; i < lpcfg_numservices(lp_ctx); i++) { struct loadparm_service *service = lpcfg_servicebynum(lp_ctx, i); if (service != NULL) { - PyList_SetItem(ret, i, PyStr_FromString(lpcfg_servicename(service))); + PyList_SetItem(ret, i, PyUnicode_FromString(lpcfg_servicename(service))); } } return ret; @@ -255,7 +255,7 @@ static PyObject *py_lp_ctx_server_role(PyObject *self, PyObject *unused) role = lpcfg_server_role(lp_ctx); role_str = server_role_str(role); - return PyStr_FromString(role_str); + return PyUnicode_FromString(role_str); } static PyObject *py_lp_dump(PyObject *self, PyObject *args) @@ -375,7 +375,7 @@ static PyObject *py_cache_path(PyObject *self, PyObject *args) "Unable to access cache %s", name); return NULL; } - ret = PyStr_FromString(path); + ret = PyUnicode_FromString(path); talloc_free(path); return ret; @@ -399,7 +399,7 @@ static PyObject *py_state_path(PyObject *self, PyObject *args) "Unable to access cache %s", name); return NULL; } - ret = PyStr_FromString(path); + ret = PyUnicode_FromString(path); talloc_free(path); return ret; @@ -460,7 +460,7 @@ static PyObject *py_lp_ctx_config_file(PyObject *self, void *closure) if (configfile == NULL) Py_RETURN_NONE; else - return PyStr_FromString(configfile); + return PyUnicode_FromString(configfile); } static PyGetSetDef py_lp_ctx_getset[] = { @@ -616,27 +616,27 @@ PyTypeObject PyLoadparmService = { static PyObject *py_default_path(PyObject *self, PyObject *Py_UNUSED(ignored)) { - return PyStr_FromString(lp_default_path()); + return PyUnicode_FromString(lp_default_path()); } static PyObject *py_setup_dir(PyObject *self, PyObject *Py_UNUSED(ignored)) { - return PyStr_FromString(dyn_SETUPDIR); + return PyUnicode_FromString(dyn_SETUPDIR); } static PyObject *py_modules_dir(PyObject *self, PyObject *Py_UNUSED(ignored)) { - return PyStr_FromString(dyn_MODULESDIR); + return PyUnicode_FromString(dyn_MODULESDIR); } static PyObject *py_bin_dir(PyObject *self, PyObject *Py_UNUSED(ignored)) { - return PyStr_FromString(dyn_BINDIR); + return PyUnicode_FromString(dyn_BINDIR); } static PyObject *py_sbin_dir(PyObject *self, PyObject *Py_UNUSED(ignored)) { - return PyStr_FromString(dyn_SBINDIR); + return PyUnicode_FromString(dyn_SBINDIR); } static PyMethodDef pyparam_methods[] = { |