summaryrefslogtreecommitdiffstats
path: root/Modules/posixmodule.c
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2013-11-13 13:17:30 (GMT)
committerVictor Stinner <victor.stinner@gmail.com>2013-11-13 13:17:30 (GMT)
commit59799a83995f135bdb1b1a0994052c1f24c68e83 (patch)
treedf2516464ed158cd433f228c90b89c2baad00d4e /Modules/posixmodule.c
parente223439c130db50c2d636f433a3f1ff438b532db (diff)
downloadcpython-59799a83995f135bdb1b1a0994052c1f24c68e83.zip
cpython-59799a83995f135bdb1b1a0994052c1f24c68e83.tar.gz
cpython-59799a83995f135bdb1b1a0994052c1f24c68e83.tar.bz2
Don't use deprecated function PyUnicode_GET_SIZE()
Replace it with PyUnicode_GET_LENGTH() or PyUnicode_AsUnicodeAndSize()
Diffstat (limited to 'Modules/posixmodule.c')
-rw-r--r--Modules/posixmodule.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c
index f282f99..5e5f355 100644
--- a/Modules/posixmodule.c
+++ b/Modules/posixmodule.c
@@ -829,15 +829,14 @@ path_converter(PyObject *o, void *p) {
if (unicode) {
#ifdef MS_WINDOWS
wchar_t *wide;
- length = PyUnicode_GET_SIZE(unicode);
- if (length > 32767) {
- FORMAT_EXCEPTION(PyExc_ValueError, "%s too long for Windows");
+
+ wide = PyUnicode_AsUnicodeAndSize(unicode, &length);
+ if (!wide) {
Py_DECREF(unicode);
return 0;
}
-
- wide = PyUnicode_AsUnicode(unicode);
- if (!wide) {
+ if (length > 32767) {
+ FORMAT_EXCEPTION(PyExc_ValueError, "%s too long for Windows");
Py_DECREF(unicode);
return 0;
}