Skip to content

Commit 80d951a

Browse files
committed
Fix supernumerary 's' in sys._debugmallocstats() output.
2 parents 1b93262 + b0a38fc commit 80d951a

808 files changed

Lines changed: 45561 additions & 69206 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: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ Lib/plat-mac/errors.rsrc.df.rsrc
2020
Makefile
2121
Makefile.pre
2222
Misc/python.pc
23+
Misc/python-config.sh
2324
Modules/Setup
2425
Modules/Setup.config
2526
Modules/Setup.local
@@ -57,6 +58,8 @@ platform
5758
pybuilddir.txt
5859
pyconfig.h
5960
python
61+
python-config
62+
python-config.py
6063
python.exe
6164
python-gdb.py
6265
python.exe-gdb.py

.hgignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
.gdb_history
22
.purify
33
.svn/
4+
DS_Store
45
Makefile$
56
Makefile.pre$
67
TAGS$
@@ -17,6 +18,8 @@ platform$
1718
pyconfig.h$
1819
python$
1920
python.exe$
21+
python-config$
22+
python-config.py$
2023
reflog.txt$
2124
tags$
2225
Lib/plat-mac/errors.rsrc.df.rsrc
@@ -26,6 +29,7 @@ Doc/tools/jinja/
2629
Doc/tools/jinja2/
2730
Doc/tools/pygments/
2831
Misc/python.pc
32+
Misc/python-config.sh$
2933
Modules/Setup$
3034
Modules/Setup.config
3135
Modules/Setup.local

Doc/c-api/dict.rst

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,15 @@ Dictionary Objects
110110
:c:type:`char\*`, rather than a :c:type:`PyObject\*`.
111111
112112
113+
.. c:function:: PyObject* PyDict_SetDefault(PyObject *p, PyObject *key, PyObject *default)
114+
115+
This is the same as the Python-level :meth:`dict.setdefault`. If present, it
116+
returns the value corresponding to *key* from the dictionary *p*. If the key
117+
is not in the dict, it is inserted with value *defaultobj* and *defaultobj*
118+
is returned. This function evaluates the hash function of *key* only once,
119+
instead of evaluating it independently for the lookup and the insertion.
120+
121+
113122
.. c:function:: PyObject* PyDict_Items(PyObject *p)
114123
115124
Return a :c:type:`PyListObject` containing all the items from the dictionary.

Doc/c-api/init.rst

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -654,6 +654,20 @@ with sub-interpreters:
654654
made on the main thread. This is mainly a helper/diagnostic function.
655655
656656
657+
.. c:function:: int PyGILState_Check()
658+
659+
Return 1 if the current thread is holding the GIL and 0 otherwise.
660+
This function can be called from any thread at any time.
661+
Only if it has had its Python thread state initialized and currently is
662+
holding the GIL will it return 1.
663+
This is mainly a helper/diagnostic function. It can be useful
664+
for example in callback contexts or memory allocation functions when
665+
knowing that the GIL is locked can allow the caller to perform sensitive
666+
actions or otherwise behave differently.
667+
668+
.. versionadded:: 3.4
669+
670+
657671
The following macros are normally used without a trailing semicolon; look for
658672
example usage in the Python source distribution.
659673

Doc/c-api/object.rst

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -342,6 +342,15 @@ is considered sufficient for this determination.
342342
returned. This is the equivalent to the Python expression ``len(o)``.
343343
344344
345+
.. c:function:: Py_ssize_t PyObject_LengthHint(PyObject *o, Py_ssize_t default)
346+
347+
Return an estimated length for the object *o*. First trying to return its
348+
actual length, then an estimate using ``__length_hint__``, and finally
349+
returning the default value. On error ``-1`` is returned. This is the
350+
equivalent to the Python expression ``operator.length_hint(o, default)``.
351+
352+
.. versionadded:: 3.4
353+
345354
.. c:function:: PyObject* PyObject_GetItem(PyObject *o, PyObject *key)
346355
347356
Return element of *o* corresponding to the object *key* or *NULL* on failure.

Doc/data/refcounts.dat

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,11 @@ PyDict_GetItemString:PyObject*::0:
220220
PyDict_GetItemString:PyObject*:p:0:
221221
PyDict_GetItemString:char*:key::
222222

