meejah / txtorcon

Twisted-based asynchronous Tor control protocol implementation. Includes unit-tests, examples, state-tracking code and configuration abstraction.
http://fjblvrw2jrxnhtg67qpbzi45r7ofojaoo3orzykesly2j3c2m3htapid.onion/
MIT License
250 stars 72 forks source link

syntax error on py3.4 #306

Closed warner closed 6 years ago

warner commented 6 years ago

I noticed the magic-wormhole travis job for python3.4 started failing sometime in the last week, apparently as a result of the switch from txtorcon-0.20.0 to 18.0.1 . It looks like python3.4 doesn't like the async and await keywords in controller_py3.py (which is odd, seems like they should be fine in a file that's only included when we're under py3, but maybe the syntax hadn't been nailed down by then and we should treat py3.4 as if it were py2?).

https://travis-ci.org/warner/magic-wormhole/jobs/398857942

Unhandled Error
Traceback (most recent call last):
  File "/home/travis/build/warner/magic-wormhole/.tox/coverage/lib/python3.4/site-packages/twisted/scripts/trial.py", line 478, in postOptions
    _BasicOptions.postOptions(self)
  File "/home/travis/build/warner/magic-wormhole/.tox/coverage/lib/python3.4/site-packages/twisted/scripts/trial.py", line 388, in postOptions
    self['reporter'] = self._loadReporterByName(self['reporter'])
  File "/home/travis/build/warner/magic-wormhole/.tox/coverage/lib/python3.4/site-packages/twisted/scripts/trial.py", line 375, in _loadReporterByName
    for p in plugin.getPlugins(itrial.IReporter):
  File "/home/travis/build/warner/magic-wormhole/.tox/coverage/lib/python3.4/site-packages/twisted/plugin.py", line 213, in getPlugins
    allDropins = getCache(package)
--- <exception caught here> ---
  File "/home/travis/build/warner/magic-wormhole/.tox/coverage/lib/python3.4/site-packages/twisted/plugin.py", line 171, in getCache
    provider = pluginModule.load()
  File "/home/travis/build/warner/magic-wormhole/.tox/coverage/lib/python3.4/site-packages/twisted/python/modules.py", line 392, in load
    return self.pathEntry.pythonPath.moduleLoader(self.name)
  File "/home/travis/build/warner/magic-wormhole/.tox/coverage/lib/python3.4/site-packages/twisted/python/reflect.py", line 308, in namedAny
    topLevelPackage = _importAndCheckStack(trialname)
  File "/home/travis/build/warner/magic-wormhole/.tox/coverage/lib/python3.4/site-packages/twisted/python/reflect.py", line 247, in _importAndCheckStack
    return __import__(importName)
  File "/home/travis/build/warner/magic-wormhole/.tox/coverage/lib/python3.4/site-packages/twisted/plugins/txtorcon_endpoint_parser.py", line 1, in <module>
    import txtorcon
  File "/home/travis/build/warner/magic-wormhole/.tox/coverage/lib/python3.4/site-packages/txtorcon/__init__.py", line 16, in <module>
    from txtorcon.controller import connect
  File "/home/travis/build/warner/magic-wormhole/.tox/coverage/lib/python3.4/site-packages/txtorcon/controller.py", line 42, in <module>
    from .controller_py3 import _AsyncOnionAuthContext
builtins.SyntaxError: invalid syntax (controller_py3.py, line 13)

Also it looks like the travis.yml doesn't include py3.4, only 2.7/3.6/pypy (on various versions of Twisted). We might want at least one job testing the oldest py3 flavor we support, but probably just on a single (most recent?) version of Twisted.

warner commented 6 years ago

(or maybe the fix is to drop support for py3.4)

meejah commented 6 years ago

BTW, this should be fixed in txtorcon 18.0.2 onwards; please re-open if that's not true :)