Hey all,

In November 2022 Python 3.11 was release and is slowly being rolled out for 
usage. In January of this year I became aware of an issue which makes gem5 
incompatible with Python 3.11. I’ve outlined my findings, in detail, here: 
https://gem5.atlassian.net/browse/GEM5-1321.

In brief, Python 3.11 enforces a rule that Python Regex global flags must occur 
at the start of the regex expression which causes problems with Python Ply (our 
Python based lex and yacc tool, from here: https://github.com/dabeaz/ply). In 
gem5 we have code like this:

```
def t_STRLIT(self, t):
        r'(?m)"([^"])*"'
        # strip off quotes
        t.value = t.value[1:-1]
        t.lexer.lineno += t.value.count('\n')
        return t
```

In Python Ply this regex is appended to the end of a regex expression and, 
therefore, the Python Regex global flag (`(?m)` in this case) is not at the 
start of the expression and the following error is returned:

```
ERROR:fm_proj_ply:/gem5/build/ALL/arch/arm/fastmodel/SConscript:220: Invalid 
regular expression for rule 't_STRLIT'. global flags not at the start of the 
expression at position 13
SyntaxError: Can't build lexer
```

I’ve tried hacking away at this but have yet to find a solution that works 
correctly (more details about this are outlined in the Jira ticket).

I’m reaching out to wonder if anyone has any nice solutions to this problem or, 
even better, if someone’s already found a work around on their end. This is a 
part of the code-base I don’t have much experience in and would appreciate some 
assistance if anyone has any ideas.
 

Kind regards,
Bobby

--
Dr. Bobby R. Bruce
Room 3050,
Kemper Hall, UC Davis
Davis,
CA, 95616
 
web: https://www.bobbybruce.net

_______________________________________________
gem5-dev mailing list -- gem5-dev@gem5.org
To unsubscribe send an email to gem5-dev-le...@gem5.org

Reply via email to