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
91b97463
Kaydet (Commit)
91b97463
authored
Ock 11, 2005
tarafından
Andrew McNamara
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Factor out the code for making a dialect instance.
üst
dbce2618
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
18 deletions
+22
-18
_csv.c
Modules/_csv.c
+22
-18
No files found.
Modules/_csv.c
Dosyayı görüntüle @
91b97463
...
...
@@ -496,6 +496,24 @@ static PyTypeObject Dialect_Type = {
0
,
/* tp_free */
};
/*
* Return an instance of the dialect type, given a Python instance or kwarg
* description of the dialect
*/
static
PyObject
*
_call_dialect
(
PyObject
*
dialect_inst
,
PyObject
*
kwargs
)
{
PyObject
*
ctor_args
;
PyObject
*
dialect
;
ctor_args
=
Py_BuildValue
(
dialect_inst
?
"(O)"
:
"()"
,
dialect_inst
);
if
(
ctor_args
==
NULL
)
return
NULL
;
dialect
=
PyObject_Call
((
PyObject
*
)
&
Dialect_Type
,
ctor_args
,
kwargs
);
Py_DECREF
(
ctor_args
);
return
dialect
;
}
static
void
parse_save_field
(
ReaderObj
*
self
)
{
...
...
@@ -862,7 +880,7 @@ static PyTypeObject Reader_Type = {
static
PyObject
*
csv_reader
(
PyObject
*
module
,
PyObject
*
args
,
PyObject
*
keyword_args
)
{
PyObject
*
iterator
,
*
dialect
=
NULL
,
*
ctor_args
;
PyObject
*
iterator
,
*
dialect
=
NULL
;
ReaderObj
*
self
=
PyObject_GC_New
(
ReaderObj
,
&
Reader_Type
);
if
(
!
self
)
...
...
@@ -890,14 +908,7 @@ csv_reader(PyObject *module, PyObject *args, PyObject *keyword_args)
Py_DECREF
(
self
);
return
NULL
;
}
ctor_args
=
Py_BuildValue
(
dialect
?
"(O)"
:
"()"
,
dialect
);
if
(
ctor_args
==
NULL
)
{
Py_DECREF
(
self
);
return
NULL
;
}
self
->
dialect
=
(
DialectObj
*
)
PyObject_Call
((
PyObject
*
)
&
Dialect_Type
,
ctor_args
,
keyword_args
);
Py_DECREF
(
ctor_args
);
self
->
dialect
=
(
DialectObj
*
)
_call_dialect
(
dialect
,
keyword_args
);
if
(
self
->
dialect
==
NULL
)
{
Py_DECREF
(
self
);
return
NULL
;
...
...
@@ -1313,7 +1324,7 @@ static PyTypeObject Writer_Type = {
static
PyObject
*
csv_writer
(
PyObject
*
module
,
PyObject
*
args
,
PyObject
*
keyword_args
)
{
PyObject
*
output_file
,
*
dialect
=
NULL
,
*
ctor_args
;
PyObject
*
output_file
,
*
dialect
=
NULL
;
WriterObj
*
self
=
PyObject_GC_New
(
WriterObj
,
&
Writer_Type
);
if
(
!
self
)
...
...
@@ -1338,14 +1349,7 @@ csv_writer(PyObject *module, PyObject *args, PyObject *keyword_args)
Py_DECREF
(
self
);
return
NULL
;
}
ctor_args
=
Py_BuildValue
(
dialect
?
"(O)"
:
"()"
,
dialect
);
if
(
ctor_args
==
NULL
)
{
Py_DECREF
(
self
);
return
NULL
;
}
self
->
dialect
=
(
DialectObj
*
)
PyObject_Call
((
PyObject
*
)
&
Dialect_Type
,
ctor_args
,
keyword_args
);
Py_DECREF
(
ctor_args
);
self
->
dialect
=
(
DialectObj
*
)
_call_dialect
(
dialect
,
keyword_args
);
if
(
self
->
dialect
==
NULL
)
{
Py_DECREF
(
self
);
return
NULL
;
...
...
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