import sys, unicodedata
ranges, start = [], None
for cp in range(0x110000):
if not chr(cp).isprintable():
start = cp if start is None else start
elif start is not None:
ranges.append((start, cp - 1))
start = None
if start is not None:
ranges.append((start, 0x10FFFF))
v = sys.version_info
print(f"""//! Generated by tests/support/gen_pyprintable.py from CPython {v.major}.{v.minor}
//! (Unicode {unicodedata.unidata_version}); do not edit. The code points `str.isprintable()`
//! rejects, which `repr()` escapes: controls, format characters, separators,
//! spaces other than U+0020, surrogates, private use and unassigned.
/// Inclusive, sorted, disjoint ranges.
#[rustfmt::skip]
pub(crate) const NOT_PRINTABLE: &[(u32, u32)] = &[""")
for i in range(0, len(ranges), 6):
print(" " + " ".join(f"(0x{a:X}, 0x{b:X})," for a, b in ranges[i:i + 6]))
print("];")