Bug 1793159

Summary: thonny fails to build with Python 3.9: TypeError: sha256() takes no arguments
Product: [Fedora] Fedora Reporter: Miro Hrončok <mhroncok>
Component: thonnyAssignee: Aivar Annamaa <aivar.annamaa>
Status: CLOSED RAWHIDE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: rawhideCC: aivar.annamaa, cstratak, mhroncok
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: thonny-3.2.7-1.fc32 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-01-22 09:45:25 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1785415    

Description Miro Hrončok 2020-01-20 20:29:30 UTC
thonny fails to build with Python 3.9.0a2.

_____________________________ test_regular_closed ______________________________
language = 'python', version = None
path = '/usr/lib/python3.9/site-packages/parso/python/grammar39.txt'
    def load_grammar(language='python', version=None, path=None):
        if language == 'python':
            version_info = parse_version_string(version)
    
            file = path or os.path.join(
                'python',
                'grammar%s%s.txt' % (version_info.major, version_info.minor)
            )
    
            global _loaded_grammars
            path = os.path.join(os.path.dirname(__file__), file)
            try:
>               return _loaded_grammars[path]
E               KeyError: '/usr/lib/python3.9/site-packages/parso/python/grammar39.txt'
/usr/lib/python3.9/site-packages/parso/grammar.py:242: KeyError
During handling of the above exception, another exception occurred:
    def test_regular_closed():
    
        expected_local = {("5.4", "5.12"), ("6.10", "6.18"), ("6.21", "6.29")}
    
        text_widget = tkinter.Text()
        text_widget.insert("end", TEST_STR1)
    
        highlighter = LocalsHighlighter(text_widget)
    
>       actual_local = highlighter.get_positions()
thonny/test/plugins/test_locals_marker.py:26: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
thonny/plugins/locals_marker.py:61: in get_positions
    module = jedi_utils.parse_source(source)
thonny/jedi_utils.py:88: in parse_source
    return parso.parse(source)
/usr/lib/python3.9/site-packages/parso/__init__.py:57: in parse
    grammar = load_grammar(version=version)
/usr/lib/python3.9/site-packages/parso/grammar.py:256: in load_grammar
    return load_grammar(**kwargs)
/usr/lib/python3.9/site-packages/parso/grammar.py:248: in load_grammar
    grammar = PythonGrammar(version_info, bnf_text)
/usr/lib/python3.9/site-packages/parso/grammar.py:206: in __init__
    super(PythonGrammar, self).__init__(
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
self = <PythonGrammar:single_input file_input eval_input ...>
text = "# Grammar for Python\n\n# NOTE WELL: You should also follow all the steps listed at\n# https://devguide.python.org/gr...pr: '{' testlist ['='] [ fstring_conversion ] [ fstring_format_spec ] '}'\nfstring_format_spec: ':' fstring_content*\n"
tokenizer = <bound method PythonGrammar._tokenize_lines of <PythonGrammar:single_input file_input eval_input ...>>
parser = <class 'parso.python.parser.Parser'>
diff_parser = <class 'parso.python.diff.DiffParser'>
    def __init__(self, text, tokenizer, parser=BaseParser, diff_parser=None):
        self._pgen_grammar = generate_grammar(
            text,
            token_namespace=self._get_token_namespace()
        )
        self._parser = parser
        self._tokenizer = tokenizer
        self._diff_parser = diff_parser
>       self._hashed = hashlib.sha256(text.encode("utf-8")).hexdigest()
E       TypeError: sha256() takes no arguments
/usr/lib/python3.9/site-packages/parso/grammar.py:39: TypeError

This seems like something I have seen before, reading micropython definition of sha256.



For the build logs, see:
https://copr-be.cloud.fedoraproject.org/results/@python/python3.9/fedora-rawhide-x86_64/01168585-thonny/

For all our attempts to build thonny with Python 3.9, see:
https://copr.fedorainfracloud.org/coprs/g/python/python3.9/package/thonny/

Testing and mass rebuild of packages is happening in copr. You can follow these instructions to test locally in mock if your package builds with Python 3.9:
https://copr.fedorainfracloud.org/coprs/g/python/python3.9/

Let us know here if you have any questions.

Python 3.9 will be included in Fedora 33. To make that update smoother, we're building Fedora packages with early pre-releases of Python 3.9.
A build failure prevents us from testing all dependent packages (transitive [Build]Requires), so if this package is required a lot, it's important for us to get it fixed soon.
We'd appreciate help from the people who know this package best, but if you don't want to work on this now, let us know so we can try to work around it on our side.

Comment 1 Aivar Annamaa 2020-01-22 10:44:06 UTC
It was a bundled MicroPython stub module, which started to mislead PyTest in Python 3.8 and 3.9