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
767046aa
Kaydet (Commit)
767046aa
authored
Eki 14, 2011
tarafından
Martin v. Löwis
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Replace {Get,Set,Has}AttrString with *AttrId.
üst
7903913f
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
25 additions
and
14 deletions
+25
-14
_iomodule.c
Modules/_io/_iomodule.c
+2
-1
bufferedio.c
Modules/_io/bufferedio.c
+5
-3
fileio.c
Modules/_io/fileio.c
+2
-1
iobase.c
Modules/_io/iobase.c
+6
-3
textio.c
Modules/_io/textio.c
+10
-6
No files found.
Modules/_io/_iomodule.c
Dosyayı görüntüle @
767046aa
...
@@ -233,6 +233,7 @@ io_open(PyObject *self, PyObject *args, PyObject *kwds)
...
@@ -233,6 +233,7 @@ io_open(PyObject *self, PyObject *args, PyObject *kwds)
_Py_IDENTIFIER
(
isatty
);
_Py_IDENTIFIER
(
isatty
);
_Py_IDENTIFIER
(
fileno
);
_Py_IDENTIFIER
(
fileno
);
_Py_IDENTIFIER
(
mode
);
if
(
!
PyArg_ParseTupleAndKeywords
(
args
,
kwds
,
"O|sizzziO:open"
,
kwlist
,
if
(
!
PyArg_ParseTupleAndKeywords
(
args
,
kwds
,
"O|sizzziO:open"
,
kwlist
,
&
file
,
&
mode
,
&
buffering
,
&
file
,
&
mode
,
&
buffering
,
...
@@ -440,7 +441,7 @@ io_open(PyObject *self, PyObject *args, PyObject *kwds)
...
@@ -440,7 +441,7 @@ io_open(PyObject *self, PyObject *args, PyObject *kwds)
if
(
wrapper
==
NULL
)
if
(
wrapper
==
NULL
)
goto
error
;
goto
error
;
if
(
PyObject_SetAttrString
(
wrapper
,
"mode"
,
modeobj
)
<
0
)
if
(
_PyObject_SetAttrId
(
wrapper
,
&
PyId_mode
,
modeobj
)
<
0
)
goto
error
;
goto
error
;
Py_DECREF
(
modeobj
);
Py_DECREF
(
modeobj
);
return
wrapper
;
return
wrapper
;
...
...
Modules/_io/bufferedio.c
Dosyayı görüntüle @
767046aa
...
@@ -17,6 +17,8 @@ _Py_IDENTIFIER(close);
...
@@ -17,6 +17,8 @@ _Py_IDENTIFIER(close);
_Py_IDENTIFIER
(
_dealloc_warn
);
_Py_IDENTIFIER
(
_dealloc_warn
);
_Py_IDENTIFIER
(
flush
);
_Py_IDENTIFIER
(
flush
);
_Py_IDENTIFIER
(
isatty
);
_Py_IDENTIFIER
(
isatty
);
_Py_IDENTIFIER
(
mode
);
_Py_IDENTIFIER
(
name
);
_Py_IDENTIFIER
(
peek
);
_Py_IDENTIFIER
(
peek
);
_Py_IDENTIFIER
(
read
);
_Py_IDENTIFIER
(
read
);
_Py_IDENTIFIER
(
read1
);
_Py_IDENTIFIER
(
read1
);
...
@@ -556,14 +558,14 @@ static PyObject *
...
@@ -556,14 +558,14 @@ static PyObject *
buffered_name_get
(
buffered
*
self
,
void
*
context
)
buffered_name_get
(
buffered
*
self
,
void
*
context
)
{
{
CHECK_INITIALIZED
(
self
)
CHECK_INITIALIZED
(
self
)
return
PyObject_GetAttrString
(
self
->
raw
,
"name"
);
return
_PyObject_GetAttrId
(
self
->
raw
,
&
PyId_name
);
}
}
static
PyObject
*
static
PyObject
*
buffered_mode_get
(
buffered
*
self
,
void
*
context
)
buffered_mode_get
(
buffered
*
self
,
void
*
context
)
{
{
CHECK_INITIALIZED
(
self
)
CHECK_INITIALIZED
(
self
)
return
PyObject_GetAttrString
(
self
->
raw
,
"mode"
);
return
_PyObject_GetAttrId
(
self
->
raw
,
&
PyId_mode
);
}
}
/* Lower-level APIs */
/* Lower-level APIs */
...
@@ -1301,7 +1303,7 @@ buffered_repr(buffered *self)
...
@@ -1301,7 +1303,7 @@ buffered_repr(buffered *self)
{
{
PyObject
*
nameobj
,
*
res
;
PyObject
*
nameobj
,
*
res
;
nameobj
=
PyObject_GetAttrString
((
PyObject
*
)
self
,
"name"
);
nameobj
=
_PyObject_GetAttrId
((
PyObject
*
)
self
,
&
PyId_name
);
if
(
nameobj
==
NULL
)
{
if
(
nameobj
==
NULL
)
{
if
(
PyErr_ExceptionMatches
(
PyExc_AttributeError
))
if
(
PyErr_ExceptionMatches
(
PyExc_AttributeError
))
PyErr_Clear
();
PyErr_Clear
();
...
...
Modules/_io/fileio.c
Dosyayı görüntüle @
767046aa
...
@@ -993,12 +993,13 @@ mode_string(fileio *self)
...
@@ -993,12 +993,13 @@ mode_string(fileio *self)
static
PyObject
*
static
PyObject
*
fileio_repr
(
fileio
*
self
)
fileio_repr
(
fileio
*
self
)
{
{
_Py_IDENTIFIER
(
name
);
PyObject
*
nameobj
,
*
res
;
PyObject
*
nameobj
,
*
res
;
if
(
self
->
fd
<
0
)
if
(
self
->
fd
<
0
)
return
PyUnicode_FromFormat
(
"<_io.FileIO [closed]>"
);
return
PyUnicode_FromFormat
(
"<_io.FileIO [closed]>"
);
nameobj
=
PyObject_GetAttrString
((
PyObject
*
)
self
,
"name"
);
nameobj
=
_PyObject_GetAttrId
((
PyObject
*
)
self
,
&
PyId_name
);
if
(
nameobj
==
NULL
)
{
if
(
nameobj
==
NULL
)
{
if
(
PyErr_ExceptionMatches
(
PyExc_AttributeError
))
if
(
PyErr_ExceptionMatches
(
PyExc_AttributeError
))
PyErr_Clear
();
PyErr_Clear
();
...
...
Modules/_io/iobase.c
Dosyayı görüntüle @
767046aa
...
@@ -59,8 +59,9 @@ PyDoc_STRVAR(iobase_doc,
...
@@ -59,8 +59,9 @@ PyDoc_STRVAR(iobase_doc,
of the IOBase object rather than the virtual `closed` attribute as returned
of the IOBase object rather than the virtual `closed` attribute as returned
by whatever subclass. */
by whatever subclass. */
_Py_IDENTIFIER
(
__IOBase_closed
);
#define IS_CLOSED(self) \
#define IS_CLOSED(self) \
PyObject_HasAttrString(self, "__IOBase_closed"
)
_PyObject_HasAttrId(self, &PyId___IOBase_closed
)
/* Internal methods */
/* Internal methods */
static
PyObject
*
static
PyObject
*
...
@@ -192,12 +193,13 @@ static PyObject *
...
@@ -192,12 +193,13 @@ static PyObject *
iobase_close
(
PyObject
*
self
,
PyObject
*
args
)
iobase_close
(
PyObject
*
self
,
PyObject
*
args
)
{
{
PyObject
*
res
;
PyObject
*
res
;
_Py_IDENTIFIER
(
__IOBase_closed
);
if
(
IS_CLOSED
(
self
))
if
(
IS_CLOSED
(
self
))
Py_RETURN_NONE
;
Py_RETURN_NONE
;
res
=
PyObject_CallMethodObjArgs
(
self
,
_PyIO_str_flush
,
NULL
);
res
=
PyObject_CallMethodObjArgs
(
self
,
_PyIO_str_flush
,
NULL
);
PyObject_SetAttrString
(
self
,
"__IOBase_closed"
,
Py_True
);
_PyObject_SetAttrId
(
self
,
&
PyId___IOBase_closed
,
Py_True
);
if
(
res
==
NULL
)
{
if
(
res
==
NULL
)
{
return
NULL
;
return
NULL
;
}
}
...
@@ -467,12 +469,13 @@ iobase_readline(PyObject *self, PyObject *args)
...
@@ -467,12 +469,13 @@ iobase_readline(PyObject *self, PyObject *args)
PyObject
*
buffer
,
*
result
;
PyObject
*
buffer
,
*
result
;
Py_ssize_t
old_size
=
-
1
;
Py_ssize_t
old_size
=
-
1
;
_Py_IDENTIFIER
(
read
);
_Py_IDENTIFIER
(
read
);
_Py_IDENTIFIER
(
peek
);
if
(
!
PyArg_ParseTuple
(
args
,
"|O&:readline"
,
&
_PyIO_ConvertSsize_t
,
&
limit
))
{
if
(
!
PyArg_ParseTuple
(
args
,
"|O&:readline"
,
&
_PyIO_ConvertSsize_t
,
&
limit
))
{
return
NULL
;
return
NULL
;
}
}
if
(
PyObject_HasAttrString
(
self
,
"peek"
))
if
(
_PyObject_HasAttrId
(
self
,
&
PyId_peek
))
has_peek
=
1
;
has_peek
=
1
;
buffer
=
PyByteArray_FromStringAndSize
(
NULL
,
0
);
buffer
=
PyByteArray_FromStringAndSize
(
NULL
,
0
);
...
...
Modules/_io/textio.c
Dosyayı görüntüle @
767046aa
...
@@ -19,7 +19,11 @@ _Py_IDENTIFIER(fileno);
...
@@ -19,7 +19,11 @@ _Py_IDENTIFIER(fileno);
_Py_IDENTIFIER
(
flush
);
_Py_IDENTIFIER
(
flush
);
_Py_IDENTIFIER
(
getpreferredencoding
);
_Py_IDENTIFIER
(
getpreferredencoding
);
_Py_IDENTIFIER
(
isatty
);
_Py_IDENTIFIER
(
isatty
);
_Py_IDENTIFIER
(
mode
);
_Py_IDENTIFIER
(
name
);
_Py_IDENTIFIER
(
raw
);
_Py_IDENTIFIER
(
read
);
_Py_IDENTIFIER
(
read
);
_Py_IDENTIFIER
(
read1
);
_Py_IDENTIFIER
(
readable
);
_Py_IDENTIFIER
(
readable
);
_Py_IDENTIFIER
(
replace
);
_Py_IDENTIFIER
(
replace
);
_Py_IDENTIFIER
(
reset
);
_Py_IDENTIFIER
(
reset
);
...
@@ -999,7 +1003,7 @@ textiowrapper_init(textio *self, PyObject *args, PyObject *kwds)
...
@@ -999,7 +1003,7 @@ textiowrapper_init(textio *self, PyObject *args, PyObject *kwds)
ci
=
_PyCodec_Lookup
(
encoding
);
ci
=
_PyCodec_Lookup
(
encoding
);
if
(
ci
==
NULL
)
if
(
ci
==
NULL
)
goto
error
;
goto
error
;
res
=
PyObject_GetAttrString
(
ci
,
"name"
);
res
=
_PyObject_GetAttrId
(
ci
,
&
PyId_name
);
Py_DECREF
(
ci
);
Py_DECREF
(
ci
);
if
(
res
==
NULL
)
{
if
(
res
==
NULL
)
{
if
(
PyErr_ExceptionMatches
(
PyExc_AttributeError
))
if
(
PyErr_ExceptionMatches
(
PyExc_AttributeError
))
...
@@ -1026,7 +1030,7 @@ textiowrapper_init(textio *self, PyObject *args, PyObject *kwds)
...
@@ -1026,7 +1030,7 @@ textiowrapper_init(textio *self, PyObject *args, PyObject *kwds)
if
(
Py_TYPE
(
buffer
)
==
&
PyBufferedReader_Type
||
if
(
Py_TYPE
(
buffer
)
==
&
PyBufferedReader_Type
||
Py_TYPE
(
buffer
)
==
&
PyBufferedWriter_Type
||
Py_TYPE
(
buffer
)
==
&
PyBufferedWriter_Type
||
Py_TYPE
(
buffer
)
==
&
PyBufferedRandom_Type
)
{
Py_TYPE
(
buffer
)
==
&
PyBufferedRandom_Type
)
{
raw
=
PyObject_GetAttrString
(
buffer
,
"raw"
);
raw
=
_PyObject_GetAttrId
(
buffer
,
&
PyId_raw
);
/* Cache the raw FileIO object to speed up 'closed' checks */
/* Cache the raw FileIO object to speed up 'closed' checks */
if
(
raw
==
NULL
)
{
if
(
raw
==
NULL
)
{
if
(
PyErr_ExceptionMatches
(
PyExc_AttributeError
))
if
(
PyErr_ExceptionMatches
(
PyExc_AttributeError
))
...
@@ -1046,7 +1050,7 @@ textiowrapper_init(textio *self, PyObject *args, PyObject *kwds)
...
@@ -1046,7 +1050,7 @@ textiowrapper_init(textio *self, PyObject *args, PyObject *kwds)
self
->
seekable
=
self
->
telling
=
PyObject_IsTrue
(
res
);
self
->
seekable
=
self
->
telling
=
PyObject_IsTrue
(
res
);
Py_DECREF
(
res
);
Py_DECREF
(
res
);
self
->
has_read1
=
PyObject_HasAttrString
(
buffer
,
"read1"
);
self
->
has_read1
=
_PyObject_HasAttrId
(
buffer
,
&
PyId_read1
);
self
->
encoding_start_of_stream
=
0
;
self
->
encoding_start_of_stream
=
0
;
if
(
self
->
seekable
&&
self
->
encoder
)
{
if
(
self
->
seekable
&&
self
->
encoder
)
{
...
@@ -2401,7 +2405,7 @@ textiowrapper_repr(textio *self)
...
@@ -2401,7 +2405,7 @@ textiowrapper_repr(textio *self)
res
=
PyUnicode_FromString
(
"<_io.TextIOWrapper"
);
res
=
PyUnicode_FromString
(
"<_io.TextIOWrapper"
);
if
(
res
==
NULL
)
if
(
res
==
NULL
)
return
NULL
;
return
NULL
;
nameobj
=
PyObject_GetAttrString
((
PyObject
*
)
self
,
"name"
);
nameobj
=
_PyObject_GetAttrId
((
PyObject
*
)
self
,
&
PyId_name
);
if
(
nameobj
==
NULL
)
{
if
(
nameobj
==
NULL
)
{
if
(
PyErr_ExceptionMatches
(
PyExc_AttributeError
))
if
(
PyErr_ExceptionMatches
(
PyExc_AttributeError
))
PyErr_Clear
();
PyErr_Clear
();
...
@@ -2417,7 +2421,7 @@ textiowrapper_repr(textio *self)
...
@@ -2417,7 +2421,7 @@ textiowrapper_repr(textio *self)
if
(
res
==
NULL
)
if
(
res
==
NULL
)
return
NULL
;
return
NULL
;
}
}
modeobj
=
PyObject_GetAttrString
((
PyObject
*
)
self
,
"mode"
);
modeobj
=
_PyObject_GetAttrId
((
PyObject
*
)
self
,
&
PyId_mode
);
if
(
modeobj
==
NULL
)
{
if
(
modeobj
==
NULL
)
{
if
(
PyErr_ExceptionMatches
(
PyExc_AttributeError
))
if
(
PyErr_ExceptionMatches
(
PyExc_AttributeError
))
PyErr_Clear
();
PyErr_Clear
();
...
@@ -2578,7 +2582,7 @@ static PyObject *
...
@@ -2578,7 +2582,7 @@ static PyObject *
textiowrapper_name_get
(
textio
*
self
,
void
*
context
)
textiowrapper_name_get
(
textio
*
self
,
void
*
context
)
{
{
CHECK_INITIALIZED
(
self
);
CHECK_INITIALIZED
(
self
);
return
PyObject_GetAttrString
(
self
->
buffer
,
"name"
);
return
_PyObject_GetAttrId
(
self
->
buffer
,
&
PyId_name
);
}
}
static
PyObject
*
static
PyObject
*
...
...
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