223+
PyDict_SetDefault:PyObject*::0:
224+
PyDict_SetDefault:PyObject*:p:0:
225+
PyDict_SetDefault:PyObject*:key:0:conditionally +1 if inserted into the dict
226+
PyDict_SetDefault:PyObject*:default:0:conditionally +1 if inserted into the dict
227+
223228
PyDict_Items:PyObject*::+1:
224229
PyDict_Items:PyObject*:p:0:
225230

Doc/faq/library.rst

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ using curses, but curses is a fairly large module to learn.
211211
try:
212212
c = sys.stdin.read(1)
213213
print("Got character", repr(c))
214-
except IOError:
214+
except OSError:
215215
pass
216216
finally:
217217
termios.tcsetattr(fd, termios.TCSAFLUSH, oldterm)
@@ -224,7 +224,11 @@ using curses, but curses is a fairly large module to learn.
224224
:func:`termios.tcsetattr` turns off stdin's echoing and disables canonical
225225
mode. :func:`fcntl.fnctl` is used to obtain stdin's file descriptor flags
226226
and modify them for non-blocking mode. Since reading stdin when it is empty
227-
results in an :exc:`IOError`, this error is caught and ignored.
227+
results in an :exc:`OSError`, this error is caught and ignored.
228+
229+
.. versionchanged:: 3.3
230+
*sys.stdin.read* used to raise :exc:`IOError`. Starting from Python 3.3
231+
:exc:`IOError` is alias for :exc:`OSError`.
228232
229233
230234
Threads

Doc/howto/logging-cookbook.rst

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -741,9 +741,7 @@ the basis for code meeting your own specific requirements::
741741
break
742742
logger = logging.getLogger(record.name)
743743
logger.handle(record) # No level or filter logic applied - just do it!
744-
except (KeyboardInterrupt, SystemExit):
745-
raise
746-
except:
744+
except Exception:
747745
import sys, traceback
748746
print('Whoops! Problem:', file=sys.stderr)
749747
traceback.print_exc(file=sys.stderr)

Doc/library/2to3.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -342,6 +342,10 @@ and off individually. They are described here in more detail.
342342
343343
Handles the move of :func:`reduce` to :func:`functools.reduce`.
344344
345+
.. 2to3fixer:: reload
346+
347+
Converts :func:`reload` to :func:`imp.reload`.
348+
345349
.. 2to3fixer:: renames
346350
347351
Changes :data:`sys.maxint` to :data:`sys.maxsize`.

Doc/library/abc.rst

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@
1212
--------------
1313

1414
This module provides the infrastructure for defining :term:`abstract base
15-
classes <abstract base class>` (ABCs) in Python, as outlined in :pep:`3119`; see the PEP for why this
16-
was added to Python. (See also :pep:`3141` and the :mod:`numbers` module
17-
regarding a type hierarchy for numbers based on ABCs.)
15+
classes <abstract base class>` (ABCs) in Python, as outlined in :pep:`3119`;
16+
see the PEP for why this was added to Python. (See also :pep:`3141` and the
17+
:mod:`numbers` module regarding a type hierarchy for numbers based on ABCs.)
1818

1919
The :mod:`collections` module has some concrete classes that derive from
2020
ABCs; these can, of course, be further derived. In addition the
@@ -23,7 +23,7 @@ a class or instance provides a particular interface, for example, is it
2323
hashable or a mapping.
2424

2525

26-
This module provides the following class:
26+
This module provides the following classes:
2727

2828
.. class:: ABCMeta
2929

@@ -127,6 +127,19 @@ This module provides the following class:
127127
available as a method of ``Foo``, so it is provided separately.
128128

129129

130+
.. class:: ABC
131+
132+
A helper class that has :class:`ABCMeta` as its metaclass. With this class,
133+
an abstract base class can be created by simply deriving from :class:`ABC`,
134+
avoiding sometimes confusing metaclass usage.
135+
136+
Note that the type of :class:`ABC` is still :class:`ABCMeta`, therefore
137+
inheriting from :class:`ABC` requires the usual precautions regarding metaclass
138+
usage, as multiple inheritance may lead to metaclass conflicts.
139+
140+
.. versionadded:: 3.4
141+
142+
130143
The :mod:`abc` module also provides the following decorators:
131144

132145
.. decorator:: abstractmethod

0 commit comments

Comments
 (0)