You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
match...case... statement, proposed in PEP 634: Structural Pattern Matching,provides pattern matching process for users like switch statement in C/C++.
However, this statement is not supported in current Cython.
A minimal example is as following to reproduce the issue:
Code to reproduce the behaviour:
# Minimal example to reproduce the issuea=1matcha:
case1:
print("1")
case_:
print("2")
""">>> python .../test.py1>>> cython .../test.pyError compiling Cython file:------------------------------------------------------------...# minimal example to reproduce the issuea=1match a: ^------------------------------------------------------------.../test.py:3:6: Syntax error in simple statement list"""
Expected behaviour
Any solutions or suggestions?
If it is a bug, I am trying to fix this bug if possible.
OS
macOS
Python version
3.10.12
Cython version
3.0.2 and 3.0.3
Additional context
My Analysis
So I trace back to the function def p_simple_statement_list(s, ctx, first_statement = 0) in ./Cython/Compiler/Parsing.py,which raise the syntax error. The only call appears in the function def p_statement(s, ctx, first_statement = 0) in the same file.
This function deals with different statements according to prefixs. I think p_match_statement and p_case_statement are needed to resolve this statement.
Also, I searched 'match' globally in the project, but found nothing. It seems that match statement is not considered in current cython.
I am trying to fix this bug now if possible.
The text was updated successfully, but these errors were encountered:
It just isn't implemented yet in any Cython release. In that ticket you'll find links to a branch where it is implemented in full, but this hasn't yet been reviewed and merged.
Describe the bug
match...case...
statement, proposed in PEP 634: Structural Pattern Matching,provides pattern matching process for users likeswitch
statement in C/C++.However, this statement is not supported in current Cython.
A minimal example is as following to reproduce the issue:
Code to reproduce the behaviour:
Expected behaviour
Any solutions or suggestions?
If it is a bug, I am trying to fix this bug if possible.
OS
macOS
Python version
3.10.12
Cython version
3.0.2 and 3.0.3
Additional context
My Analysis
So I trace back to the function
def p_simple_statement_list(s, ctx, first_statement = 0)
in./Cython/Compiler/Parsing.py
,which raise the syntax error. The only call appears in the functiondef p_statement(s, ctx, first_statement = 0)
in the same file.This function deals with different statements according to prefixs. I think
p_match_statement
andp_case_statement
are needed to resolve this statement.Also, I searched
'match'
globally in the project, but found nothing. It seems that match statement is not considered in current cython.I am trying to fix this bug now if possible.
The text was updated successfully, but these errors were encountered: