Uploaded image for project: 'Motor'
  1. Motor
  2. MOTOR-415

Remove quoted text/code for __aenter__ and __aexit__ helpers

    • Type: Icon: Task Task
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 2.2
    • Affects Version/s: None
    • Component/s: None
    • Labels:
      None

      Currently, a lot of code that support syntax introduced in Python 3.5+ is injected into the codebase via exec calls inside an if... block:

          if PY35:
              exec(textwrap.dedent("""
              def __aiter__(self):
                  return self
      
              __anext__ = next
      
              async def __aenter__(self):
                  return self
          
              async def __aexit__(self, exc_type, exc_val, exc_tb):
                  if self.delegate:
                      self.delegate.close() 
              """), globals(), locals())
      

      Once we no longer support older runtime versions, this code should become a first-class citizen in the codebase.

            Assignee:
            prashant.mital Prashant Mital (Inactive)
            Reporter:
            prashant.mital Prashant Mital (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: