Uploaded image for project: 'Python Driver'
  1. Python Driver
  2. PYTHON-1455

async is a reserved keyword in Python 3.7

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Trivial - P5 Trivial - P5
    • 3.6.1
    • Affects Version/s: None
    • Component/s: None
    • None

      That causes the following test failures:

      ======================================================================
      ERROR: test_client (unittest.loader._FailedTest)
      ----------------------------------------------------------------------
      ImportError: Failed to import test module: test_client
      Traceback (most recent call last):
        File "/opt/python/3.7/lib/python3.7/unittest/loader.py", line 434, in _find_test_path
          module = self._get_module_from_name(name)
        File "/opt/python/3.7/lib/python3.7/unittest/loader.py", line 375, in _get_module_from_name
          __import__(name)
        File "/home/durin/work/mongo-python-driver/test/test_client.py", line 889
          self.client.fsync(async=True)
                                ^
      SyntaxError: invalid syntax
      
      
      ======================================================================
      ERROR: test_collection (unittest.loader._FailedTest)
      ----------------------------------------------------------------------
      ImportError: Failed to import test module: test_collection
      Traceback (most recent call last):
        File "/opt/python/3.7/lib/python3.7/unittest/loader.py", line 434, in _find_test_path
          module = self._get_module_from_name(name)
        File "/opt/python/3.7/lib/python3.7/unittest/loader.py", line 375, in _get_module_from_name
          __import__(name)
        File "/home/durin/work/mongo-python-driver/test/test_collection.py", line 64, in <module>
          from test.test_client import IntegrationTest
        File "/home/durin/work/mongo-python-driver/test/test_client.py", line 889
          self.client.fsync(async=True)
                                ^
      SyntaxError: invalid syntax
      
      
      ======================================================================
      ERROR: test_legacy_api (unittest.loader._FailedTest)
      ----------------------------------------------------------------------
      ImportError: Failed to import test module: test_legacy_api
      Traceback (most recent call last):
        File "/opt/python/3.7/lib/python3.7/unittest/loader.py", line 434, in _find_test_path
          module = self._get_module_from_name(name)
        File "/opt/python/3.7/lib/python3.7/unittest/loader.py", line 375, in _get_module_from_name
          __import__(name)
        File "/home/durin/work/mongo-python-driver/test/test_legacy_api.py", line 53, in <module>
          from test.test_client import IntegrationTest
        File "/home/durin/work/mongo-python-driver/test/test_client.py", line 889
          self.client.fsync(async=True)
                                ^
      SyntaxError: invalid syntax
      

      The test failures are easy to work around, but we might want to do more. Perhaps async should be a formal parameter, rather than passed in **kwargs.

            Assignee:
            bernie@mongodb.com Bernie Hackett
            Reporter:
            bernie@mongodb.com Bernie Hackett
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: