Package: python2.6-minimal Version: 2.6.6~rc1-1 Severity: normal
When my Python script calls flush() on a socket that has lost its connection, it fails with an UnboundLocalError. This should reproduce it: import socket srv_s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) srv_s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) srv_s.bind(("0.0.0.0", 54321)) srv_s.listen(1) cli_s = 0 cli_f = 0 (cli_s, address) = srv_s.accept() # At this point, I connect with "nc localhost 54321". cli_f = cli_s.makefile("w") cli_f.write('abc\r\ndef\r\n') cli_f.flush() # At this point, I terminate nc with C-c. cli_f.write('qwerty\r\nasdf\r\n') cli_f.flush() # No problem yet. cli_f.write('abc\r\ndef\r\n') cli_f.flush() # Now it fails saying: Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/usr/lib/python2.6/socket.py", line 302, in flush del view, data # explicit free UnboundLocalError: local variable 'view' referenced before assignment This code works fine when run with python2.5 from the python2.5-minimal package (that is, I get an socket.error with 'Broken pipe' which would be as expected). -- System Information: Debian Release: squeeze/sid APT prefers testing APT policy: (900, 'testing') Architecture: amd64 (x86_64) Kernel: Linux 2.6.32-5-amd64 (SMP w/4 CPU cores) Locale: LANG=nb_NO.UTF-8, LC_CTYPE=nb_NO.UTF-8 (charmap=UTF-8) (ignored: LC_ALL set to nb_NO.UTF-8) Shell: /bin/sh linked to /bin/dash Versions of packages python2.6-minimal depends on: ii libc6 2.11.2-2 Embedded GNU C Library: Shared lib ii libssl0.9.8 0.9.8o-1 SSL shared libraries ii zlib1g 1:1.2.3.4.dfsg-3 compression library - runtime Versions of packages python2.6-minimal recommends: ii python2.6 2.6.6~rc1-1 An interactive high-level object-o Versions of packages python2.6-minimal suggests: ii binfmt-support 1.2.18 Support for extra binary formats -- no debconf information -- To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org