Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
cd8eaf8
bpo-29692: contextlib.contextmanager may incorrectly unchain RuntimeE…
Mar 30, 2017
ac33e3d
bpo-29692: contextlib.contextmanager may incorrectly unchain RuntimeE…
Mar 30, 2017
7fddc7a
Remove an unrequired TODO in test_urllib2. (#897)
orsenthil Mar 30, 2017
4032e0a
bpo-29878: Add global instances of int for 0 and 1. (#852)
serhiy-storchaka Mar 30, 2017
c0ba6c3
bpo-24821: Fixed the slowing down to 25 times in the searching of som…
serhiy-storchaka Mar 30, 2017
cc08f5d
bpo-25996: Added support of file descriptors in os.scandir() on Unix.…
serhiy-storchaka Mar 30, 2017
e5961b9
bpo-29852: Argument Clinic Py_ssize_t converter now supports None (#716)
serhiy-storchaka Mar 30, 2017
fdfe71b
bpo-29816: Shift operation now has less opportunity to raise Overflow…
serhiy-storchaka Mar 30, 2017
938a17d
bpo-27863: Fixed multiple crashes in ElementTree. (#765)
serhiy-storchaka Mar 30, 2017
9ab918d
bpo-29918: Add missed "const" modifiers in C API documentation. (#846)
serhiy-storchaka Mar 30, 2017
c4c1b2b
bpo-29913: deprecate compare_networks() in documentation (GH-865)
s-sanjay Mar 30, 2017
aa6a3bd
bpo-20548: Use specific asserts in warnings and exceptions tests (#788)
serhiy-storchaka Mar 30, 2017
2a33050
bpo-29887: Test normalization now fails if download fails (#905)
vstinner Mar 30, 2017
7e6db02
bpo-29204: Emit warnings for already deprecated ElementTree features.…
serhiy-storchaka Mar 30, 2017
f8a4fe9
bpo-29935: Fixed error messages in the index() method of tuple, list …
serhiy-storchaka Mar 30, 2017
bc79e9d
bpo-10030: Sped up reading encrypted ZIP files by 2 times. (#550)
serhiy-storchaka Mar 30, 2017
882c4f8
bpo-29942: Fix the use of recursion in itertools.chain.from_iterable.…
Yhg1s Mar 30, 2017
d99f0ee
bpo-29946: Fix "sqrtpi defined but not used" (#908)
louisom Mar 30, 2017
2341664
bpo-29928: Add f-string to the Glossary (GH-864)
Mariatta Mar 30, 2017
a5136fd
Remove catching OSError in ftphandler test. Only URLError is raised i…
orsenthil Mar 31, 2017
20b8322
bpo-29952: Use usual terminology of dict (GH-917)
cocoatomo Mar 31, 2017
1b04170
suppress compiler warnings in _ctypes_test (#902)
benjaminp Mar 31, 2017
611baa5
bpo-29941: Assert fixes (#886)
Yhg1s Mar 31, 2017
f6418e8
Fix spurious MemoryError introduced by PR #886. (#930)
Yhg1s Mar 31, 2017
b1446d1
bpo-29953: Fix memory leaks in the replace() method of datetime and t…
serhiy-storchaka Mar 31, 2017
25a2dd7
Link to the devguide's PR guidelines (GH-932)
brettcannon Mar 31, 2017
cf01ec0
bpo-29763: Use unittest cleanup in test_site (GH-841)
zware Apr 1, 2017
67d0a63
Add helpful explaination to test_password_manager tests. (#936)
orsenthil Apr 1, 2017
67dc80e
bpo-29931 fix __lt__ check in ipaddress.ip_interface for both v4 and …
s-sanjay Apr 1, 2017
14aa5c3
Revert "bpo-29763: Use unittest cleanup in test_site (GH-841)" (GH-942)
zware Apr 1, 2017
918227e
bpo-29949: Fix set memory usage regression (GH-943)
methane Apr 1, 2017
d5b4965
bpo-29692: bpo-29692: contextlib.contextmanager may incorrectly uncha…
soolabettu Apr 1, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions .github/CONTRIBUTING.rst
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,8 @@ everything from how to build the code to submitting a pull request. There are
also suggestions on how you can most effectively help the project.

Please be aware that our workflow does deviate slightly from the typical GitHub
project. Issues are tracked at https://bugs.python.org/ and should be mentioned
in pull requests using the format of ``bpo-12345`` . If your pull request is in
response to a specific issue then please mention it in the title,
e.g. “bpo-12345: fix comment in tokenizer.c”.
project. Details on how to properly submit a pull request are covered in
`Lifecycle of a Pull Request <https://cpython-devguide.readthedocs.io/pullrequest.html>`_.

If you are making a code contribution or large documentation contribution,
please feel free to add yourself to the ``Misc/ACKS`` file alphabetically.
Expand Down
28 changes: 14 additions & 14 deletions Doc/c-api/arg.rst
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ which disallows mutable objects such as :class:`bytearray`.
attempting any conversion. Raises :exc:`TypeError` if the object is not
a :class:`bytearray` object. The C variable may also be declared as :c:type:`PyObject\*`.

``u`` (:class:`str`) [Py_UNICODE \*]
``u`` (:class:`str`) [const Py_UNICODE \*]
Convert a Python Unicode object to a C pointer to a NUL-terminated buffer of
Unicode characters. You must pass the address of a :c:type:`Py_UNICODE`
pointer variable, which will be filled with the pointer to an existing
Expand All @@ -151,16 +151,16 @@ which disallows mutable objects such as :class:`bytearray`.
Previously, :exc:`TypeError` was raised when embedded null code points
were encountered in the Python string.

``u#`` (:class:`str`) [Py_UNICODE \*, int]
``u#`` (:class:`str`) [const Py_UNICODE \*, int]
This variant on ``u`` stores into two C variables, the first one a pointer to a
Unicode data buffer, the second one its length. This variant allows
null code points.

``Z`` (:class:`str` or ``None``) [Py_UNICODE \*]
``Z`` (:class:`str` or ``None``) [const Py_UNICODE \*]
Like ``u``, but the Python object may also be ``None``, in which case the
:c:type:`Py_UNICODE` pointer is set to *NULL*.

``Z#`` (:class:`str` or ``None``) [Py_UNICODE \*, int]
``Z#`` (:class:`str` or ``None``) [const Py_UNICODE \*, int]
Like ``u#``, but the Python object may also be ``None``, in which case the
:c:type:`Py_UNICODE` pointer is set to *NULL*.

Expand Down Expand Up @@ -529,42 +529,42 @@ Building values
not within format units such as ``s#``). This can be used to make long format
strings a tad more readable.

``s`` (:class:`str` or ``None``) [char \*]
``s`` (:class:`str` or ``None``) [const char \*]
Convert a null-terminated C string to a Python :class:`str` object using ``'utf-8'``
encoding. If the C string pointer is *NULL*, ``None`` is used.

``s#`` (:class:`str` or ``None``) [char \*, int]
``s#`` (:class:`str` or ``None``) [const char \*, int]
Convert a C string and its length to a Python :class:`str` object using ``'utf-8'``
encoding. If the C string pointer is *NULL*, the length is ignored and
``None`` is returned.

``y`` (:class:`bytes`) [char \*]
``y`` (:class:`bytes`) [const char \*]
This converts a C string to a Python :class:`bytes` object. If the C
string pointer is *NULL*, ``None`` is returned.

``y#`` (:class:`bytes`) [char \*, int]
``y#`` (:class:`bytes`) [const char \*, int]
This converts a C string and its lengths to a Python object. If the C
string pointer is *NULL*, ``None`` is returned.

``z`` (:class:`str` or ``None``) [char \*]
``z`` (:class:`str` or ``None``) [const char \*]
Same as ``s``.

``z#`` (:class:`str` or ``None``) [char \*, int]
``z#`` (:class:`str` or ``None``) [const char \*, int]
Same as ``s#``.

``u`` (:class:`str`) [Py_UNICODE \*]
``u`` (:class:`str`) [const Py_UNICODE \*]
Convert a null-terminated buffer of Unicode (UCS-2 or UCS-4) data to a Python
Unicode object. If the Unicode buffer pointer is *NULL*, ``None`` is returned.

``u#`` (:class:`str`) [Py_UNICODE \*, int]
``u#`` (:class:`str`) [const Py_UNICODE \*, int]
Convert a Unicode (UCS-2 or UCS-4) data buffer and its length to a Python
Unicode object. If the Unicode buffer pointer is *NULL*, the length is ignored
and ``None`` is returned.

``U`` (:class:`str` or ``None``) [char \*]
``U`` (:class:`str` or ``None``) [const char \*]
Same as ``s``.

``U#`` (:class:`str` or ``None``) [char \*, int]
``U#`` (:class:`str` or ``None``) [const char \*, int]
Same as ``s#``.

``i`` (:class:`int`) [int]
Expand Down
4 changes: 2 additions & 2 deletions Doc/c-api/bytes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -96,10 +96,10 @@ called with a non-bytes parameter.
| :attr:`%x` | int | Exactly equivalent to |
| | | ``printf("%x")``. |
+-------------------+---------------+--------------------------------+
| :attr:`%s` | char\* | A null-terminated C character |
| :attr:`%s` | const char\* | A null-terminated C character |
| | | array. |
+-------------------+---------------+--------------------------------+
| :attr:`%p` | void\* | The hex representation of a C |
| :attr:`%p` | const void\* | The hex representation of a C |
| | | pointer. Mostly equivalent to |
| | | ``printf("%p")`` except that |
| | | it is guaranteed to start with |
Expand Down
4 changes: 2 additions & 2 deletions Doc/c-api/dict.rst
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ Dictionary Objects
.. index:: single: PyUnicode_FromString()

Insert *value* into the dictionary *p* using *key* as a key. *key* should
be a :c:type:`char\*`. The key object is created using
be a :c:type:`const char\*`. The key object is created using
``PyUnicode_FromString(key)``. Return ``0`` on success or ``-1`` on
failure.

Expand Down Expand Up @@ -107,7 +107,7 @@ Dictionary Objects
.. c:function:: PyObject* PyDict_GetItemString(PyObject *p, const char *key)

This is the same as :c:func:`PyDict_GetItem`, but *key* is specified as a
:c:type:`char\*`, rather than a :c:type:`PyObject\*`.
:c:type:`const char\*`, rather than a :c:type:`PyObject\*`.


.. c:function:: PyObject* PyDict_SetDefault(PyObject *p, PyObject *key, PyObject *default)
Expand Down
11 changes: 3 additions & 8 deletions Doc/c-api/import.rst
Original file line number Diff line number Diff line change
Expand Up @@ -231,11 +231,6 @@ Importing Modules
Finalize the import mechanism. For internal use only.


.. c:function:: PyObject* _PyImport_FindExtension(char *, char *)

For internal use only.


.. c:function:: int PyImport_ImportFrozenModuleObject(PyObject *name)

Load a frozen module named *name*. Return ``1`` for success, ``0`` if the
Expand Down Expand Up @@ -266,8 +261,8 @@ Importing Modules
is::

struct _frozen {
char *name;
unsigned char *code;
const char *name;
const unsigned char *code;
int size;
};

Expand Down Expand Up @@ -300,7 +295,7 @@ Importing Modules
The structure is defined in :file:`Include/import.h` as::

struct _inittab {
char *name; /* ASCII encoded string */
const char *name; /* ASCII encoded string */
PyObject* (*initfunc)(void);
};

Expand Down
8 changes: 4 additions & 4 deletions Doc/c-api/module.rst
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ Module Objects
.. versionadded:: 3.3


.. c:function:: char* PyModule_GetName(PyObject *module)
.. c:function:: const char* PyModule_GetName(PyObject *module)

Similar to :c:func:`PyModule_GetNameObject` but return the name encoded to
``'utf-8'``.
Expand Down Expand Up @@ -112,7 +112,7 @@ Module Objects
.. versionadded:: 3.2


.. c:function:: char* PyModule_GetFilename(PyObject *module)
.. c:function:: const char* PyModule_GetFilename(PyObject *module)

Similar to :c:func:`PyModule_GetFilenameObject` but return the filename
encoded to 'utf-8'.
Expand Down Expand Up @@ -146,11 +146,11 @@ or request "multi-phase initialization" by returning the definition struct itsel

Always initialize this member to :const:`PyModuleDef_HEAD_INIT`.

.. c:member:: char* m_name
.. c:member:: const char *m_name

Name for the new module.

.. c:member:: char* m_doc
.. c:member:: const char *m_doc

Docstring for the module; usually a docstring variable created with
:c:func:`PyDoc_STRVAR` is used.
Expand Down
68 changes: 34 additions & 34 deletions Doc/c-api/structures.rst
Original file line number Diff line number Diff line change
Expand Up @@ -125,20 +125,20 @@ the definition of all other Python objects.
Structure used to describe a method of an extension type. This structure has
four fields:

+------------------+-------------+-------------------------------+
| Field | C Type | Meaning |
+==================+=============+===============================+
| :attr:`ml_name` | char \* | name of the method |
+------------------+-------------+-------------------------------+
| :attr:`ml_meth` | PyCFunction | pointer to the C |
| | | implementation |
+------------------+-------------+-------------------------------+
| :attr:`ml_flags` | int | flag bits indicating how the |
| | | call should be constructed |
+------------------+-------------+-------------------------------+
| :attr:`ml_doc` | char \* | points to the contents of the |
| | | docstring |
+------------------+-------------+-------------------------------+
+------------------+---------------+-------------------------------+
| Field | C Type | Meaning |
+==================+===============+===============================+
| :attr:`ml_name` | const char \* | name of the method |
+------------------+---------------+-------------------------------+
| :attr:`ml_meth` | PyCFunction | pointer to the C |
| | | implementation |
+------------------+---------------+-------------------------------+
| :attr:`ml_flags` | int | flag bits indicating how the |
| | | call should be constructed |
+------------------+---------------+-------------------------------+
| :attr:`ml_doc` | const char \* | points to the contents of the |
| | | docstring |
+------------------+---------------+-------------------------------+

The :attr:`ml_meth` is a C function pointer. The functions may be of different
types, but they always return :c:type:`PyObject\*`. If the function is not of
Expand Down Expand Up @@ -236,25 +236,25 @@ definition with the same method name.
Structure which describes an attribute of a type which corresponds to a C
struct member. Its fields are:

+------------------+-------------+-------------------------------+
| Field | C Type | Meaning |
+==================+=============+===============================+
| :attr:`name` | char \* | name of the member |
+------------------+-------------+-------------------------------+
| :attr:`!type` | int | the type of the member in the |
| | | C struct |
+------------------+-------------+-------------------------------+
| :attr:`offset` | Py_ssize_t | the offset in bytes that the |
| | | member is located on the |
| | | type's object struct |
+------------------+-------------+-------------------------------+
| :attr:`flags` | int | flag bits indicating if the |
| | | field should be read-only or |
| | | writable |
+------------------+-------------+-------------------------------+
| :attr:`doc` | char \* | points to the contents of the |
| | | docstring |
+------------------+-------------+-------------------------------+
+------------------+---------------+-------------------------------+
| Field | C Type | Meaning |
+==================+===============+===============================+
| :attr:`name` | const char \* | name of the member |
+------------------+---------------+-------------------------------+
| :attr:`!type` | int | the type of the member in the |
| | | C struct |
+------------------+---------------+-------------------------------+
| :attr:`offset` | Py_ssize_t | the offset in bytes that the |
| | | member is located on the |
| | | type's object struct |
+------------------+---------------+-------------------------------+
| :attr:`flags` | int | flag bits indicating if the |
| | | field should be read-only or |
| | | writable |
+------------------+---------------+-------------------------------+
| :attr:`doc` | const char \* | points to the contents of the |
| | | docstring |
+------------------+---------------+-------------------------------+

:attr:`!type` can be one of many ``T_`` macros corresponding to various C
types. When the member is accessed in Python, it will be converted to the
Expand All @@ -268,7 +268,7 @@ definition with the same method name.
T_LONG long
T_FLOAT float
T_DOUBLE double
T_STRING char \*
T_STRING const char \*
T_OBJECT PyObject \*
T_OBJECT_EX PyObject \*
T_CHAR char
Expand Down
4 changes: 2 additions & 2 deletions Doc/c-api/sys.rst
Original file line number Diff line number Diff line change
Expand Up @@ -136,15 +136,15 @@ accessible to C code. They all work with the current interpreter thread's

Reset :data:`sys.warnoptions` to an empty list.

.. c:function:: void PySys_AddWarnOption(wchar_t *s)
.. c:function:: void PySys_AddWarnOption(const wchar_t *s)

Append *s* to :data:`sys.warnoptions`.

.. c:function:: void PySys_AddWarnOptionUnicode(PyObject *unicode)

Append *unicode* to :data:`sys.warnoptions`.

.. c:function:: void PySys_SetPath(wchar_t *path)
.. c:function:: void PySys_SetPath(const wchar_t *path)

Set :data:`sys.path` to a list object of paths found in *path* which should
be a list of paths separated with the platform's search path delimiter
Expand Down
24 changes: 12 additions & 12 deletions Doc/c-api/tuple.rst
Original file line number Diff line number Diff line change
Expand Up @@ -144,9 +144,9 @@ type.
+-------------------+------------------------------+------------------------------------+
| Field | C Type | Meaning |
+===================+==============================+====================================+
| ``name`` | ``char *`` | name of the struct sequence type |
| ``name`` | ``const char *`` | name of the struct sequence type |
+-------------------+------------------------------+------------------------------------+
| ``doc`` | ``char *`` | pointer to docstring for the type |
| ``doc`` | ``const char *`` | pointer to docstring for the type |
| | | or NULL to omit |
+-------------------+------------------------------+------------------------------------+
| ``fields`` | ``PyStructSequence_Field *`` | pointer to *NULL*-terminated array |
Expand All @@ -164,16 +164,16 @@ type.
:attr:`fields` array of the :c:type:`PyStructSequence_Desc` determines which
field of the struct sequence is described.

+-----------+---------------+--------------------------------------+
| Field | C Type | Meaning |
+===========+===============+======================================+
| ``name`` | ``char *`` | name for the field or *NULL* to end |
| | | the list of named fields, set to |
| | | PyStructSequence_UnnamedField to |
| | | leave unnamed |
+-----------+---------------+--------------------------------------+
| ``doc`` | ``char *`` | field docstring or *NULL* to omit |
+-----------+---------------+--------------------------------------+
+-----------+------------------+--------------------------------------+
| Field | C Type | Meaning |
+===========+==================+======================================+
| ``name`` | ``const char *`` | name for the field or *NULL* to end |
| | | the list of named fields, set to |
| | | PyStructSequence_UnnamedField to |
| | | leave unnamed |
+-----------+------------------+--------------------------------------+
| ``doc`` | ``const char *`` | field docstring or *NULL* to omit |
+-----------+------------------+--------------------------------------+


.. c:var:: char* PyStructSequence_UnnamedField
Expand Down
8 changes: 4 additions & 4 deletions Doc/c-api/unicode.rst
Original file line number Diff line number Diff line change
Expand Up @@ -490,10 +490,10 @@ APIs:
| :attr:`%x` | int | Exactly equivalent to |
| | | ``printf("%x")``. |
+-------------------+---------------------+--------------------------------+
| :attr:`%s` | char\* | A null-terminated C character |
| :attr:`%s` | const char\* | A null-terminated C character |
| | | array. |
+-------------------+---------------------+--------------------------------+
| :attr:`%p` | void\* | The hex representation of a C |
| :attr:`%p` | const void\* | The hex representation of a C |
| | | pointer. Mostly equivalent to |
| | | ``printf("%p")`` except that |
| | | it is guaranteed to start with |
Expand All @@ -506,8 +506,8 @@ APIs:
+-------------------+---------------------+--------------------------------+
| :attr:`%U` | PyObject\* | A unicode object. |
+-------------------+---------------------+--------------------------------+
| :attr:`%V` | PyObject\*, char \* | A unicode object (which may be |
| | | *NULL*) and a null-terminated |
| :attr:`%V` | PyObject\*, | A unicode object (which may be |
| | const char\* | *NULL*) and a null-terminated |
| | | C character array as a second |
| | | parameter (which will be used, |
| | | if the first parameter is |
Expand Down
6 changes: 3 additions & 3 deletions Doc/extending/extending.rst
Original file line number Diff line number Diff line change
Expand Up @@ -727,9 +727,9 @@ Philbrick (philbrick@hks.com)::
keywdarg_parrot(PyObject *self, PyObject *args, PyObject *keywds)
{
int voltage;
char *state = "a stiff";
char *action = "voom";
char *type = "Norwegian Blue";
const char *state = "a stiff";
const char *action = "voom";
const char *type = "Norwegian Blue";

static char *kwlist[] = {"voltage", "state", "action", "type", NULL};

Expand Down
6 changes: 3 additions & 3 deletions Doc/extending/newtypes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1361,9 +1361,9 @@ Here is a desultory example of the implementation of the call function. ::
newdatatype_call(newdatatypeobject *obj, PyObject *args, PyObject *other)
{
PyObject *result;
char *arg1;
char *arg2;
char *arg3;
const char *arg1;
const char *arg2;
const char *arg3;

if (!PyArg_ParseTuple(args, "sss:call", &arg1, &arg2, &arg3)) {
return NULL;
Expand Down
Loading