Commits

Ronald Oussoren  committed deb310c

Avoid ResourceWarning

  • Participants
  • Parent commits 790e733

Comments (0)

Files changed (1)

File pyobjc-framework-CFNetwork/PyObjCTest/test_cfhttpstream.py

        v = CFReadStreamCreateForHTTPRequest(None, req)
        self.assertIsInstance(v, CFReadStreamRef)
 
-       fp = open("/dev/null", "w")
-       fd_2 = os.dup(2)
-       os.dup2(fp.fileno(), 2)
+       with open("/dev/null", "w") as fp:
+           fd_2 = os.dup(2)
+           os.dup2(fp.fileno(), 2)
 
        try:
            # Avoid deprecation messages from CFNetwork