Skip to content
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

ast.Module signature change in Python 3.8.0a3 causes TypeError #1551

Closed
paihu opened this issue May 19, 2019 · 4 comments

Comments

Projects
None yet
3 participants
@paihu
Copy link

commented May 19, 2019

With Python 3.8.0a3 and Werkzeug 0.15.4, compiling the rule builders causes TypeError: required field "type_ignores" missing from Module. It sounds like ast.Module has a new required argument.

I think this is the same problem as beetbox/beets#3201 (comment)

flask run
 * Serving Flask app "flask_test.py"
 * Environment: production
   WARNING: This is a development server. Do not use it in a production deployment.
   Use a production WSGI server instead.
 * Debug mode: off
Traceback (most recent call last):
  File "d:\tool\python\38\lib\runpy.py", line 192, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "d:\tool\python\38\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "d:\tool\python\38\Scripts\flask.exe\__main__.py", line 9, in <module>
  File "d:\tool\python\38\lib\site-packages\flask\cli.py", line 906, in main
    cli.main(args=args, prog_name=name)
  File "d:\tool\python\38\lib\site-packages\flask\cli.py", line 569, in main
    return super(FlaskGroup, self).main(*args, **kwargs)
  File "d:\tool\python\38\lib\site-packages\click\core.py", line 717, in main
    rv = self.invoke(ctx)
  File "d:\tool\python\38\lib\site-packages\click\core.py", line 1137, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "d:\tool\python\38\lib\site-packages\click\core.py", line 956, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "d:\tool\python\38\lib\site-packages\click\core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "d:\tool\python\38\lib\site-packages\click\decorators.py", line 64, in new_func
    return ctx.invoke(f, obj, *args, **kwargs)
  File "d:\tool\python\38\lib\site-packages\click\core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "d:\tool\python\38\lib\site-packages\flask\cli.py", line 779, in run_command
    app = DispatchingApp(info.load_app, use_eager_loading=eager_loading)
  File "d:\tool\python\38\lib\site-packages\flask\cli.py", line 300, in __init__
    self._load_unlocked()
  File "d:\tool\python\38\lib\site-packages\flask\cli.py", line 324, in _load_unlocked
    self._app = rv = self.loader()
  File "d:\tool\python\38\lib\site-packages\flask\cli.py", line 381, in load_app
    app = locate_app(self, import_name, name)
  File "d:\tool\python\38\lib\site-packages\flask\cli.py", line 236, in locate_app
    __import__(module_name)
  File "D:\flask_test.py", line 3, in <module>
    app = Flask(__name__)
  File "d:\tool\python\38\lib\site-packages\flask\app.py", line 559, in __init__
    self.add_url_rule(
  File "d:\tool\python\38\lib\site-packages\flask\app.py", line 67, in wrapper_func
    return f(self, *args, **kwargs)
  File "d:\tool\python\38\lib\site-packages\flask\app.py", line 1217, in add_url_rule
    self.url_map.add(rule)
  File "d:\tool\python\38\lib\site-packages\werkzeug\routing.py", line 1388, in add
    rule.bind(self)
  File "d:\tool\python\38\lib\site-packages\werkzeug\routing.py", line 730, in bind
    self.compile()
  File "d:\tool\python\38\lib\site-packages\werkzeug\routing.py", line 794, in compile
    self._build = self._compile_builder(False).__get__(self, None)
  File "d:\tool\python\38\lib\site-packages\werkzeug\routing.py", line 951, in _compile_builder
    code = compile(module, "<werkzeug routing>", "exec")
TypeError: required field "type_ignores" missing from Module

@paihu paihu changed the title Crashes on Python 3.8.0a3 in 0. Crashes on Python 3.8.0a3 in 0.15.3 and 0.15.4 May 19, 2019

@davidism

This comment has been minimized.

Copy link
Member

commented May 19, 2019

This needs to be reported to CPython as an undocumented and backwards-incompatible API change in the standard library.

@davidism davidism changed the title Crashes on Python 3.8.0a3 in 0.15.3 and 0.15.4 ast.Module signature change in Python 3.8.0a3 causes TypeError May 19, 2019

@davidism

This comment has been minimized.

Copy link
Member

commented May 19, 2019

@asottile What are your thoughts? I'm not sure we should fix this yet, Python 3.8 has been causing then fixing random issues for quite a while.

@davidism

This comment has been minimized.

Copy link
Member

commented May 19, 2019

Looks like this was reported in CPython https://bugs.python.org/issue35894 and the resolution was that downstream code should add a if sys.version_info >= (3, 8). 😒

@asottile

This comment has been minimized.

Copy link
Contributor

commented May 19, 2019

😡 what a wacky resolution -- I'll make a more portable fix for this, coming right up!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.