              sys.stderr.write("fork #2 failed: (%d) %s\n" % (e.errno, e.strerror))
              os._exit(1)
  
          si = open('/dev/null', 'r')
          so = open(out_log, 'a+', 0)
          se = open(err_log, 'a+', 0)
          os.dup2(si.fileno(), sys.stdin.fileno())
          os.dup2(so.fileno(), sys.stdout.fileno())
          os.dup2(se.fileno(), sys.stderr.fileno())
          # Set custom file descriptors so that they get proper buffering.
          sys.stdout, sys.stderr = so, se
 
</s> remove             sys.stderr = open(err_log, 'a', 0)
 </s> add             sys.stderr = open(err_log, 'a', buffering) </s> remove             sys.stdout = open(out_log, 'a', 0)
 </s> add             sys.stdout = open(out_log, 'a', buffering)
        so = open(out_log, 'a+', buffering)
        se = open(err_log, 'a+', buffering)
              sys.stderr.write("fork #2 failed: (%d) %s\n" % (e.errno, e.strerror))
              os._exit(1)
  
          si = open('/dev/null', 'r')
        so = open(out_log, 'a+', buffering)
        se = open(err_log, 'a+', buffering)
        so = open(out_log, 'a+', buffering)
        se = open(err_log, 'a+', buffering)
          os.dup2(si.fileno(), sys.stdin.fileno())
          os.dup2(so.fileno(), sys.stdout.fileno())
          os.dup2(se.fileno(), sys.stderr.fileno())
          # Set custom file descriptors so that they get proper buffering.
          sys.stdout, sys.stderr = so, se
keep keep keep keep replace replace keep keep keep keep keep
 Fixed #20815 -- Don't enforce unbuffered I/O on Python 3.

No test because this code is already deprecated (part of FastCGI support). 
django/utils/daemonize.py