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
31d8896e
Kaydet (Commit)
31d8896e
authored
Ock 12, 2005
tarafından
Andrew McNamara
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Rename csv.set_field_limit to csv.field_size_limit (since it both sets and
gets).
üst
a08eecb6
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
15 additions
and
15 deletions
+15
-15
csv.py
Lib/csv.py
+1
-1
test_csv.py
Lib/test/test_csv.py
+7
-7
NEWS
Misc/NEWS
+1
-1
_csv.c
Modules/_csv.c
+6
-6
No files found.
Lib/csv.py
Dosyayı görüntüle @
31d8896e
...
...
@@ -6,7 +6,7 @@ csv.py - read/write/investigate CSV files
import
re
from
_csv
import
Error
,
__version__
,
writer
,
reader
,
register_dialect
,
\
unregister_dialect
,
get_dialect
,
list_dialects
,
\
set_field
_limit
,
\
field_size
_limit
,
\
QUOTE_MINIMAL
,
QUOTE_ALL
,
QUOTE_NONNUMERIC
,
QUOTE_NONE
,
\
__doc__
from
_csv
import
Dialect
as
_Dialect
...
...
Lib/test/test_csv.py
Dosyayı görüntüle @
31d8896e
...
...
@@ -233,21 +233,21 @@ class Test_Csv(unittest.TestCase):
def
test_read_bigfield
(
self
):
# This exercises the buffer realloc functionality and field size
# limits.
limit
=
csv
.
set_field
_limit
()
limit
=
csv
.
field_size
_limit
()
try
:
size
=
50000
bigstring
=
'X'
*
size
bigline
=
'
%
s,
%
s'
%
(
bigstring
,
bigstring
)
self
.
_read_test
([
bigline
],
[[
bigstring
,
bigstring
]])
csv
.
set_field
_limit
(
size
)
csv
.
field_size
_limit
(
size
)
self
.
_read_test
([
bigline
],
[[
bigstring
,
bigstring
]])
self
.
assertEqual
(
csv
.
set_field
_limit
(),
size
)
csv
.
set_field
_limit
(
size
-
1
)
self
.
assertEqual
(
csv
.
field_size
_limit
(),
size
)
csv
.
field_size
_limit
(
size
-
1
)
self
.
assertRaises
(
csv
.
Error
,
self
.
_read_test
,
[
bigline
],
[])
self
.
assertRaises
(
TypeError
,
csv
.
set_field
_limit
,
None
)
self
.
assertRaises
(
TypeError
,
csv
.
set_field
_limit
,
1
,
None
)
self
.
assertRaises
(
TypeError
,
csv
.
field_size
_limit
,
None
)
self
.
assertRaises
(
TypeError
,
csv
.
field_size
_limit
,
1
,
None
)
finally
:
csv
.
set_field
_limit
(
limit
)
csv
.
field_size
_limit
(
limit
)
class
TestDialectRegistry
(
unittest
.
TestCase
):
def
test_registry_badargs
(
self
):
...
...
Misc/NEWS
Dosyayı görüntüle @
31d8896e
...
...
@@ -57,7 +57,7 @@ Library
+ a configurable limit to the size of parsed fields has been added -
previously, an unmatched quote character could result in the entire
file being read into the field buffer before an error was reported.
+ A new module method csv.
set_field
_limit() has been added that sets
+ A new module method csv.
field_size
_limit() has been added that sets
the parser field size limit (returning the former limit). The initial
limit is 128kB.
+ reader and writer objects were not being registered with the cyclic-GC.
...
...
Modules/_csv.c
Dosyayı görüntüle @
31d8896e
...
...
@@ -1408,12 +1408,12 @@ csv_get_dialect(PyObject *module, PyObject *name_obj)
}
static
PyObject
*
csv_
set_field
_limit
(
PyObject
*
module
,
PyObject
*
args
)
csv_
field_size
_limit
(
PyObject
*
module
,
PyObject
*
args
)
{
PyObject
*
new_limit
=
NULL
;
long
old_limit
=
field_limit
;
if
(
!
PyArg_UnpackTuple
(
args
,
"
set_field
_limit"
,
0
,
1
,
&
new_limit
))
if
(
!
PyArg_UnpackTuple
(
args
,
"
field_size
_limit"
,
0
,
1
,
&
new_limit
))
return
NULL
;
if
(
new_limit
!=
NULL
)
{
if
(
!
PyInt_Check
(
new_limit
))
{
...
...
@@ -1533,9 +1533,9 @@ PyDoc_STRVAR(csv_unregister_dialect_doc,
"Delete the name/dialect mapping associated with a string name.
\n
"
" csv.unregister_dialect(name)"
);
PyDoc_STRVAR
(
csv_
set_field
_limit_doc
,
PyDoc_STRVAR
(
csv_
field_size
_limit_doc
,
"Sets an upper limit on parsed fields.
\n
"
" csv.
set_field
_limit([limit])
\n
"
" csv.
field_size
_limit([limit])
\n
"
"
\n
"
"Returns old limit. If limit is not given, no new limit is set and
\n
"
"the old limit is returned"
);
...
...
@@ -1553,8 +1553,8 @@ static struct PyMethodDef csv_methods[] = {
METH_O
,
csv_unregister_dialect_doc
},
{
"get_dialect"
,
(
PyCFunction
)
csv_get_dialect
,
METH_O
,
csv_get_dialect_doc
},
{
"
set_field_limit"
,
(
PyCFunction
)
csv_set_field
_limit
,
METH_VARARGS
,
csv_
set_field
_limit_doc
},
{
"
field_size_limit"
,
(
PyCFunction
)
csv_field_size
_limit
,
METH_VARARGS
,
csv_
field_size
_limit_doc
},
{
NULL
,
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