Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
14 changes: 7 additions & 7 deletions Lib/test/test_clinic.py
Original file line number Diff line number Diff line change
Expand Up @@ -5708,7 +5708,7 @@ def errmsg(name):
def test_lone_kwds(self):
with self.assertRaises(TypeError):
ac_tester.lone_kwds(1, 2)
self.assertEqual(ac_tester.lone_kwds(), ({},))
self.assertEqual(ac_tester.lone_kwds(), (None,))
self.assertEqual(ac_tester.lone_kwds(y='y'), ({'y': 'y'},))
kwds = {'y': 'y', 'z': 'z'}
self.assertEqual(ac_tester.lone_kwds(y='y', z='z'), (kwds,))
Expand All @@ -5721,7 +5721,7 @@ def test_kwds_with_pos_only(self):
ac_tester.kwds_with_pos_only(y='y')
with self.assertRaises(TypeError):
ac_tester.kwds_with_pos_only(1, y='y')
self.assertEqual(ac_tester.kwds_with_pos_only(1, 2), (1, 2, {}))
self.assertEqual(ac_tester.kwds_with_pos_only(1, 2), (1, 2, None))
self.assertEqual(ac_tester.kwds_with_pos_only(1, 2, y='y'), (1, 2, {'y': 'y'}))
kwds = {'y': 'y', 'z': 'z'}
self.assertEqual(ac_tester.kwds_with_pos_only(1, 2, y='y', z='z'), (1, 2, kwds))
Expand All @@ -5732,16 +5732,16 @@ def test_kwds_with_optional_pos_only(self):
ac_tester.kwds_with_optional_pos_only()
with self.assertRaises(TypeError):
ac_tester.kwds_with_optional_pos_only(y='y')
self.assertEqual(ac_tester.kwds_with_optional_pos_only(1), (1, None, {}))
self.assertEqual(ac_tester.kwds_with_optional_pos_only(1, 2), (1, 2, {}))
self.assertEqual(ac_tester.kwds_with_optional_pos_only(1), (1, None, None))
self.assertEqual(ac_tester.kwds_with_optional_pos_only(1, 2), (1, 2, None))
self.assertEqual(ac_tester.kwds_with_optional_pos_only(1, y='y'),
(1, None, {'y': 'y'}))
self.assertEqual(ac_tester.kwds_with_optional_pos_only(1, 2, y='y'),
(1, 2, {'y': 'y'}))

def test_kwds_with_stararg(self):
self.assertEqual(ac_tester.kwds_with_stararg(), ((), {}))
self.assertEqual(ac_tester.kwds_with_stararg(1, 2), ((1, 2), {}))
self.assertEqual(ac_tester.kwds_with_stararg(), ((), None))
self.assertEqual(ac_tester.kwds_with_stararg(1, 2), ((1, 2), None))
self.assertEqual(ac_tester.kwds_with_stararg(y='y'), ((), {'y': 'y'}))
args = (1, 2)
kwds = {'y': 'y', 'z': 'z'}
Expand All @@ -5753,7 +5753,7 @@ def test_kwds_with_pos_only_and_stararg(self):
ac_tester.kwds_with_pos_only_and_stararg()
with self.assertRaises(TypeError):
ac_tester.kwds_with_pos_only_and_stararg(y='y')
self.assertEqual(ac_tester.kwds_with_pos_only_and_stararg(1, 2), (1, 2, (), {}))
self.assertEqual(ac_tester.kwds_with_pos_only_and_stararg(1, 2), (1, 2, (), None))
self.assertEqual(ac_tester.kwds_with_pos_only_and_stararg(1, 2, y='y'), (1, 2, (), {'y': 'y'}))
args = ('lobster', 'thermidor')
kwds = {'y': 'y', 'z': 'z'}
Expand Down
4 changes: 2 additions & 2 deletions Modules/_elementtree.c
Original file line number Diff line number Diff line change
Expand Up @@ -640,11 +640,11 @@ _elementtree_SubElement_impl(PyObject *module, PyObject *parent,
attrib = PyDict_Copy(attrib);
if (!attrib)
return NULL;
if (PyDict_Update(attrib, extra) < 0) {
if (extra && PyDict_Update(attrib, extra) < 0) {
Py_DECREF(attrib);
return NULL;
}
} else if (PyDict_GET_SIZE(extra)) {
} else if (extra && PyDict_GET_SIZE(extra)) {
/* have keyword args */
attrib = get_attrib_from_keywords(extra);
if (!attrib)
Expand Down
2 changes: 1 addition & 1 deletion Modules/_interpretersmodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -828,7 +828,7 @@ _interpreters_new_config_impl(PyObject *module, const char *name,
return NULL;
}

if (PyDict_GET_SIZE(overrides) > 0) {
if (overrides != NULL && PyDict_GET_SIZE(overrides) > 0) {
if (_PyInterpreterConfig_UpdateFromDict(&config, overrides) < 0) {
return NULL;
}
Expand Down
3 changes: 2 additions & 1 deletion Modules/atexitmodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,8 @@ atexit_register_impl(PyObject *module, PyObject *func, PyObject *args,
"the first argument must be callable");
return NULL;
}
PyObject *callback = PyTuple_Pack(3, func, args, kwargs);
PyObject *callback = PyTuple_Pack(3, func, args,
kwargs ? kwargs : Py_None);
if (callback == NULL)
{
return NULL;
Expand Down
42 changes: 5 additions & 37 deletions Modules/clinic/_csv.c.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 2 additions & 10 deletions Modules/clinic/_elementtree.c.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 2 additions & 10 deletions Modules/clinic/_interpretersmodule.c.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

53 changes: 6 additions & 47 deletions Modules/clinic/_testclinic_kwds.c.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 2 additions & 10 deletions Modules/clinic/_zoneinfo.c.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 2 additions & 10 deletions Modules/clinic/atexitmodule.c.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 2 additions & 10 deletions Objects/clinic/namespaceobject.c.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 2 additions & 10 deletions Objects/clinic/structseq.c.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion Objects/namespaceobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,9 @@ namespace___replace___impl(_PyNamespaceObject *self, PyObject *changes)
Py_DECREF(result);
return NULL;
}
if (PyDict_Update(((_PyNamespaceObject*)result)->ns_dict, changes) < 0) {
if (changes != NULL
&& PyDict_Update(((_PyNamespaceObject*)result)->ns_dict, changes) < 0)
{
Py_DECREF(result);
return NULL;
}
Expand Down
Loading
Loading