File tree 3 files changed +5
-5
lines changed
3 files changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -201,8 +201,8 @@ Object Protocol
201
201
202
202
Return a user-friendly string representation of the function-like object
203
203
*func *. This returns ``func.__qualname__ + "()" `` if there is a
204
- ``__qualname__ `` attribute and ``type (func).__name__ + " object" ``
205
- otherwise. Note that there is no check that *func * is actually callable.
204
+ ``__qualname__ `` attribute and ``str (func)`` otherwise.
205
+ Note that there is no check that *func * is actually callable.
206
206
207
207
.. versionadded :: 3.9
208
208
Original file line number Diff line number Diff line change 268
268
>>> nothing(*h)
269
269
Traceback (most recent call last):
270
270
...
271
- TypeError: NoneType object argument after * must be an iterable, \
271
+ TypeError: None argument after * must be an iterable, \
272
272
not function
273
273
274
274
>>> h(**h)
Original file line number Diff line number Diff line change @@ -669,7 +669,7 @@ def _PyObject_FunctionStr(f):
669
669
try:
670
670
return f.__qualname__ + "()"
671
671
except Exception:
672
- return type (f).__name__ + " object"
672
+ return str (f)
673
673
*/
674
674
PyObject *
675
675
_PyObject_FunctionStr (PyObject * f )
@@ -686,7 +686,7 @@ _PyObject_FunctionStr(PyObject *f)
686
686
return NULL ;
687
687
}
688
688
PyErr_Clear ();
689
- return PyUnicode_FromFormat ( "%.200s object" , Py_TYPE ( f ) -> tp_name );
689
+ return PyObject_Str ( f );
690
690
}
691
691
692
692
/* For Python 3.0.1 and later, the old three-way comparison has been
You can’t perform that action at this time.
0 commit comments