## Feature <!-- What Python feature is missing from RustPython? Give a short description of the feature and how you ran into its absence. --> ### Toy Example (adapted from `extra_tests/snippets/fstrings.py`, lines 47-48) #### Code ```python foo = "bar" part_spec = ">+#10x" print(f"{16:0{part_spec}}{foo}") ``` #### CPython ```text 00000+0x10bar ``` #### RustPython ```text SyntaxError: Got error in f-string: Invalid expression: invalid syntax. Got unexpected token 'part_spec' at line 1 column 9 print(f"{16:0{part_spec}}{foo}") ^ ``` ### Real-world Example (adapted from CPython 3.9's `Lib/test/test_fstring.py`, lines 581-584) #### Code ```python import decimal width = 10 precision = 4 value = decimal.Decimal('12.34567') print(f'result: {value:{width}.{precision}}') ``` #### CPython ```text result: 12.35 ``` #### RustPython ```text SyntaxError: Got error in f-string: Invalid expression: invalid syntax. Got unexpected token '{' at line 1 column 9 print(f'result: {value:{width}.{precision}}') ^ ``` ## Python Documentation <!-- Give a link to the feature in the CPython documentation (https://docs.python.org/3/) in order to assist in its implementation. --> https://docs.python.org/3/reference/lexical_analysis.html#grammar-token-python-grammar-format_spec @coolreader18 this has been plaguing the CI for the past day or so (because of the `--install-pip` step).
Activity
fanninpm commentedon Feb 1, 2022
@coolreader18 Update: I had an insight related to something in
ast/src/ast_gen.rs, and I'm working on a thing.gavindsouza commentedon Feb 3, 2022
I just tried
rustpython get-pip.pyon latest HEAD (bd295e0) and it threwExtracted example:
On CPython 3.9.9:
On Rust Python 0.1.2:
@fanninpm Does your PR fix this too?
fanninpm commentedon Feb 3, 2022
Not completely.
youknowone commentedon Feb 3, 2022
Once this is fixed, #3535 need to be reverted