Repository: RustPython/RustPython (language: rust)

Issue:
`f'\x7b'` causes SyntaxError
test_fstring is related


Discussion / hints:
Can you assign this issue to me?

Fix patch:
diff --git a/vm/src/format.rs b/vm/src/format.rs
index 1d4ab6c000..b01773e726 100644
--- a/vm/src/format.rs
+++ b/vm/src/format.rs
@@ -456,7 +456,7 @@ impl FormatSpec {
                 Some(FormatType::Binary) => "0b",
                 Some(FormatType::Octal) => "0o",
                 Some(FormatType::HexLower) => "0x",
-                Some(FormatType::HexUpper) => "0x",
+                Some(FormatType::HexUpper) => "0X",
                 _ => "",
             }
         } else {


Test patch:
diff --git a/extra_tests/snippets/builtin_format.py b/extra_tests/snippets/builtin_format.py
index a30f300d4c..4fdaeb3c8b 100644
--- a/extra_tests/snippets/builtin_format.py
+++ b/extra_tests/snippets/builtin_format.py
@@ -28,3 +28,4 @@ def test_zero_padding():
 assert f'{65536:,}' == '65,536'
 assert f'{4294967296:,}' == '4,294,967,296'
 assert 'F' == "{0:{base}}".format(15, base="X")
+assert f'{255:#X}' == "0XFF"