[ python-Bugs-1282539 ] logging.shutdown() not correct for chained handlers

2005-09-05 Thread SourceForge.net
Bugs item #1282539, was opened at 2005-09-05 23:12
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1282539&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Python Library
Group: Python 2.4
Status: Open
Resolution: None
Priority: 5
Submitted By: Fons Dijkstra (fdij)
Assigned to: Nobody/Anonymous (nobody)
Summary: logging.shutdown() not correct for chained handlers

Initial Comment:
Consider the following code:

import logging
import logging.handlers

if __name__ == "__main__":
fh = logging.handlers.RotatingFileHandler("log.txt")
mh = logging.handlers.MemoryHandler(1024, 
logging.ERROR, fh)
logging.getLogger().addHandler(mh)
logging.getLogger().warning("next statement crashes")
logging.shutdown()

which results in a crash due to operating on a closed 
file. The reason is that the shutdown flushes and closes 
all handlers in undefined order. In above case, first 
the 'fh' handlers is flushes and closed then the 'mh' 
handler.

The solution is to first flush all handlers times the 
number of handlers before closing them. Thus (omitting 
error handling):

def shutdown():
for i in range(len(_handlers)):
for h in _handlers.keys():
h.flush()
for h in _handlers.keys():
h.close()


--

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1282539&group_id=5470
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[ python-Bugs-1282647 ] socket.getaddrinfo() bug for IPv6 enabled platforms

2005-09-05 Thread SourceForge.net
Bugs item #1282647, was opened at 2005-09-06 10:16
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1282647&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Extension Modules
Group: Platform-specific
Status: Open
Resolution: None
Priority: 5
Submitted By: Ganesan Rajagopal (rganesan)
Assigned to: Nobody/Anonymous (nobody)
Summary: socket.getaddrinfo() bug for IPv6 enabled platforms

Initial Comment:
==
getaddrinfo(host, port[, family[, socktype[, proto[,
flags)
Resolves the host/port argument, into a sequence of
5-tuples that contain all the necessary argument for
the sockets manipulation. host is a domain name, a
string representation of IPv4/v6 address or None. port
is a string service name (like 'http'), a numeric port
number or None.
==

On Linux (and FreeBSD and probably other IPv6 enabled
hosts), port as a number raises a socket exception

==
 $ python2.4
Python 2.4.1 (#2, May  5 2005, 11:32:06)
[GCC 3.3.5 (Debian 1:3.3.5-12)] on linux2
Type "help", "copyright", "credits" or "license" for
more information.
>>> import socket
>>> socket.getaddrinfo('6bone.net', 'http')
[(10, 1, 6, '', ('2001:5c0:0:2::24', 80, 0, 0)), (2, 1,
6, '', ('209.71.226.24', 80))]
>>> socket.getaddrinfo('6bone.net', 80)
Traceback (most recent call last):
  File "", line 1, in ?
socket.gaierror: (-8, 'Servname not supported for
ai_socktype')
==

Since, on Windows 2003 Server (no IPv6) and Solaris 2.8
(no IPv6), the call works correctly, I am filing this
bug as platform specific.

--

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1282647&group_id=5470
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com