Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit e71d03b

Browse files
Merge branch 'main' into traceback-to-handle-error-msgs-with-period
2 parents cf1c2b0 + 96b7a2e commit e71d03b

File tree

4 files changed

+44
-53
lines changed

4 files changed

+44
-53
lines changed

.github/workflows/build.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,10 @@ jobs:
270270
fail-fast: false
271271
matrix:
272272
os: [ubuntu-24.04]
273-
openssl_ver: [3.0.17, 3.2.5, 3.3.4, 3.4.2, 3.5.2]
273+
# Keep 1.1.1w in our list despite it being upstream EOL and otherwise
274+
# unsupported as it most resembles other 1.1.1-work-a-like ssl APIs
275+
# supported by important vendors such as AWS-LC.
276+
openssl_ver: [1.1.1w, 3.0.17, 3.2.5, 3.3.4, 3.4.2, 3.5.2]
274277
# See Tools/ssl/make_ssl_data.py for notes on adding a new version
275278
env:
276279
OPENSSL_VER: ${{ matrix.openssl_ver }}

Doc/library/csv.rst

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ The :mod:`csv` module defines the following functions:
113113
spamwriter.writerow(['Spam', 'Lovely Spam', 'Wonderful Spam'])
114114

115115

116-
.. function:: register_dialect(name[, dialect[, **fmtparams]])
116+
.. function:: register_dialect(name, /, dialect='excel', **fmtparams)
117117

118118
Associate *dialect* with *name*. *name* must be a string. The
119119
dialect can be specified either by passing a sub-class of :class:`Dialect`, or
@@ -139,7 +139,8 @@ The :mod:`csv` module defines the following functions:
139139
Return the names of all registered dialects.
140140

141141

142-
.. function:: field_size_limit([new_limit])
142+
.. function:: field_size_limit()
143+
field_size_limit(new_limit)
143144

144145
Returns the current maximum field size allowed by the parser. If *new_limit* is
145146
given, this becomes the new limit.
@@ -526,7 +527,7 @@ out surrounded by parens. This may cause some problems for other programs which
526527
read CSV files (assuming they support complex numbers at all).
527528

528529

529-
.. method:: csvwriter.writerow(row)
530+
.. method:: csvwriter.writerow(row, /)
530531

531532
Write the *row* parameter to the writer's file object, formatted according
532533
to the current :class:`Dialect`. Return the return value of the call to the
@@ -535,7 +536,7 @@ read CSV files (assuming they support complex numbers at all).
535536
.. versionchanged:: 3.5
536537
Added support of arbitrary iterables.
537538

538-
.. method:: csvwriter.writerows(rows)
539+
.. method:: csvwriter.writerows(rows, /)
539540

540541
Write all elements in *rows* (an iterable of *row* objects as described
541542
above) to the writer's file object, formatted according to the current

Modules/_csv.c

Lines changed: 31 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1304,10 +1304,11 @@ join_append_lineterminator(WriterObj *self)
13041304
}
13051305

13061306
PyDoc_STRVAR(csv_writerow_doc,
1307-
"writerow(iterable)\n"
1307+
"writerow($self, row, /)\n"
1308+
"--\n\n"
1309+
"Construct and write a CSV record from an iterable of fields.\n"
13081310
"\n"
1309-
"Construct and write a CSV record from an iterable of fields. Non-string\n"
1310-
"elements will be converted to string.");
1311+
"Non-string elements will be converted to string.");
13111312

13121313
static PyObject *
13131314
csv_writerow(PyObject *op, PyObject *seq)
@@ -1414,10 +1415,11 @@ csv_writerow(PyObject *op, PyObject *seq)
14141415
}
14151416

14161417
PyDoc_STRVAR(csv_writerows_doc,
1417-
"writerows(iterable of iterables)\n"
1418+
"writerows($self, rows, /)\n"
1419+
"--\n\n"
1420+
"Construct and write a series of iterables to a csv file.\n"
14181421
"\n"
1419-
"Construct and write a series of iterables to a csv file. Non-string\n"
1420-
"elements will be converted to string.");
1422+
"Non-string elements will be converted to string.");
14211423

14221424
static PyObject *
14231425
csv_writerows(PyObject *self, PyObject *seqseq)
@@ -1574,13 +1576,11 @@ csv_writer(PyObject *module, PyObject *args, PyObject *keyword_args)
15741576
_csv.list_dialects
15751577
15761578
Return a list of all known dialect names.
1577-
1578-
names = csv.list_dialects()
15791579
[clinic start generated code]*/
15801580

15811581
static PyObject *
15821582
_csv_list_dialects_impl(PyObject *module)
1583-
/*[clinic end generated code: output=a5b92b215b006a6d input=8953943eb17d98ab]*/
1583+
/*[clinic end generated code: output=a5b92b215b006a6d input=ec58040aafd6a20a]*/
15841584
{
15851585
return PyDict_Keys(get_csv_state(module)->dialects);
15861586
}
@@ -1617,13 +1617,11 @@ _csv.unregister_dialect
16171617
name: object
16181618
16191619
Delete the name/dialect mapping associated with a string name.
1620-
1621-
csv.unregister_dialect(name)
16221620
[clinic start generated code]*/
16231621

