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
a9916b55
Kaydet (Commit)
a9916b55
authored
May 17, 2008
tarafından
Georg Brandl
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
#2353: raise Py3k warning in file.xreadlines().
üst
c76ffca2
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
21 additions
and
3 deletions
+21
-3
test_py3kwarn.py
Lib/test/test_py3kwarn.py
+7
-0
NEWS
Misc/NEWS
+2
-0
fileobject.c
Objects/fileobject.c
+12
-3
No files found.
Lib/test/test_py3kwarn.py
Dosyayı görüntüle @
a9916b55
...
...
@@ -123,6 +123,13 @@ class TestPy3KWarnings(unittest.TestCase):
with
catch_warning
()
as
w
:
self
.
assertWarning
(
buffer
(
'a'
),
w
,
expected
)
def
test_file_xreadlines
(
self
):
expected
=
(
"f.xreadlines() not supported in 3.x, "
"try 'for line in f' instead"
)
with
file
(
__file__
)
as
f
:
with
catch_warning
()
as
w
:
self
.
assertWarning
(
f
.
xreadlines
(),
w
,
expected
)
class
TestStdlibRemovals
(
unittest
.
TestCase
):
...
...
Misc/NEWS
Dosyayı görüntüle @
a9916b55
...
...
@@ -12,6 +12,8 @@ What's New in Python 2.6 beta 1?
Core and Builtins
-----------------
- Issue #2353: file.xreadlines() now emits a Py3k warning.
- Issue #2863: generators now have a ``gen.__name__`` attribute that
equals ``gen.gi_code.co_name``, like ``func.__name___`` that equals
``func.func_code.co_name``. The repr() of a generator now also
...
...
Objects/fileobject.c
Dosyayı görüntüle @
a9916b55
...
...
@@ -1735,6 +1735,15 @@ file_self(PyFileObject *f)
return
(
PyObject
*
)
f
;
}
static
PyObject
*
file_xreadlines
(
PyFileObject
*
f
)
{
if
(
PyErr_WarnPy3k
(
"f.xreadlines() not supported in 3.x, "
"try 'for line in f' instead"
,
1
)
<
0
)
return
NULL
;
return
file_self
(
f
);
}
static
PyObject
*
file_exit
(
PyObject
*
f
,
PyObject
*
args
)
{
...
...
@@ -1850,9 +1859,9 @@ static PyMethodDef file_methods[] = {
#endif
{
"tell"
,
(
PyCFunction
)
file_tell
,
METH_NOARGS
,
tell_doc
},
{
"readinto"
,
(
PyCFunction
)
file_readinto
,
METH_VARARGS
,
readinto_doc
},
{
"readlines"
,
(
PyCFunction
)
file_readlines
,
METH_VARARGS
,
readlines_doc
},
{
"xreadlines"
,(
PyCFunction
)
file_
self
,
METH_NOARGS
,
xreadlines_doc
},
{
"writelines"
,(
PyCFunction
)
file_writelines
,
METH_O
,
writelines_doc
},
{
"readlines"
,
(
PyCFunction
)
file_readlines
,
METH_VARARGS
,
readlines_doc
},
{
"xreadlines"
,(
PyCFunction
)
file_
xreadlines
,
METH_NOARGS
,
xreadlines_doc
},
{
"writelines"
,(
PyCFunction
)
file_writelines
,
METH_O
,
writelines_doc
},
{
"flush"
,
(
PyCFunction
)
file_flush
,
METH_NOARGS
,
flush_doc
},
{
"close"
,
(
PyCFunction
)
file_close
,
METH_NOARGS
,
close_doc
},
{
"isatty"
,
(
PyCFunction
)
file_isatty
,
METH_NOARGS
,
isatty_doc
},
...
...
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