Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
cpython
Commits
af6a27a7
Kaydet (Commit)
af6a27a7
authored
Ock 03, 2003
tarafından
Martin v. Löwis
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Allow PyFile_GetLine() to return Unicode objects. Fixes #660165.
üst
bb0246ac
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
1 deletion
+26
-1
NEWS
Misc/NEWS
+2
-0
fileobject.c
Objects/fileobject.c
+24
-1
No files found.
Misc/NEWS
Dosyayı görüntüle @
af6a27a7
...
...
@@ -12,6 +12,8 @@ What's New in Python 2.3 alpha 2?
Core and builtins
-----------------
- raw_input can now return Unicode objects.
- List objects'
sort
()
method
now
accepts
None
as
the
comparison
function
.
Passing
None
is
semantically
identical
to
calling
sort
()
with
no
arguments
.
...
...
Objects/fileobject.c
Dosyayı görüntüle @
af6a27a7
...
...
@@ -1212,7 +1212,8 @@ PyFile_GetLine(PyObject *f, int n)
result
=
PyEval_CallObject
(
reader
,
args
);
Py_DECREF
(
reader
);
Py_DECREF
(
args
);
if
(
result
!=
NULL
&&
!
PyString_Check
(
result
))
{
if
(
result
!=
NULL
&&
!
PyString_Check
(
result
)
&&
!
PyUnicode_Check
(
result
))
{
Py_DECREF
(
result
);
result
=
NULL
;
PyErr_SetString
(
PyExc_TypeError
,
...
...
@@ -1240,6 +1241,28 @@ PyFile_GetLine(PyObject *f, int n)
}
}
}
#ifdef Py_USING_UNICODE
if
(
n
<
0
&&
result
!=
NULL
&&
PyUnicode_Check
(
result
))
{
Py_UNICODE
*
s
=
PyUnicode_AS_UNICODE
(
result
);
int
len
=
PyUnicode_GET_SIZE
(
result
);
if
(
len
==
0
)
{
Py_DECREF
(
result
);
result
=
NULL
;
PyErr_SetString
(
PyExc_EOFError
,
"EOF when reading a line"
);
}
else
if
(
s
[
len
-
1
]
==
'\n'
)
{
if
(
result
->
ob_refcnt
==
1
)
PyUnicode_Resize
(
&
result
,
len
-
1
);
else
{
PyObject
*
v
;
v
=
PyUnicode_FromUnicode
(
s
,
len
-
1
);
Py_DECREF
(
result
);
result
=
v
;
}
}
}
#endif
return
result
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment