Skip to content

Commit d322abb

Browse files
[3.8] bpo-37206: Unrepresentable default values no longer represented as None. (GH-13933) (GH-16141)
In ArgumentClinic, value "NULL" should now be used only for unrepresentable default values (like in the optional third parameter of getattr). "None" should be used if None is accepted as argument and passing None has the same effect as not passing the argument at all. (cherry picked from commit 279f446) Co-authored-by: Serhiy Storchaka <[email protected]>
1 parent 66da347 commit d322abb

Some content is hidden

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

45 files changed

+251
-252
lines changed

Lib/test/clinic.test

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ test_objects_converter
9292
[clinic start generated code]*/
9393

9494
PyDoc_STRVAR(test_objects_converter__doc__,
95-
"test_objects_converter($module, a, b=None, /)\n"
95+
"test_objects_converter($module, a, b=<unrepresentable>, /)\n"
9696
"--\n"
9797
"\n");
9898

@@ -126,7 +126,7 @@ exit:
126126

127127
static PyObject *
128128
test_objects_converter_impl(PyObject *module, PyObject *a, PyObject *b)
129-
/*[clinic end generated code: output=58009c0e42b4834e input=4cbb3d9edd2a36f3]*/
129+
/*[clinic end generated code: output=0e461f38d3b2bd08 input=4cbb3d9edd2a36f3]*/
130130

131131

132132
/*[clinic input]
@@ -1718,8 +1718,8 @@ test_str_converter
17181718
[clinic start generated code]*/
17191719

17201720
PyDoc_STRVAR(test_str_converter__doc__,
1721-
"test_str_converter($module, a=None, b=\'ab\', c=\'cd\', d=\'cef\', e=\'gh\',\n"
1722-
" f=\'ij\', g=\'kl\', h=\'mn\', /)\n"
1721+
"test_str_converter($module, a=<unrepresentable>, b=\'ab\', c=\'cd\',\n"
1722+
" d=\'cef\', e=\'gh\', f=\'ij\', g=\'kl\', h=\'mn\', /)\n"
17231723
"--\n"
17241724
"\n");
17251725

@@ -1765,7 +1765,7 @@ test_str_converter_impl(PyObject *module, const char *a, const char *b,
17651765
const char *f, Py_ssize_clean_t f_length,
17661766
const char *g, Py_ssize_clean_t g_length,
17671767
const char *h, Py_ssize_clean_t h_length)
1768-
/*[clinic end generated code: output=8415d82c56154307 input=8afe9da8185cd38c]*/
1768+
/*[clinic end generated code: output=ad868ad94a488e32 input=8afe9da8185cd38c]*/
17691769

17701770

17711771
/*[clinic input]

Lib/test/test_inspect.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2273,8 +2273,8 @@ def p(name): return signature.parameters[name].default
22732273
test_callable(d.dump)
22742274

22752275
# static method
2276-
test_callable(str.maketrans)
2277-
test_callable('abc'.maketrans)
2276+
test_callable(bytes.maketrans)
2277+
test_callable(b'abc'.maketrans)
22782278

22792279
# class method
22802280
test_callable(dict.fromkeys)
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Default values which cannot be represented as Python objects no longer
2+
improperly represented as ``None`` in function signatures.

0 commit comments

Comments
 (0)