summaryrefslogtreecommitdiffstats
path: root/Python/sysmodule.c
diff options
context:
space:
mode:
Diffstat (limited to 'Python/sysmodule.c')
-rw-r--r--Python/sysmodule.c22
1 files changed, 18 insertions, 4 deletions
diff --git a/Python/sysmodule.c b/Python/sysmodule.c
index 52034ff..7906830 100644
--- a/Python/sysmodule.c
+++ b/Python/sysmodule.c
@@ -108,7 +108,7 @@ sys_displayhook_unencodable(PyObject *outf, PyObject *o)
{
PyObject *stdout_encoding = NULL;
PyObject *encoded, *escaped_str, *repr_str, *buffer, *result;
- char *stdout_encoding_str;
+ const char *stdout_encoding_str;
int ret;
stdout_encoding = _PyObject_GetAttrId(outf, &PyId_encoding);
@@ -1287,6 +1287,19 @@ a 11-tuple where the entries in the tuple are counts of:\n\
10. Number of stack pops performed by call_function()"
);
+static PyObject *
+sys_callstats(PyObject *self)
+{
+ if (PyErr_WarnEx(PyExc_DeprecationWarning,
+ "sys.callstats() has been deprecated in Python 3.7 "
+ "and will be removed in the future", 1) < 0) {
+ return NULL;
+ }
+
+ Py_RETURN_NONE;
+}
+
+
#ifdef __cplusplus
extern "C" {
#endif
@@ -1352,7 +1365,7 @@ Return True if Python is exiting.");
static PyMethodDef sys_methods[] = {
/* Might as well keep this in alphabetic order */
- {"callstats", (PyCFunction)PyEval_GetCallStats, METH_NOARGS,
+ {"callstats", (PyCFunction)sys_callstats, METH_NOARGS,
callstats_doc},
{"_clear_type_cache", sys_clear_type_cache, METH_NOARGS,
sys_clear_type_cache__doc__},
@@ -1547,8 +1560,9 @@ error:
Py_XDECREF(name);
Py_XDECREF(value);
/* No return value, therefore clear error state if possible */
- if (_PyThreadState_UncheckedGet())
+ if (_PyThreadState_UncheckedGet()) {
PyErr_Clear();
+ }
}
PyObject *
@@ -2403,7 +2417,7 @@ sys_format(_Py_Identifier *key, FILE *fp, const char *format, va_list va)
{
PyObject *file, *message;
PyObject *error_type, *error_value, *error_traceback;
- char *utf8;
+ const char *utf8;
PyErr_Fetch(&error_type, &error_value, &error_traceback);
file = _PySys_GetObjectId(key);