16241622
static PyObject *
16251623
_csv_unregister_dialect_impl(PyObject *module, PyObject *name)
1626-
/*[clinic end generated code: output=0813ebca6c058df4 input=6b5c1557bf60c7e7]*/
1624+
/*[clinic end generated code: output=0813ebca6c058df4 input=e1cf81bfe3ba0f62]*/
16271625
{
16281626
_csvstate *module_state = get_csv_state(module);
16291627
int rc = PyDict_Pop(module_state->dialects, name, NULL);
@@ -1643,13 +1641,11 @@ _csv.get_dialect
16431641
name: object
16441642
16451643
Return the dialect instance associated with name.
1646-
1647-
dialect = csv.get_dialect(name)
16481644
[clinic start generated code]*/
16491645

16501646
static PyObject *
16511647
_csv_get_dialect_impl(PyObject *module, PyObject *name)
1652-
/*[clinic end generated code: output=aa988cd573bebebb input=edf9ddab32e448fb]*/
1648+
/*[clinic end generated code: output=aa988cd573bebebb input=74865c659dcb441f]*/
16531649
{
16541650
return get_dialect_from_registry(name, get_csv_state(module));
16551651
}
@@ -1661,15 +1657,13 @@ _csv.field_size_limit
16611657
16621658
Sets an upper limit on parsed fields.
16631659
1664-
csv.field_size_limit([limit])
1665-
16661660
Returns old limit. If limit is not given, no new limit is set and
16671661
the old limit is returned
16681662
[clinic start generated code]*/
16691663

16701664
static PyObject *
16711665
_csv_field_size_limit_impl(PyObject *module, PyObject *new_limit)
1672-
/*[clinic end generated code: output=f2799ecd908e250b input=cec70e9226406435]*/
1666+
/*[clinic end generated code: output=f2799ecd908e250b input=77db7485ee3ae90a]*/
16731667
{
16741668
_csvstate *module_state = get_csv_state(module);
16751669
Py_ssize_t old_limit = FT_ATOMIC_LOAD_SSIZE_RELAXED(module_state->field_limit);
@@ -1705,37 +1699,38 @@ PyType_Spec error_spec = {
17051699
PyDoc_STRVAR(csv_module_doc, "CSV parsing and writing.\n");
17061700

17071701
PyDoc_STRVAR(csv_reader_doc,
1708-
" csv_reader = reader(iterable [, dialect='excel']\n"
1709-
" [optional keyword args])\n"
1710-
" for row in csv_reader:\n"
1711-
" process(row)\n"
1702+
"reader($module, iterable, /, dialect='excel', **fmtparams)\n"
1703+
"--\n\n"
1704+
"Return a reader object that will process lines from the given iterable.\n"
17121705
"\n"
17131706
"The \"iterable\" argument can be any object that returns a line\n"
17141707
"of input for each iteration, such as a file object or a list. The\n"
1715-
"optional \"dialect\" parameter is discussed below. The function\n"
1708+
"optional \"dialect\" argument defines a CSV dialect. The function\n"
17161709
"also accepts optional keyword arguments which override settings\n"
17171710
"provided by the dialect.\n"
17181711
"\n"
17191712
"The returned object is an iterator. Each iteration returns a row\n"
17201713
"of the CSV file (which can span multiple input lines).\n");
17211714

17221715
PyDoc_STRVAR(csv_writer_doc,
1723-
" csv_writer = csv.writer(fileobj [, dialect='excel']\n"
1724-
" [optional keyword args])\n"
1725-
" for row in sequence:\n"
1726-
" csv_writer.writerow(row)\n"
1716+
"writer($module, fileobj, /, dialect='excel', **fmtparams)\n"
1717+
"--\n\n"
1718+
"Return a writer object that will write user data on the given file object.\n"
17271719
"\n"
1728-
" [or]\n"
1729-
"\n"
1730-
" csv_writer = csv.writer(fileobj [, dialect='excel']\n"
1731-
" [optional keyword args])\n"
1732-
" csv_writer.writerows(rows)\n"
1733-
"\n"
1734-
"The \"fileobj\" argument can be any object that supports the file API.\n");
1720+
"The \"fileobj\" argument can be any object that supports the file API.\n"
1721+
"The optional \"dialect\" argument defines a CSV dialect. The function\n"
1722+
"also accepts optional keyword arguments which override settings\n"
1723+
"provided by the dialect.\n");
17351724

17361725
PyDoc_STRVAR(csv_register_dialect_doc,
1737-
"Create a mapping from a string name to a dialect class.\n"
1738-
" dialect = csv.register_dialect(name[, dialect[, **fmtparams]])");
1726+
"register_dialect($module, name, /, dialect='excel', **fmtparams)\n"
1727+
"--\n\n"
1728+
"Create a mapping from a string name to a CVS dialect.\n"
1729+
"\n"
1730+
"The optional \"dialect\" argument specifies the base dialect instance\n"
1731+
"or the name of the registered dialect. The function also accepts\n"
1732+
"optional keyword arguments which override settings provided by the\n"
1733+
"dialect.\n");
17391734

17401735
static struct PyMethodDef csv_methods[] = {
17411736
{ "reader", _PyCFunction_CAST(csv_reader),

Modules/clinic/_csv.c.h

Lines changed: 4 additions & 12 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)