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

PyMongo uses invalid escape sequences on Python >= 3.6

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 3.7
    • Affects Version/s: 3.6
    • Component/s: None
    • None

      In pymogno/database.py:

      _INDEX_REGEX = {"name": {"$regex": "^(?!.*\$)"}}
      _SYSTEM_FILTER = {"filter": {"name": {"$regex": "^(?!system\.)"}}}
      
      python3.6 -We
      Python 3.6.5 (default, Mar 30 2018, 06:42:10)
      [GCC 4.2.1 Compatible Apple LLVM 9.0.0 (clang-900.0.39.2)] on darwin
      Type "help", "copyright", "credits" or "license" for more information.
      >>> '\s'
        File "<stdin>", line 1
      SyntaxError: invalid escape sequence \s
      >>> '\$'
        File "<stdin>", line 1
      SyntaxError: invalid escape sequence \$
      >>> '\.'
        File "<stdin>", line 1
      SyntaxError: invalid escape sequence \.
      

      Found and fixed by https://github.com/mongodb/mongo-python-driver/pull/352

            Assignee:
            shane.harvey@mongodb.com Shane Harvey
            Reporter:
            shane.harvey@mongodb.com Shane Harvey
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: