Skip to content

Commit 7c827c7

Browse files
committed
Revert "Remove CIRCUITPY_8_9_WARNINGS and its usage."
This reverts commit 4bcc424.
1 parent 4bcc424 commit 7c827c7

File tree

2 files changed

+33
-0
lines changed

2 files changed

+33
-0
lines changed

py/circuitpy_mpconfig.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,12 @@
1717
// Always 1: defined in circuitpy_mpconfig.mk
1818
// #define CIRCUITPY (1)
1919

20+
// Can be removed once CircuitPython 10 is released.
21+
// Print warnings or not about deprecated names. See objmodule.c.
22+
#ifndef CIRCUITPY_8_9_WARNINGS
23+
#define CIRCUITPY_8_9_WARNINGS (0)
24+
#endif
25+
2026
// REPR_C encodes qstrs, 31-bit ints, and 30-bit floats in a single 32-bit word.
2127
#ifndef MICROPY_OBJ_REPR
2228
#define MICROPY_OBJ_REPR (MICROPY_OBJ_REPR_C)

py/objmodule.c

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,33 @@ static void module_attr_try_delegation(mp_obj_t self_in, qstr attr, mp_obj_t *de
6767
static void module_attr(mp_obj_t self_in, qstr attr, mp_obj_t *dest) {
6868
mp_obj_module_t *self = MP_OBJ_TO_PTR(self_in);
6969
if (dest[0] == MP_OBJ_NULL) {
70+
// CIRCUITPY-CHANGE
71+
#if CIRCUITPY_8_9_WARNINGS && CIRCUITPY_DISPLAYIO && CIRCUITPY_WARNINGS
72+
if (self == &displayio_module) {
73+
#if CIRCUITPY_BUSDISPLAY
74+
if (attr == MP_QSTR_Display) {
75+
warnings_warn(&mp_type_FutureWarning, MP_ERROR_TEXT("%q moved from %q to %q"), MP_QSTR_Display, MP_QSTR_displayio, MP_QSTR_busdisplay);
76+
warnings_warn(&mp_type_FutureWarning, MP_ERROR_TEXT("%q renamed %q"), MP_QSTR_Display, MP_QSTR_BusDisplay);
77+
}
78+
#endif
79+
#if CIRCUITPY_EPAPERDISPLAY
80+
if (attr == MP_QSTR_EPaperDisplay) {
81+
warnings_warn(&mp_type_FutureWarning, MP_ERROR_TEXT("%q moved from %q to %q"), MP_QSTR_EPaperDisplay, MP_QSTR_displayio, MP_QSTR_epaperdisplay);
82+
}
83+
#endif
84+
#if CIRCUITPY_FOURWIRE
85+
if (attr == MP_QSTR_FourWire) {
86+
warnings_warn(&mp_type_FutureWarning, MP_ERROR_TEXT("%q moved from %q to %q"), MP_QSTR_FourWire, MP_QSTR_displayio, MP_QSTR_fourwire);
87+
}
88+
#endif
89+
#if CIRCUITPY_I2CDISPLAYBUS
90+
if (attr == MP_QSTR_I2CDisplay) {
91+
warnings_warn(&mp_type_FutureWarning, MP_ERROR_TEXT("%q moved from %q to %q"), MP_QSTR_I2CDisplay, MP_QSTR_displayio, MP_QSTR_i2cdisplaybus);
92+
warnings_warn(&mp_type_FutureWarning, MP_ERROR_TEXT("%q renamed %q"), MP_QSTR_I2CDisplay, MP_QSTR_I2CDisplayBus);
93+
}
94+
#endif
95+
}
96+
#endif
7097
// load attribute
7198
mp_map_elem_t *elem = mp_map_lookup(&self->globals->map, MP_OBJ_NEW_QSTR(attr), MP_MAP_LOOKUP);
7299
if (elem != NULL) {

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy