Skip to content

Commit c0a2e21

Browse files
authored
Merge pull request #9457 from dhalbert/9.1.x-9450-warn-sys-exception-deprecation
9.1.x: Warn on use of nonstandard sys.format_exception
2 parents 0900984 + 5811f75 commit c0a2e21

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

py/modsys.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,11 @@
3939
#include "extmod/modplatform.h"
4040
#include "genhdr/mpversion.h"
4141

42+
// CIRCUITPY-CHANGE
43+
#if CIRCUITPY_WARNINGS
44+
#include "shared-module/warnings/__init__.h"
45+
#endif
46+
4247
#if MICROPY_PY_SYS_SETTRACE
4348
#include "py/objmodule.h"
4449
#include "py/profile.h"
@@ -134,6 +139,11 @@ STATIC mp_obj_t mp_sys_exit(size_t n_args, const mp_obj_t *args) {
134139
MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mp_sys_exit_obj, 0, 1, mp_sys_exit);
135140

136141
STATIC mp_obj_t mp_sys_print_exception(size_t n_args, const mp_obj_t *args) {
142+
// CIRCUITPY-CHANGE
143+
#if CIRCUITPY_WARNINGS
144+
warnings_warn(&mp_type_FutureWarning, MP_ERROR_TEXT("%q moved from %q to %q"), MP_QSTR_print_exception, MP_QSTR_sys, MP_QSTR_traceback);
145+
#endif
146+
137147
#if MICROPY_PY_IO && MICROPY_PY_SYS_STDFILES
138148
void *stream_obj = &mp_sys_stdout_obj;
139149
if (n_args > 1) {

0 commit comments

Comments
 (0)