[pygobject/py3k: 7/20] Use _PyUnicode or _PyByteArray macros
- From: John Ehresman <jpe src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pygobject/py3k: 7/20] Use _PyUnicode or _PyByteArray macros
- Date: Thu, 15 Apr 2010 17:49:36 +0000 (UTC)
commit 7611526f31237ce16d2509b7115d83000aa8b080
Author: John Ehresman <jpe wingware com>
Date: Tue Apr 13 11:48:24 2010 -0400
Use _PyUnicode or _PyByteArray macros
gio/gappinfo.override | 2 +-
gio/gapplaunchcontext.override | 4 ++--
gio/gdatainputstream.override | 8 ++++----
gio/gdrive.override | 2 +-
gio/gfile.override | 6 +++---
gio/gfileattribute.override | 2 +-
gio/gfileinfo.override | 2 +-
gio/gicon.override | 14 +++++++-------
gio/ginputstream.override | 20 ++++++++++----------
gio/gio.override | 6 +++---
10 files changed, 33 insertions(+), 33 deletions(-)
---
diff --git a/gio/gappinfo.override b/gio/gappinfo.override
index ddfd28d..81caf8e 100644
--- a/gio/gappinfo.override
+++ b/gio/gappinfo.override
@@ -202,7 +202,7 @@ _wrap_g_app_info_tp_repr(PyGObject *self)
Py_TYPE(self)->tp_name, self,
name ? name : "UNKNOWN NAME");
- result = PyString_FromString(representation);
+ result = _PyUnicode_FromString(representation);
g_free(representation);
return result;
}
diff --git a/gio/gapplaunchcontext.override b/gio/gapplaunchcontext.override
index a10f959..2e30702 100644
--- a/gio/gapplaunchcontext.override
+++ b/gio/gapplaunchcontext.override
@@ -53,7 +53,7 @@ _wrap_g_app_launch_context_get_display(PyGObject *self,
g_list_free(file_list);
if (ret)
- return PyString_FromString(ret);
+ return _PyUnicode_FromString(ret);
Py_INCREF(Py_None);
return Py_None;
@@ -92,7 +92,7 @@ _wrap_g_app_launch_context_get_startup_notify_id(PyGObject *self,
g_list_free(file_list);
if (ret)
- return PyString_FromString(ret);
+ return _PyUnicode_FromString(ret);
Py_INCREF(Py_None);
return Py_None;
diff --git a/gio/gdatainputstream.override b/gio/gdatainputstream.override
index 92b0f99..d2b78ae 100644
--- a/gio/gdatainputstream.override
+++ b/gio/gdatainputstream.override
@@ -49,7 +49,7 @@ _wrap_g_data_input_stream_read_line(PyGObject *self,
if (pyg_error_check(&error))
return NULL;
- py_line = PyString_FromStringAndSize(line, length);
+ py_line = _PyUnicode_FromStringAndSize(line, length);
g_free(line);
return py_line;
}
@@ -128,7 +128,7 @@ _wrap_g_data_input_stream_read_line_finish(PyGObject *self,
if (pyg_error_check(&error))
return NULL;
- py_line = PyString_FromStringAndSize(line, length);
+ py_line = _PyUnicode_FromStringAndSize(line, length);
g_free(line);
return py_line;
}
@@ -162,7 +162,7 @@ _wrap_g_data_input_stream_read_until(PyGObject *self,
if (pyg_error_check(&error))
return NULL;
- py_line = PyString_FromStringAndSize(line, length);
+ py_line = _PyUnicode_FromStringAndSize(line, length);
g_free(line);
return py_line;
}
@@ -244,7 +244,7 @@ _wrap_g_data_input_stream_read_until_finish(PyGObject *self,
if (pyg_error_check(&error))
return NULL;
- py_line = PyString_FromStringAndSize(line, length);
+ py_line = _PyUnicode_FromStringAndSize(line, length);
g_free(line);
return py_line;
}
diff --git a/gio/gdrive.override b/gio/gdrive.override
index 8362ae0..bea860a 100644
--- a/gio/gdrive.override
+++ b/gio/gdrive.override
@@ -160,7 +160,7 @@ _wrap_g_drive_tp_repr(PyGObject *self)
else
representation = g_strdup_printf("<%s at %p: UNKNOWN NAME>", Py_TYPE(self)->tp_name, self);
- result = PyString_FromString(representation);
+ result = _PyUnicode_FromString(representation);
g_free(representation);
return result;
}
diff --git a/gio/gfile.override b/gio/gfile.override
index 3733192..4b14798 100644
--- a/gio/gfile.override
+++ b/gio/gfile.override
@@ -1342,7 +1342,7 @@ _wrap_g_file_replace_contents(PyGObject *self, PyObject *args, PyObject *kwargs)
return NULL;
if (ret) {
- py_ret = PyString_FromString(new_etag);
+ py_ret = _PyUnicode_FromString(new_etag);
} else {
py_ret = Py_None;
Py_INCREF(py_ret);
@@ -1378,7 +1378,7 @@ _wrap_g_file_replace_contents_finish(PyGObject *self, PyObject *args, PyObject *
return NULL;
if (ret) {
- py_ret = PyString_FromString(etag_out);
+ py_ret = _PyUnicode_FromString(etag_out);
return py_ret;
} else {
py_ret = Py_None;
@@ -1504,7 +1504,7 @@ _wrap_g_file_tp_repr(PyGObject *self)
else
representation = g_strdup_printf("<%s at %p: UNKNOWN URI>", Py_TYPE(self)->tp_name, self);
- result = PyString_FromString(representation);
+ result = _PyUnicode_FromString(representation);
g_free(representation);
return result;
}
diff --git a/gio/gfileattribute.override b/gio/gfileattribute.override
index 5f3e552..41294b9 100644
--- a/gio/gfileattribute.override
+++ b/gio/gfileattribute.override
@@ -52,7 +52,7 @@ pyg_file_attribute_info__get_name(PyObject *self, void *closure)
ret = ((PyGFileAttributeInfo*)self)->info->name;
if (ret)
- return PyString_FromString(ret);
+ return _PyUnicode_FromString(ret);
Py_INCREF(Py_None);
return Py_None;
}
diff --git a/gio/gfileinfo.override b/gio/gfileinfo.override
index 730e91b..a0b17d9 100644
--- a/gio/gfileinfo.override
+++ b/gio/gfileinfo.override
@@ -64,7 +64,7 @@ _wrap_g_file_info_list_attributes(PyGObject *self,
ret = PyList_New(0);
n = names;
while (n && *n) {
- PyObject *item = PyString_FromString(n[0]);
+ PyObject *item = _PyUnicode_FromString(n[0]);
PyList_Append(ret, item);
Py_DECREF(item);
diff --git a/gio/gicon.override b/gio/gicon.override
index 9d27495..675ab49 100644
--- a/gio/gicon.override
+++ b/gio/gicon.override
@@ -183,7 +183,7 @@ _wrap_g_file_icon_tp_repr(PyGObject *self)
else
representation = g_strdup_printf("<%s at %p: UNKNOWN URI>", Py_TYPE(self)->tp_name, self);
- result = PyString_FromString(representation);
+ result = _PyUnicode_FromString(representation);
g_free(representation);
return result;
}
@@ -202,9 +202,9 @@ _wrap_g_themed_icon_new(PyGObject *self, PyObject *args, PyObject *kwargs)
kwlist, &name, &use_default_fallbacks))
return -1;
- if (PyString_Check(name)) {
+ if (_PyUnicode_Check(name)) {
pygobject_construct(self,
- "name", PyString_AsString(name),
+ "name", _PyUnicode_AsString(name),
"use-default-fallbacks", use_default_fallbacks, NULL);
return 0;
}
@@ -218,8 +218,8 @@ _wrap_g_themed_icon_new(PyGObject *self, PyObject *args, PyObject *kwargs)
for (k = 0; k < length; k++) {
PyObject *str = PyTuple_GetItem(tuple, k);
- if (str && PyString_Check(str))
- names[k] = PyString_AsString(str);
+ if (str && _PyUnicode_Check(str))
+ names[k] = _PyUnicode_AsString(str);
else {
Py_DECREF(tuple);
g_free(names);
@@ -257,7 +257,7 @@ _wrap_g_themed_icon_get_names(PyGObject *self)
ret = PyList_New(0);
while (names && *names) {
- PyObject *item = PyString_FromString(names[0]);
+ PyObject *item = _PyUnicode_FromString(names[0]);
PyList_Append(ret, item);
Py_DECREF(item);
@@ -290,7 +290,7 @@ _wrap_g_themed_icon_tp_repr(PyGObject *self)
}
g_string_append(representation, ">");
- result = PyString_FromString(representation->str);
+ result = _PyUnicode_FromString(representation->str);
g_string_free(representation, TRUE);
return result;
}
diff --git a/gio/ginputstream.override b/gio/ginputstream.override
index 260b2fc..917f13a 100644
--- a/gio/ginputstream.override
+++ b/gio/ginputstream.override
@@ -47,7 +47,7 @@ _wrap_g_input_stream_read(PyGObject *self, PyObject *args, PyObject *kwargs)
if (!pygio_check_cancellable(pycancellable, &cancellable))
return NULL;
- v = PyString_FromStringAndSize((char *)NULL, buffersize);
+ v = _PyByteArray_FromStringAndSize((char *)NULL, buffersize);
if (v == NULL)
return NULL;
@@ -57,7 +57,7 @@ _wrap_g_input_stream_read(PyGObject *self, PyObject *args, PyObject *kwargs)
pyg_begin_allow_threads;
errno = 0;
chunksize = g_input_stream_read(G_INPUT_STREAM(self->obj),
- PyString_AS_STRING((PyStringObject *)v) + bytesread,
+ _PyByteArray_AsString(v) + bytesread,
buffersize - bytesread, cancellable,
&error);
pyg_end_allow_threads;
@@ -81,7 +81,7 @@ _wrap_g_input_stream_read(PyGObject *self, PyObject *args, PyObject *kwargs)
if (count < 0) {
buffersize += BUFSIZE;
- if (_PyString_Resize(&v, buffersize) < 0)
+ if (_PyByteArray_Resize(&v, buffersize) < 0)
return NULL;
}
else {
@@ -91,7 +91,7 @@ _wrap_g_input_stream_read(PyGObject *self, PyObject *args, PyObject *kwargs)
}
if (bytesread != buffersize)
- _PyString_Resize(&v, bytesread);
+ _PyByteArray_Resize(&v, bytesread);
return v;
}
@@ -119,7 +119,7 @@ _wrap_g_input_stream_read_all(PyGObject *self, PyObject *args, PyObject *kwargs)
if (!pygio_check_cancellable(pycancellable, &cancellable))
return NULL;
- v = PyString_FromStringAndSize((char *)NULL, buffersize);
+ v = _PyByteArray_FromStringAndSize((char *)NULL, buffersize);
if (v == NULL)
return NULL;
@@ -129,7 +129,7 @@ _wrap_g_input_stream_read_all(PyGObject *self, PyObject *args, PyObject *kwargs)
pyg_begin_allow_threads;
errno = 0;
g_input_stream_read_all(G_INPUT_STREAM(self->obj),
- PyString_AS_STRING((PyStringObject *)v) + bytesread,
+ _PyByteArray_AsString(v) + bytesread,
buffersize - bytesread,
&chunksize,
cancellable, &error);
@@ -148,7 +148,7 @@ _wrap_g_input_stream_read_all(PyGObject *self, PyObject *args, PyObject *kwargs)
if (count < 0) {
buffersize += BUFSIZE;
- if (_PyString_Resize(&v, buffersize) < 0)
+ if (_PyByteArray_Resize(&v, buffersize) < 0)
return NULL;
}
else {
@@ -158,7 +158,7 @@ _wrap_g_input_stream_read_all(PyGObject *self, PyObject *args, PyObject *kwargs)
}
if (bytesread != buffersize)
- _PyString_Resize(&v, bytesread);
+ _PyByteArray_Resize(&v, bytesread);
return v;
}
@@ -241,10 +241,10 @@ _wrap_g_input_stream_read_finish(PyGObject *self,
return NULL;
if (bytesread == 0)
- return PyString_FromString("");
+ return _PyByteArray_FromStringAndSize("", 0);
notify = pygio_notify_get_attached(result);
- return PyString_FromStringAndSize(notify->buffer, bytesread);
+ return _PyByteArray_FromStringAndSize(notify->buffer, bytesread);
}
%%
override g_input_stream_close_async kwargs
diff --git a/gio/gio.override b/gio/gio.override
index 6d001b9..86c7f33 100644
--- a/gio/gio.override
+++ b/gio/gio.override
@@ -353,7 +353,7 @@ _wrap_g_content_type_guess(PyGObject *self, PyObject *args, PyObject *kwargs)
ret = Py_BuildValue("zN", type, PyBool_FromLong(result_uncertain));
} else {
- ret = PyString_FromString(type);
+ ret = _PyUnicode_FromString(type);
}
g_free(type);
@@ -371,7 +371,7 @@ _wrap_g_vfs_get_supported_uri_schemes(PyGObject *self)
ret = PyList_New(0);
while (names && *names) {
- PyObject *item = PyString_FromString(names[0]);
+ PyObject *item = _PyUnicode_FromString(names[0]);
PyList_Append(ret, item);
Py_DECREF(item);
@@ -393,7 +393,7 @@ _wrap_g_content_types_get_registered(PyObject *self)
ret = PyList_New(0);
for (l = list; l; l = l->next) {
char *content_type = l->data;
- PyObject *string = PyString_FromString(content_type);
+ PyObject *string = _PyUnicode_FromString(content_type);
PyList_Append(ret, string);
Py_DECREF(string);
g_free(content_type);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]