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

Skip to content

Commit 50307b6

Browse files
committed
Add entries for array, asyncore, csv, compileall, and ast.
1 parent c3e8867 commit 50307b6

1 file changed

Lines changed: 60 additions & 1 deletion

File tree

Doc/whatsnew/3.2.rst

Lines changed: 60 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,11 @@ aspects that are visible to the programmer:
327327
'c:/py32/lib/__pycache__/collections.cpython-32.pyc'
328328

329329
* The :mod:`py_compile` and :mod:`compileall` modules have been updated to
330-
reflect the new naming convention and target directory.
330+
reflect the new naming convention and target directory. The command-line
331+
invocation of *compileall* has new command-line options include ``-i`` for
332+
specifying a list of files and directories to compile, and ``-b`` which causes
333+
bytecode files to be written to their legacy location rather than
334+
*__pycache__*.
331335

332336
* The :mod:`importlib.abc` module has been updated with new :term:`abstract base
333337
classes <abstract base class>` for the loading bytecode files. The obsolete
@@ -1013,6 +1017,30 @@ decorator, :func:`~reprlib.recursive_repr`, for detecting recursive calls to
10131017

10141018
(Contributed by Raymond Hettinger in :issue:`9826` and :issue:`9840`.)
10151019

1020+
csv
1021+
---
1022+
1023+
The :mod:`csv` module now supports a new dialect, :class:`~csv.unix_dialect`,
1024+
which applies quoting for all fields and a traditional Unix style with ``'\n'`` as
1025+
the line terminator. The registered dialect name is ``unix``.
1026+
1027+
The :class:`csv.DictWriter` has a new method,
1028+
:meth:`~csv.DictWriter.writeheader` for writing-out an initial row to document
1029+
the field names::
1030+
1031+
>>> import csv, sys
1032+
>>> w = csv.DictWriter(sys.stdout, ['name', 'dept'], dialect='unix')
1033+
>>> w.writeheader()
1034+
"name","dept"
1035+
>>> w.writerows([
1036+
{'name': 'tom', 'dept': 'accounting'},
1037+
{'name': 'susan', 'dept': 'Salesl'}])
1038+
"tom","accounting"
1039+
"susan","sales"
1040+
1041+
(New dialect suggested by Jay Talbot in :issue:`5975`, and the new method
1042+
suggested by Ed Abraham in :issue:`1537721`.)
1043+
10161044
contextlib
10171045
----------
10181046

@@ -1185,6 +1213,28 @@ wrong results.
11851213

11861214
(Patch submitted by Nir Aides in :issue:`7610`.)
11871215

1216+
ast
1217+
---
1218+
1219+
The :mod:`ast` module has a wonderful a general-purpose tool for safely
1220+
evaluating strings containing Python expressions using the Python literal
1221+
syntax. The :func:`ast.literal_eval` function serves as a secure alternative to
1222+
the builtin :func:`eval` function which is easily abused. Python 3.2 adds
1223+
:class:`bytes` and :class:`set` literals to the list of supported types:
1224+
strings, bytes, numbers, tuples, lists, dicts, sets, booleans, and None.
1225+
1226+
::
1227+
1228+
>>> request = "{'req': 3, 'func': 'pow', 'args': (2, 0.5)}"
1229+
>>> literal_eval(request)
1230+
{'args': (2, 0.5), 'req': 3, 'func': 'pow'}
1231+
1232+
>>> request = "os.system('do something harmful')"
1233+
>>> literal_eval(request)
1234+
Traceback (most recent call last):
1235+
...
1236+
ValueError: malformed node or string: <_ast.Call object at 0x101739a10>
1237+
11881238
os
11891239
--
11901240

@@ -2043,6 +2093,10 @@ require changes to your code:
20432093
* :class:`bytearray` objects can no longer be used as filenames; instead,
20442094
they should be converted to :class:`bytes`.
20452095

2096+
* The :meth:`array.tostring' and :meth:`array.fromstring` have been renamed to
2097+
:meth:`array.tobytes` and :meth:`array.frombytes` for clarity. The old names
2098+
have been deprecated. (See :issue:`8990`.)
2099+
20462100
* ``PyArg_Parse*()`` functions:
20472101

20482102
* "t#" format has been removed: use "s#" or "s*" instead
@@ -2125,3 +2179,8 @@ require changes to your code:
21252179
:c:func:`PyEval_ReleaseLock()` have been officially deprecated. The
21262180
thread-state aware APIs (such as :c:func:`PyEval_SaveThread()`
21272181
and :c:func:`PyEval_RestoreThread()`) should be used instead.
2182+
2183+
* Due to security risks, :func:`asyncore.handle_accept` has been deprecated, and
2184+
a new functions, :func:`asyncore.handle_accepted` was added to replace it.
2185+
2186+
(Contributed by Giampaolo Rodola in :issue:`6706`.)

0 commit comments

Comments
 (0)