Skip to content

Commit b290483

Browse files
committed
merge with 3.2
2 parents 5291822 + f7b8875 commit b290483

1,111 files changed

Lines changed: 203899 additions & 50395 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ Doc/tools/jinja2/
1212
Doc/tools/pygments/
1313
Doc/tools/sphinx/
1414
Lib/lib2to3/*.pickle
15+
Lib/_sysconfigdata.py
1516
Makefile
1617
Makefile.pre
1718
Misc/python.pc

.hgeol

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,9 @@
2828

2929
Lib/email/test/data/msg_26.txt = BIN
3030
Lib/test/cjkencodings/* = BIN
31-
Lib/test/sndhdrdata/sndhdr.* = BIN
3231
Lib/test/decimaltestdata/*.decTest = BIN
32+
Lib/test/sndhdrdata/sndhdr.* = BIN
33+
Lib/test/test_email/data/msg_26.txt = BIN
3334

3435
# All other files (which presumably are human-editable) are "native".
3536
# This must be the last rule!

.hgignore

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ Makefile$
55
Makefile.pre$
66
TAGS$
77
autom4te.cache$
8-
build/
8+
^build/
9+
^Doc/build/
910
buildno$
1011
config.cache
1112
config.log
@@ -32,6 +33,7 @@ Modules/config.c
3233
Modules/ld_so_aix$
3334
Parser/pgen$
3435
Parser/pgen.stamp$
36+
PCbuild/amd64/
3537
^core
3638
^python-gdb.py
3739
^python.exe-gdb.py
@@ -47,6 +49,7 @@ libpython*.so*
4749
*.pyd
4850
*.cover
4951
*~
52+
Lib/_sysconfigdata.py
5053
Lib/lib2to3/*.pickle
5154
Lib/test/data/*
5255
Misc/*.wpu
@@ -62,7 +65,10 @@ PCbuild/*.exp
6265
PCbuild/*.o
6366
PCbuild/*.ncb
6467
PCbuild/*.bsc
68+
PCbuild/*.user
69+
PCbuild/*.suo
6570
PCbuild/Win32-temp-*
71+
PCbuild/x64-temp-*
6672
__pycache__
6773
Modules/_testembed
6874
.coverage

Doc/ACKS.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,7 @@ docs@python.org), and we'll be glad to correct the problem.
210210
* David Turner
211211
* Sandro Tosi
212212
* Ville Vainio
213+
* Nadeem Vawda
213214
* Martijn Vries
214215
* Charles G. Waldman
215216
* Greg Ward

Doc/c-api/arg.rst

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ Unless otherwise stated, buffers are not NUL-terminated.
146146
Like ``u#``, but the Python object may also be ``None``, in which case the
147147
:c:type:`Py_UNICODE` pointer is set to *NULL*.
148148

149-
``U`` (:class:`str`) [PyUnicodeObject \*]
149+
``U`` (:class:`str`) [PyObject \*]
150150
Requires that the Python object is a Unicode object, without attempting
151151
any conversion. Raises :exc:`TypeError` if the object is not a Unicode
152152
object. The C variable may also be declared as :c:type:`PyObject\*`.
@@ -260,9 +260,11 @@ Numbers
260260
``n`` (:class:`int`) [Py_ssize_t]
261261
Convert a Python integer to a C :c:type:`Py_ssize_t`.
262262

263-
``c`` (:class:`bytes` of length 1) [char]
264-
Convert a Python byte, represented as a :class:`bytes` object of length 1,
265-
to a C :c:type:`char`.
263+
``c`` (:class:`bytes` or :class:`bytearray` of length 1) [char]
264+
Convert a Python byte, represented as a :class:`bytes` or
265+
:class:`bytearray` object of length 1, to a C :c:type:`char`.
266+
267+
.. versionchanged:: 3.3 Allow :class:`bytearray` objects
266268

267269
``C`` (:class:`str` of length 1) [int]
268270
Convert a Python character, represented as a :class:`str` object of

Doc/c-api/datetime.rst

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,31 @@ and the type is not checked:
170170
Return the microsecond, as an int from 0 through 999999.
171171
172172
173+
Macros to extract fields from time delta objects. The argument must be an
174+
instance of :c:data:`PyDateTime_Delta`, including subclasses. The argument must
175+
not be *NULL*, and the type is not checked:
176+
177+
.. c:function:: int PyDateTime_DELTA_GET_DAYS(PyDateTime_Delta *o)
178+
179+
Return the number of days, as an int from -999999999 to 999999999.
180+
181+
.. versionadded:: 3.3
182+
183+
184+
.. c:function:: int PyDateTime_DELTA_GET_SECONDS(PyDateTime_Delta *o)
185+
186+
Return the number of seconds, as an int from 0 through 86399.
187+
188+
.. versionadded:: 3.3
189+
190+
191+
.. c:function:: int PyDateTime_DELTA_GET_MICROSECOND(PyDateTime_Delta *o)
192+
193+
Return the number of microseconds, as an int from 0 through 999999.
194+
195+
.. versionadded:: 3.3
196+
197+
173198
Macros for the convenience of modules implementing the DB API:
174199
175200
.. c:function:: PyObject* PyDateTime_FromTimestamp(PyObject *args)

Doc/c-api/dict.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,3 +209,10 @@ Dictionary Objects
209209
for key, value in seq2:
210210
if override or key not in a:
211211
a[key] = value
212+
213+
214+
.. c:function:: int PyDict_ClearFreeList()
215+
216+
Clear the free list. Return the total number of freed items.
217+
218+
.. versionadded:: 3.3

Doc/c-api/exceptions.rst

Lines changed: 128 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -525,7 +525,7 @@ recursion depth automatically).
525525
526526
Marks a point where a recursive C-level call is about to be performed.
527527
528-
If :const:`USE_STACKCHECK` is defined, this function checks if the the OS
528+
If :const:`USE_STACKCHECK` is defined, this function checks if the OS
529529
stack overflowed using :c:func:`PyOS_CheckStack`. In this is the case, it
530530
sets a :exc:`MemoryError` and returns a nonzero value.
531531
@@ -582,65 +582,116 @@ All standard Python exceptions are available as global variables whose names are
582582
:c:type:`PyObject\*`; they are all class objects. For completeness, here are all
583583
the variables:
584584
585-
+-------------------------------------+----------------------------+----------+
586-
| C Name | Python Name | Notes |
587-
+=====================================+============================+==========+
588-
| :c:data:`PyExc_BaseException` | :exc:`BaseException` | \(1) |
589-
+-------------------------------------+----------------------------+----------+
590-
| :c:data:`PyExc_Exception` | :exc:`Exception` | \(1) |
591-
+-------------------------------------+----------------------------+----------+
592-
| :c:data:`PyExc_ArithmeticError` | :exc:`ArithmeticError` | \(1) |
593-
+-------------------------------------+----------------------------+----------+
594-
| :c:data:`PyExc_LookupError` | :exc:`LookupError` | \(1) |
595-
+-------------------------------------+----------------------------+----------+
596-
| :c:data:`PyExc_AssertionError` | :exc:`AssertionError` | |
597-
+-------------------------------------+----------------------------+----------+
598-
| :c:data:`PyExc_AttributeError` | :exc:`AttributeError` | |
599-
+-------------------------------------+----------------------------+----------+
600-
| :c:data:`PyExc_EOFError` | :exc:`EOFError` | |
601-
+-------------------------------------+----------------------------+----------+
602-
| :c:data:`PyExc_EnvironmentError` | :exc:`EnvironmentError` | \(1) |
603-
+-------------------------------------+----------------------------+----------+
604-
| :c:data:`PyExc_FloatingPointError` | :exc:`FloatingPointError` | |
605-
+-------------------------------------+----------------------------+----------+
606-
| :c:data:`PyExc_IOError` | :exc:`IOError` | |
607-
+-------------------------------------+----------------------------+----------+
608-
| :c:data:`PyExc_ImportError` | :exc:`ImportError` | |
609-
+-------------------------------------+----------------------------+----------+
610-
| :c:data:`PyExc_IndexError` | :exc:`IndexError` | |
611-
+-------------------------------------+----------------------------+----------+
612-
| :c:data:`PyExc_KeyError` | :exc:`KeyError` | |
613-
+-------------------------------------+----------------------------+----------+
614-
| :c:data:`PyExc_KeyboardInterrupt` | :exc:`KeyboardInterrupt` | |
615-
+-------------------------------------+----------------------------+----------+
616-
| :c:data:`PyExc_MemoryError` | :exc:`MemoryError` | |
617-
+-------------------------------------+----------------------------+----------+
618-
| :c:data:`PyExc_NameError` | :exc:`NameError` | |
619-
+-------------------------------------+----------------------------+----------+
620-
| :c:data:`PyExc_NotImplementedError` | :exc:`NotImplementedError` | |
621-
+-------------------------------------+----------------------------+----------+
622-
| :c:data:`PyExc_OSError` | :exc:`OSError` | |
623-
+-------------------------------------+----------------------------+----------+
624-
| :c:data:`PyExc_OverflowError` | :exc:`OverflowError` | |
625-
+-------------------------------------+----------------------------+----------+
626-
| :c:data:`PyExc_ReferenceError` | :exc:`ReferenceError` | \(2) |
627-
+-------------------------------------+----------------------------+----------+
628-
| :c:data:`PyExc_RuntimeError` | :exc:`RuntimeError` | |
629-
+-------------------------------------+----------------------------+----------+
630-
| :c:data:`PyExc_SyntaxError` | :exc:`SyntaxError` | |
631-
+-------------------------------------+----------------------------+----------+
632-
| :c:data:`PyExc_SystemError` | :exc:`SystemError` | |
633-
+-------------------------------------+----------------------------+----------+
634-
| :c:data:`PyExc_SystemExit` | :exc:`SystemExit` | |
635-
+-------------------------------------+----------------------------+----------+
636-
| :c:data:`PyExc_TypeError` | :exc:`TypeError` | |
637-
+-------------------------------------+----------------------------+----------+
638-
| :c:data:`PyExc_ValueError` | :exc:`ValueError` | |
639-
+-------------------------------------+----------------------------+----------+
640-
| :c:data:`PyExc_WindowsError` | :exc:`WindowsError` | \(3) |
641-
+-------------------------------------+----------------------------+----------+
642-
| :c:data:`PyExc_ZeroDivisionError` | :exc:`ZeroDivisionError` | |
643-
+-------------------------------------+----------------------------+----------+
585+
+-----------------------------------------+---------------------------------+----------+
586+
| C Name | Python Name | Notes |
587+
+=========================================+=================================+==========+
588+
| :c:data:`PyExc_BaseException` | :exc:`BaseException` | \(1) |
589+
+-----------------------------------------+---------------------------------+----------+
590+
| :c:data:`PyExc_Exception` | :exc:`Exception` | \(1) |
591+
+-----------------------------------------+---------------------------------+----------+
592+
| :c:data:`PyExc_ArithmeticError` | :exc:`ArithmeticError` | \(1) |
593+
+-----------------------------------------+---------------------------------+----------+
594+
| :c:data:`PyExc_LookupError` | :exc:`LookupError` | \(1) |
595+
+-----------------------------------------+---------------------------------+----------+
596+
| :c:data:`PyExc_AssertionError` | :exc:`AssertionError` | |
597+
+-----------------------------------------+---------------------------------+----------+
598+
| :c:data:`PyExc_AttributeError` | :exc:`AttributeError` | |
599+
+-----------------------------------------+---------------------------------+----------+
600+
| :c:data:`PyExc_BlockingIOError` | :exc:`BlockingIOError` | |
601+
+-----------------------------------------+---------------------------------+----------+
602+
| :c:data:`PyExc_BrokenPipeError` | :exc:`BrokenPipeError` | |
603+
+-----------------------------------------+---------------------------------+----------+
604+
| :c:data:`PyExc_ChildProcessError` | :exc:`ChildProcessError` | |
605+
+-----------------------------------------+---------------------------------+----------+
606+
| :c:data:`PyExc_ConnectionError` | :exc:`ConnectionError` | |
607+
+-----------------------------------------+---------------------------------+----------+
608+
| :c:data:`PyExc_ConnectionAbortedError` | :exc:`ConnectionAbortedError` | |
609+
+-----------------------------------------+---------------------------------+----------+
610+
| :c:data:`PyExc_ConnectionRefusedError` | :exc:`ConnectionRefusedError` | |
611+
+-----------------------------------------+---------------------------------+----------+
612+
| :c:data:`PyExc_ConnectionResetError` | :exc:`ConnectionResetError` | |
613+
+-----------------------------------------+---------------------------------+----------+
614+
| :c:data:`PyExc_FileExistsError` | :exc:`FileExistsError` | |
615+
+-----------------------------------------+---------------------------------+----------+
616+
| :c:data:`PyExc_FileNotFoundError` | :exc:`FileNotFoundError` | |
617+
+-----------------------------------------+---------------------------------+----------+
618+
| :c:data:`PyExc_EOFError` | :exc:`EOFError` | |
619+
+-----------------------------------------+---------------------------------+----------+
620+
| :c:data:`PyExc_FloatingPointError` | :exc:`FloatingPointError` | |
621+
+-----------------------------------------+---------------------------------+----------+
622+
| :c:data:`PyExc_ImportError` | :exc:`ImportError` | |
623+
+-----------------------------------------+---------------------------------+----------+
624+
| :c:data:`PyExc_IndexError` | :exc:`IndexError` | |
625+
+-----------------------------------------+---------------------------------+----------+
626+
| :c:data:`PyExc_InterruptedError` | :exc:`InterruptedError` | |
627+
+-----------------------------------------+---------------------------------+----------+
628+
| :c:data:`PyExc_IsADirectoryError` | :exc:`IsADirectoryError` | |
629+
+-----------------------------------------+---------------------------------+----------+
630+
| :c:data:`PyExc_KeyError` | :exc:`KeyError` | |
631+
+-----------------------------------------+---------------------------------+----------+
632+
| :c:data:`PyExc_KeyboardInterrupt` | :exc:`KeyboardInterrupt` | |
633+
+-----------------------------------------+---------------------------------+----------+
634+
| :c:data:`PyExc_MemoryError` | :exc:`MemoryError` | |
635+
+-----------------------------------------+---------------------------------+----------+
636+
| :c:data:`PyExc_NameError` | :exc:`NameError` | |
637+
+-----------------------------------------+---------------------------------+----------+
638+
| :c:data:`PyExc_NotADirectoryError` | :exc:`NotADirectoryError` | |
639+
+-----------------------------------------+---------------------------------+----------+
640+
| :c:data:`PyExc_NotImplementedError` | :exc:`NotImplementedError` | |
641+
+-----------------------------------------+---------------------------------+----------+
642+
| :c:data:`PyExc_OSError` | :exc:`OSError` | \(1) |
643+
+-----------------------------------------+---------------------------------+----------+
644+
| :c:data:`PyExc_OverflowError` | :exc:`OverflowError` | |
645+
+-----------------------------------------+---------------------------------+----------+
646+
| :c:data:`PyExc_PermissionError` | :exc:`PermissionError` | |
647+
+-----------------------------------------+---------------------------------+----------+
648+
| :c:data:`PyExc_ProcessLookupError` | :exc:`ProcessLookupError` | |
649+
+-----------------------------------------+---------------------------------+----------+
650+
| :c:data:`PyExc_ReferenceError` | :exc:`ReferenceError` | \(2) |
651+
+-----------------------------------------+---------------------------------+----------+
652+
| :c:data:`PyExc_RuntimeError` | :exc:`RuntimeError` | |
653+
+-----------------------------------------+---------------------------------+----------+
654+
| :c:data:`PyExc_SyntaxError` | :exc:`SyntaxError` | |
655+
+-----------------------------------------+---------------------------------+----------+
656+
| :c:data:`PyExc_SystemError` | :exc:`SystemError` | |
657+
+-----------------------------------------+---------------------------------+----------+
658+
| :c:data:`PyExc_TimeoutError` | :exc:`TimeoutError` | |
659+
+-----------------------------------------+---------------------------------+----------+
660+
| :c:data:`PyExc_SystemExit` | :exc:`SystemExit` | |
661+
+-----------------------------------------+---------------------------------+----------+
662+
| :c:data:`PyExc_TypeError` | :exc:`TypeError` | |
663+
+-----------------------------------------+---------------------------------+----------+
664+
| :c:data:`PyExc_ValueError` | :exc:`ValueError` | |
665+
+-----------------------------------------+---------------------------------+----------+
666+
| :c:data:`PyExc_ZeroDivisionError` | :exc:`ZeroDivisionError` | |
667+
+-----------------------------------------+---------------------------------+----------+
668+
669+
.. versionadded:: 3.3
670+
:c:data:`PyExc_BlockingIOError`, :c:data:`PyExc_BrokenPipeError`,
671+
:c:data:`PyExc_ChildProcessError`, :c:data:`PyExc_ConnectionError`,
672+
:c:data:`PyExc_ConnectionAbortedError`, :c:data:`PyExc_ConnectionRefusedError`,
673+
:c:data:`PyExc_ConnectionResetError`, :c:data:`PyExc_FileExistsError`,
674+
:c:data:`PyExc_FileNotFoundError`, :c:data:`PyExc_InterruptedError`,
675+
:c:data:`PyExc_IsADirectoryError`, :c:data:`PyExc_NotADirectoryError`,
676+
:c:data:`PyExc_PermissionError`, :c:data:`PyExc_ProcessLookupError`
677+
and :c:data:`PyExc_TimeoutError` were introduced following :pep:`3151`.
678+
679+
680+
These are compatibility aliases to :c:data:`PyExc_OSError`:
681+
682+
+-------------------------------------+----------+
683+
| C Name | Notes |
684+
+=====================================+==========+
685+
| :c:data:`PyExc_EnvironmentError` | |
686+
+-------------------------------------+----------+
687+
| :c:data:`PyExc_IOError` | |
688+
+-------------------------------------+----------+
689+
| :c:data:`PyExc_WindowsError` | \(3) |
690+
+-------------------------------------+----------+
691+
692+
.. versionchanged:: 3.3
693+
These aliases used to be separate exception types.
694+
644695
645696
.. index::
646697
single: PyExc_BaseException
@@ -649,28 +700,42 @@ the variables:
649700
single: PyExc_LookupError
650701
single: PyExc_AssertionError
651702
single: PyExc_AttributeError
703+
single: PyExc_BlockingIOError
704+
single: PyExc_BrokenPipeError
705+
single: PyExc_ConnectionError
706+
single: PyExc_ConnectionAbortedError
707+
single: PyExc_ConnectionRefusedError
708+
single: PyExc_ConnectionResetError
652709
single: PyExc_EOFError
653-
single: PyExc_EnvironmentError
710+
single: PyExc_FileExistsError
711+
single: PyExc_FileNotFoundError
654712
single: PyExc_FloatingPointError
655-
single: PyExc_IOError
656713
single: PyExc_ImportError
657714
single: PyExc_IndexError
715+
single: PyExc_InterruptedError
716+
single: PyExc_IsADirectoryError
658717
single: PyExc_KeyError
659718
single: PyExc_KeyboardInterrupt
660719
single: PyExc_MemoryError
661720
single: PyExc_NameError
721+
single: PyExc_NotADirectoryError
662722
single: PyExc_NotImplementedError
663723
single: PyExc_OSError
664724
single: PyExc_OverflowError
725+
single: PyExc_PermissionError
726+
single: PyExc_ProcessLookupError
665727
single: PyExc_ReferenceError
666728
single: PyExc_RuntimeError
667729
single: PyExc_SyntaxError
668730
single: PyExc_SystemError
669731
single: PyExc_SystemExit
732+
single: PyExc_TimeoutError
670733
single: PyExc_TypeError
671734
single: PyExc_ValueError
672-
single: PyExc_WindowsError
673735
single: PyExc_ZeroDivisionError
736+
single: PyExc_EnvironmentError
737+
single: PyExc_IOError
738+
single: PyExc_WindowsError
674739
675740
Notes:
676741

Doc/c-api/function.rst

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,16 @@ There are a few functions specific to Python functions.
3838
object, the argument defaults and closure are set to *NULL*.
3939
4040
41+
.. c:function:: PyObject* PyFunction_NewWithQualName(PyObject *code, PyObject *globals, PyObject *qualname)
42+
43+
As :c:func:`PyFunction_New`, but also allows to set the function object's
44+
``__qualname__`` attribute. *qualname* should be a unicode object or NULL;
45+
if NULL, the ``__qualname__`` attribute is set to the same value as its
46+
``__name__`` attribute.
47+
48+
.. versionadded:: 3.3
49+
50+
4151
.. c:function:: PyObject* PyFunction_GetCode(PyObject *op)
4252
4353
Return the code object associated with the function object *op*.

0 commit comments

Comments
 (0)