Skip to content

Commit 6bb04f1

Browse files
authored
Merge branch 'main' into subscope
2 parents ed24ee4 + a6ad448 commit 6bb04f1

10 files changed

Lines changed: 1024 additions & 258 deletions

File tree

‎Doc/library/json.rst‎

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,16 @@ Basic Usage
234234
If ``True``, dictionaries will be outputted sorted by key.
235235
Default ``False``.
236236

237+
.. note::
238+
239+
Keys in key/value pairs of JSON are always of the type :class:`str`. When
240+
a dictionary is converted into JSON, all the keys of the dictionary are
241+
converted to strings. As a result of this, if a dictionary is converted
242+
into JSON and then back into a dictionary, the dictionary may not equal
243+
the original one. That is, ``loads(dumps(x)) != x`` if x has non-string
244+
keys. *sort_keys* sorts the keys before they are converted to strings,
245+
so numeric keys are sorted by value, not by their string representation.
246+
237247
.. versionchanged:: 3.2
238248
Allow strings for *indent* in addition to integers.
239249

@@ -253,17 +263,6 @@ Basic Usage
253263
table <py-to-json-table>`. The arguments have the same meaning as in
254264
:func:`dump`.
255265

256-
.. note::
257-
258-
Keys in key/value pairs of JSON are always of the type :class:`str`. When
259-
a dictionary is converted into JSON, all the keys of the dictionary are
260-
coerced to strings. As a result of this, if a dictionary is converted
261-
into JSON and then back into a dictionary, the dictionary may not equal
262-
the original one. That is, ``loads(dumps(x)) != x`` if x has non-string
263-
keys.
264-
*sort_keys* sorts the keys before they are coerced to strings,
265-
so numeric keys are sorted by value, not by their string representation.
266-
267266
.. function:: load(fp, *, cls=None, object_hook=None, parse_float=None, \
268267
parse_int=None, parse_constant=None, \
269268
object_pairs_hook=None, array_hook=None, **kw)

‎Doc/reference/datamodel.rst‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1557,6 +1557,16 @@ Special read-only attributes
15571557
* - .. attribute:: codeobject.co_firstlineno
15581558
- The line number of the first line of the function
15591559

1560+
* - .. attribute:: codeobject.co_linetable
1561+
- A :class:`bytes` object containing encoded source location information.
1562+
The exact format is an implementation detail and may change between
1563+
Python versions. Use :meth:`~codeobject.co_lines` and
1564+
:meth:`~codeobject.co_positions` for supported access to line and
1565+
position information. To create a modified copy of a code object,
1566+
use :meth:`~codeobject.replace`.
1567+
1568+
.. versionadded:: 3.10
1569+
15601570
* - .. attribute:: codeobject.co_stacksize
15611571
- The required stack size of the code object
15621572

‎Lib/curses/__init__.py‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
"""
1212

1313
from _curses import *
14+
import _curses
1415
import os as _os
1516
import sys as _sys
1617

@@ -33,6 +34,7 @@ def initscr():
3334
if key.startswith(('ACS_', 'WACS_')) or key in ('LINES', 'COLS'):
3435
setattr(curses, key, value)
3536
return stdscr
37+
initscr.__doc__ = _curses.initscr.__doc__
3638

3739
# newterm() is wrapped for the same reason as initscr(): the ACS_* and WACS_*
3840
# constants and LINES/COLS only become available once a terminal is
@@ -50,6 +52,7 @@ def newterm(type=None, fd=None, infd=None, /):
5052
if key.startswith(('ACS_', 'WACS_')) or key in ('LINES', 'COLS'):
5153
setattr(curses, key, value)
5254
return screen
55+
newterm.__doc__ = _curses.newterm.__doc__
5356

5457
# This is a similar wrapper for start_color(), which adds the COLORS and
5558
# COLOR_PAIRS variables which are only available after start_color() is
@@ -60,6 +63,7 @@ def start_color():
6063
_curses.start_color()
6164
curses.COLORS = _curses.COLORS
6265
curses.COLOR_PAIRS = _curses.COLOR_PAIRS
66+
start_color.__doc__ = _curses.start_color.__doc__
6367

6468
# Import Python has_key() implementation if _curses doesn't contain has_key()
6569

‎Lib/test/test_inspect/test_inspect.py‎

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6378,15 +6378,10 @@ def test_thread_module_has_signatures(self):
63786378
self._test_module_has_signatures(_thread, no_signature)
63796379

63806380
def test_time_module_has_signatures(self):
6381-
no_signature = {
6382-
'asctime', 'ctime', 'get_clock_info', 'gmtime', 'localtime',
6383-
'strftime', 'strptime'
6384-
}
6385-
no_signature |= {name for name in
6386-
['clock_getres', 'clock_settime', 'clock_settime_ns',
6387-
'pthread_getcpuclockid']
6388-
if hasattr(time, name)}
6389-
self._test_module_has_signatures(time, no_signature)
6381+
no_signature = {'strftime', 'strptime'}
6382+
unsupported_signature = {'asctime'}
6383+
self._test_module_has_signatures(time, no_signature,
6384+
unsupported_signature)
63906385

63916386
def test_tokenize_module_has_signatures(self):
63926387
import tokenize

‎Lib/test/test_unittest/testmock/testhelpers.py‎

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
import inspect
2-
import time
32
import types
43
import unittest
54

5+
from test.support import import_helper
6+
67
from unittest.mock import (
78
call, _Call, create_autospec, MagicMock,
89
Mock, ANY, _CallList, patch, PropertyMock, _callable
@@ -929,8 +930,10 @@ def check_data_descriptor(mock_attr):
929930

930931

931932
def test_autospec_on_bound_builtin_function(self):
932-
meth = types.MethodType(time.ctime, time.time())
933-
self.assertIsInstance(meth(), str)
933+
_testcapi = import_helper.import_module('_testcapi')
934+
# This function is defined without a signature.
935+
meth = types.MethodType(_testcapi.docstring_no_signature, object())
936+
self.assertIsNone(meth())
934937
mocked = create_autospec(meth)
935938

936939
# no signature, so no spec to check against

‎Modules/_cursesmodule.c‎

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5536,7 +5536,14 @@ static PyMethodDef PyCursesScreen_methods[] = {
55365536
{NULL, NULL} /* sentinel */
55375537
};
55385538

5539+
PyDoc_STRVAR(PyCursesScreen_Type_doc,
5540+
"A curses screen.\n"
5541+
"\n"
5542+
"Screen objects are returned by newterm() and new_prescr(), and represent\n"
5543+
"a terminal together with its standard window, stdscr.");
5544+
55395545
static PyType_Slot PyCursesScreen_Type_slots[] = {
5546+
{Py_tp_doc, (void *)PyCursesScreen_Type_doc},
55405547
{Py_tp_methods, PyCursesScreen_methods},
55415548
{Py_tp_getset, PyCursesScreen_getsets},
55425549
{Py_tp_dealloc, PyCursesScreen_dealloc},
@@ -6931,12 +6938,12 @@ _curses.initscr
69316938
69326939
Initialize the library.
69336940
6934-
Return a WindowObject which represents the whole screen.
6941+
Return a window object which represents the whole screen.
69356942
[clinic start generated code]*/
69366943

69376944
static PyObject *
69386945
_curses_initscr_impl(PyObject *module)
6939-
/*[clinic end generated code: output=619fb68443810b7b input=514f4bce1821f6b5]*/
6946+
/*[clinic end generated code: output=619fb68443810b7b input=e2bf3a061b7d948a]*/
69406947
{
69416948
WINDOW *win;
69426949

‎Modules/clinic/_cursesmodule.c.h‎

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

0 commit comments

Comments
 (0)