New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Python 3.13 compatibility #5091
Comments
This looks pretty strange and coulI tried reproducing this on Linux Mint, but deadsnakes only had alpha 4 and even that had issues with pip due to distutils being removed. Anyway, this looks pretty odd and could even be a bug in Python itself. That How urgent fixing this is for you? If you'd like this to be fixed in RF 7.0.1, the fix is needed pretty soon. If it's enough to get this fixed in RF 7.1 that's planned for June/July, then we have more time. One good thing with targeting RF 7.1 would be that Python 3.13 gets to beta phase in May and would then be a more stable target. |
Thanks for checking this out! It was indeed very strange to me too being just the AST init after all. As for urgency: please no worries! This would be needed for Fedora 41 which should be out somewhere around November, which also means by the time 3.13 should be final. Also in ~2 weeks a new 3.13 alpha should be released (and as you mention betas then in May), I can recheck there and report! |
Sounds good to me. Let's concentrate on Python 3.13 support in RF 7.1. Delayed evaluation of annotations may also require us to make changes. |
Indeed seems like a Python 3.13 bug. Minimal Python reproducer: import ast
class File(ast.AST):
_fields = ("xxx",)
def __init__(self):
super().__init__()
File()
|
I've reported python/cpython#117266 |
Thanks for testing and reporting the issue @hroncok. |
Thanks for finding and reporting this bug in CPython this early in the release cycle! It's possible that you will need to make changes in your code to accommodate the deprecations in https://docs.python.org/3.13/whatsnew/3.13.html#ast. I'm happy to help with that, but I looked at the file involved (https://github.com/robotframework/robotframework/blob/master/src/robot/parsing/model/statements.py) and it doesn't look like it has much to do with the Python AST. Perhaps it is enough if you add the |
Thanks for the info @JelleZijlstra. Do I get it right that the reported issue will be fixed in beta 1, but there's a deprecation what we need to take into account? Is the |
That's right. I will have to change the docs to document |
It's true that our >>> import astpretty
>>> from robot.api.parsing import get_model
>>> m = get_model('''\
... *** Test Cases ***
... Example
... Log Hello, world!
... ''')
>>> astpretty.pprint(m)
File(
source=None,
languages=[],
lineno=1,
col_offset=0,
end_lineno=3,
end_col_offset=25,
errors=(),
sections=[
TestCaseSection(
lineno=1,
col_offset=0,
end_lineno=3,
end_col_offset=25,
errors=(),
header=SectionHeader(type='TESTCASE HEADER', tokens=(Token(TESTCASE_HEADER, '*** Test Cases ***', 1, 0), Token(EOL, '\n', 1, 18)), lineno=1, col_offset=0, end_lineno=1, end_col_offset=19, errors=()),
body=[
TestCase(
lineno=2,
col_offset=0,
end_lineno=3,
end_col_offset=25,
errors=(),
header=TestCaseName(type='TESTCASE NAME', tokens=(Token(TESTCASE_NAME, 'Example', 2, 0), Token(EOL, '\n', 2, 7)), lineno=2, col_offset=0, end_lineno=2, end_col_offset=8, errors=()),
body=[KeywordCall(type='KEYWORD', tokens=(Token(SEPARATOR, ' ', 3, 0), Token(KEYWORD, 'Log', 3, 4), Token(SEPARATOR, ' ', 3, 7), Token(ARGUMENT, 'Hello, world!', 3, 11), Token(EOL, '\n', 3, 24)), lineno=3, col_offset=0, end_lineno=3, end_col_offset=25, errors=())],
),
],
),
],
) I understand that although it has worked well, the |
Thanks! Definitely an unusual use of AST, but since you're already doing it, from the CPython side we should preserve compatibility and continue to support it. I just opened an issue on CPython about this and I'll try to make it so that your use case continues to work well. |
The original reported issue ought to be fixed in Python 3.13 itself, but we may still need to adjust our code to avoid deprecation warnings. We obviously also want to support Python 3.13 otherwise and I changed the issue title to cover that. Supporting new Python versions hasn't typically required too much work from us, but in this case deferred evaluation of annotations (PEP 649) is likely to require at least some changed. |
I'm about to open a PR updating my AST changes in CPython to relax the requirements on third-party classes that inherit from Of course, there may be other changes that land in 3.13 yet, such as PEP 649. Ideally PEP 649 would not require changes for most user code, but we can't know for sure until we have the implementation. |
Great to here |
It seems that with new Python 3.13 alpha 3.13.0a5 (note with previous alpha this seemed not to happen as besides the small fix of #5035 it worked fine) tests fail very early:
I tried to investigate a bit but sincerely got a bit lost in the flow of inheritance and what that super call should achieve. I know there is still some time for Python 3.13, but still reporting if it may give you an early warning.
If you have any proposal on a fix and need help to retest please just let me know!
The text was updated successfully, but these errors were encountered: