check surrogates by youknowone · Pull Request #6547 · RustPython/RustPython
1154-1177: LGTM - Proper UTF-8 validation for type name setter.
The validation is correctly placed after the null character check, ensuring type names don't contain surrogates. This aligns with CPython's behavior.
1252-1259: LGTM - UTF-8 validation during type construction.
Correctly validates the type name immediately after the null character check, preventing type creation with surrogate-containing names.
1311-1316: LGTM - Validates __doc__ strings for surrogates during type creation.
The check correctly handles the optional nature of __doc__ - only validating when it exists and is a string.
1351-1358: LGTM - Rejects bytes as __slots__ value.
This correctly rejects __slots__ = b"foo" with an appropriate error message, matching CPython's behavior.
1366-1373: LGTM - Rejects bytes items within __slots__ iterable.
Correctly handles cases like __slots__ = ['a', b'b'] by validating each item during iteration.