Page MenuHomePhabricator

Python < 3.5.2 does not support typing.Type
Closed, ResolvedPublicBUG REPORT

Description

List of steps to reproduce:

run

python -Werror::UserWarning -m generate_user_files -dir:%PYWIKIBOT_DIR% -family:wikipedia -lang:en -v -debug -user:%PYWIKIBOT_USERNAME%
222

with Python 3.5.0

What happens?:

22
Traceback (most recent call last):
223
  File "C:\Python350-x64\lib\runpy.py", line 170, in _run_module_as_main
224
    "__main__", mod_spec)
225
  File "C:\Python350-x64\lib\runpy.py", line 85, in _run_code
226
    exec(code, run_globals)
227
  File "C:\projects\pywikibot-g4xqx\generate_user_files.py", line 35, in <module>
228
    pywikibot = _import_with_no_user_config('pywikibot')
229
  File "C:\projects\pywikibot-g4xqx\generate_family_file.py", line 283, in _import_with_no_user_config
230
    result = __import__(*import_args)
231
  File "C:\projects\pywikibot-g4xqx\pywikibot\__init__.py", line 66, in <module>
232
    from pywikibot.site import APISite, BaseSite, DataSite
233
  File "C:\projects\pywikibot-g4xqx\pywikibot\site\__init__.py", line 7, in <module>
234
    from pywikibot.site._apisite import APISite
235
  File "C:\projects\pywikibot-g4xqx\pywikibot\site\_apisite.py", line 55, in <module>
236
    from pywikibot.site._extensions import (
237
  File "C:\projects\pywikibot-g4xqx\pywikibot\site\_extensions.py", line 10, in <module>
238
    from pywikibot.echo import Notification
239
  File "C:\projects\pywikibot-g4xqx\pywikibot\echo.py", line 8, in <module>
240
    from typing import Any, Optional, Type
241
ImportError: cannot import name 'Type'
242
CRITICAL: Exiting due to uncaught exception <class 'ImportError'>
243
Command exited with code 1
244
codecov

Reason
typing.Type was introducted in Python 3.5.2:
https://docs.python.org/3.6/library/typing.html?highlight=typing%20type#typing.Type

Software version:
Python 3.5.0
Pywikibot 6.6.0.dev0

Related Objects

StatusSubtypeAssignedTask
ResolvedBUG REPORTXqt
ResolvedXqt

Event Timeline

Xqt triaged this task as High priority.
Xqt added a subscriber: Huji.

Change 713431 had a related patch set uploaded (by Xqt; author: Xqt):

[pywikibot/core@master] [bugfix] Remove typing.Type import

https://gerrit.wikimedia.org/r/713431

Change 713433 had a related patch set uploaded (by Damian; author: Damian):

[pywikibot/core@master] [bugfix] Missing Type class for echo.py

https://gerrit.wikimedia.org/r/713433

Change 713431 abandoned by Xqt:

[pywikibot/core@master] [bugfix] Remove typing.Type import

Reason:

https://gerrit.wikimedia.org/r/713431

Change 713433 merged by jenkins-bot:

[pywikibot/core@master] [bugfix] Missing Type class for echo.py

https://gerrit.wikimedia.org/r/713433