Skip to content

Commit 2eeac04

Browse files
committed
Add more details in warning message
1 parent 55160bf commit 2eeac04

File tree

2 files changed

+12
-5
lines changed

2 files changed

+12
-5
lines changed

Doc/library/sys.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ always available. Unless explicitly noted otherwise, all variables are read-only
6363
without changing the behavior:
6464

6565
+---------------------------------------+---------------------------------------------------------------------+
66-
| Code Prior to Python 3.14 | Code in Python 3.14-3.15 |
66+
| Code prior to Python 3.14 | Code prior to Python 3.16 with the same behavior |
6767
+=======================================+=====================================================================+
6868
| ``sys.abiflags`` | ``sys.abiflags`` |
6969
+---------------------------------------+---------------------------------------------------------------------+

Python/sysmodule.c

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,10 +75,17 @@ module sys
7575
#include "clinic/sysmodule.c.h"
7676

7777

78-
#define WarnIncomingSysAbiflagsChange() \
79-
PyErr_WarnEx(PyExc_DeprecationWarning, \
80-
"sys.abiflags will be set to a meaningful value " \
81-
"on all platforms in Python 3.16 instead of absent", \
78+
PyDoc_STRVAR(IncomingSysAbiflagsChange_msg,
79+
"sys.abiflags will be set to a meaningful value on all platforms "
80+
"in Python 3.16 instead of absent.\n\n"
81+
"Please consider using `warnings.simplefilter()` with the "
82+
"`warnings.catch_warnings()` context manager.\n"
83+
"Or update the code with `if sys.platform.startswith('win')` condition."
84+
);
85+
86+
#define WarnIncomingSysAbiflagsChange() \
87+
PyErr_WarnEx(PyExc_DeprecationWarning, \
88+
IncomingSysAbiflagsChange_msg, \
8289
/*stack_level=*/1)
8390

8491

0 commit comments

Comments
 (0)