[ python-Bugs-1230540 ] sys.excepthook doesn't work in threads
Bugs item #1230540, was opened at 2005-06-30 20:06 Message generated for change (Comment added) made by mwh You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1230540&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: Threads Group: Python 2.4 Status: Open Resolution: None Priority: 5 Private: No Submitted By: Jonathan Ellis (ellisj) Assigned to: Nobody/Anonymous (nobody) Summary: sys.excepthook doesn't work in threads Initial Comment: simple script to reproduce: import sys, threading def log_exception(*args): print 'got exception %s' % (args,) sys.excepthook = log_exception def foo(): a = 1 / 0 threading.Thread(target=foo).start() Note that a normal traceback is printed instead of "got exception." -- >Comment By: Michael Hudson (mwh) Date: 2007-06-06 12:11 Message: Logged In: YES user_id=6656 Originator: NO I've just run into this, and it's very annoying. The stupid part is that threads started with the thread module don't have this problem, it's just a problem with threading.Thread()s trying to be too clever. I would vote for deleting all the code to do with exception printing in threading.py and letting the C machinery take care of it. -- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1230540&group_id=5470 ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[ python-Bugs-1722344 ] Thread shutdown exception in Thread.notify()
Bugs item #1722344, was opened at 2007-05-21 00:24
Message generated for change (Comment added) made by thomasda
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1722344&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 Interpreter Core
Group: Python 2.5
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Yang Zhang (yangzhang)
Assigned to: Nobody/Anonymous (nobody)
Summary: Thread shutdown exception in Thread.notify()
Initial Comment:
Hi, I sometimes see the following exceptions when shutting down my app (using
Python 2.5.1):
Unhandled exception in thread started by
Error in sys.excepthook:
Original exception was:
Exception in thread Thread-3 (most likely raised during interpreter shutdown):
Traceback (most recent call last):
File "/usr/local/lib/python2.5/threading.py", line 460, in __bootstrap
File "/usr/local/lib/python2.5/threading.py", line 440, in run
File "/home/yang/local/armed/lib/python2.5/site-packages/afx/threads.py",
line 71, in worker
File "/usr/local/lib/python2.5/Queue.py", line 176, in get
File "/usr/local/lib/python2.5/threading.py", line 248, in notify
: exceptions must be classes, instances, or
strings (deprecated), not NoneType
Unhandled exception in thread started by
Error in sys.excepthook:
Original exception was:
Exception in thread Thread-6 (most likely raised during interpreter shutdown):
Traceback (most recent call last):
File "/usr/local/lib/python2.5/threading.py", line 460, in __bootstrap
File "/usr/local/lib/python2.5/threading.py", line 440, in run
File "/home/yang/local/armed/lib/python2.5/site-packages/afx/threads.py",
line 71, in worker
File "/usr/local/lib/python2.5/Queue.py", line 176, in get
File "/usr/local/lib/python2.5/threading.py", line 248, in notify
: exceptions must be classes, instances, or
strings (deprecated), not NoneType
Unhandled exception in thread started by
Error in sys.excepthook:
Original exception was:
Here is the code from my application:
def worker():
debug( 'starting worker' )
while True:
msg = i.get() # <-- THIS IS LINE 71
if msg is stop_msg: break
resultbuf, func, args, kwargs = msg
result, exc = None, None
try:
result = func( *args, **kwargs )
except:
t, v, tb = exc_info()
exc = t, v, tb.tb_next
o.put( ( resultbuf, result, exc ) )
s.send( 'x' ) # assuming socket.send is thread-safe
debug( 'stopping worker' )
Here is the origin of the exception (in threading.py):
def notify(self, n=1):
assert self._is_owned(), "notify() of un-acquire()d lock" # <-- THIS IS
LINE 248
__waiters = self.__waiters
waiters = __waiters[:n]
if not waiters:
if __debug__:
self._note("%s.notify(): no waiters", self)
return
self._note("%s.notify(): notifying %d waiter%s", self, n,
n!=1 and "s" or "")
for waiter in waiters:
waiter.release()
try:
__waiters.remove(waiter)
except ValueError:
pass
I'm not sure why this is happening. The threads are not daemon threads; I
terminate them cleanly. When I get a SIGINT (I usu. shut down my app with
ctrl-C), I enqueue n stop_msg's to the 'i' Queue so that the n workers can all
exit.
Note I usually launch 5 workers, so I'm not consistently getting an exception
per worker. Also, I've been unable to reproduce this at will.
--
Comment By: Thomas Dybdahl Ahle (thomasda)
Date: 2007-06-06 15:32
Message:
Logged In: YES
user_id=1304417
Originator: NO
I'm getting the same kind of errors.
I'm using a lot of threads, and one of them throws this thread nearly
everytime I close my program (by gtk.main_quit)
It seems that python sets every variable to None, and then wakeup sleeping
threads, which then crash, as they try to work with the None variables
Exception in thread Thread-3 (most likely raised during interpreter
shutdown):
Traceback (most recent call last):
File "/usr/lib/python2.4/threading.py", line 442, in __bootstrap
File
"/home/thomas/Programmering/python/skak/0.7/lib/pychess/System/ThreadPool.py",
line 49, in run
File "/usr/lib/python2.4/Queue.py", line 89, in put
File "/usr/lib/python2.4/threading.py", line 237, in notify
exceptions.TypeError: exceptions must be classes, instances, or strings
(deprecated), not NoneType
Unhandled exception in thread started by
Error in sys.excepthook
--
C
[ python-Bugs-1729930 ] 2.5.1 latest svn fails test_curses and test_timeout
Bugs item #1729930, was opened at 2007-06-02 09:51 Message generated for change (Comment added) made by dfavor You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1729930&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: Build Group: Python 2.5 Status: Open Resolution: None Priority: 5 Private: No Submitted By: David Favor (dfavor) Assigned to: Nobody/Anonymous (nobody) Summary: 2.5.1 latest svn fails test_curses and test_timeout Initial Comment: [EMAIL PROTECTED] ~]# build_python mkdir -p /build/work/Python-2.5.1 cd /build/work/Python-2.5.1 unset CDPATH export TESTOPS='-l -u curses -u network -u urlfetch -u decimal -u compiler -u bsddb -u subprocess' export CFLAGS='-pipe -fwrapv' export MALLOC_CHECK_=0 make distclean ./configure --prefix=/usr/local/pkgs/python-2.5.1 --enable-shared --disable-static --disable-ipv6 make make testall ... ... ... 299 tests OK. 2 tests failed: test_curses test_timeout 20 tests skipped: test_aepack test_al test_applesingle test_bsddb185 test_cd test_cl test_gl test_imgfile test_macfs test_macostools test_nis test_pep277 test_plistlib test_scriptpackages test_startfile test_sunaudiodev test_unicode_file test_winreg test_winsound test_zipfile64 Those skips are all expected on linux2. warning: DBTxn aborted in destructor. No prior commit() or abort(). make: *** [testall] Error 1 exp=0, got ec=2, abort=1 -- >Comment By: David Favor (dfavor) Date: 2007-06-06 10:36 Message: Logged In: YES user_id=370230 Originator: YES test test_timeout failed -- Traceback (most recent call last): File "/build/work/Python-2.5.1/Lib/test/test_timeout.py", line 128, in testConnectTimeout %(_delta, self.fuzz, _timeout)) AssertionError: timeout (8.00152) is more than 2 seconds more than expected (0.001) -- Comment By: Neal Norwitz (nnorwitz) Date: 2007-06-03 17:19 Message: Logged In: YES user_id=33168 Originator: NO test_timeout often fails depending on if the system the test connects to is available or not (ie, the test sucks). How does test_curses fail? What platform? BTW, you can use -u all. -- Comment By: David Favor (dfavor) Date: 2007-06-02 09:54 Message: Logged In: YES user_id=370230 Originator: YES These fixes should also be dropped into the 2.6 tree. -- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1729930&group_id=5470 ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[ python-Bugs-1729930 ] 2.5.1 latest svn fails test_curses and test_timeout
Bugs item #1729930, was opened at 2007-06-02 09:51 Message generated for change (Comment added) made by dfavor You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1729930&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: Build Group: Python 2.5 Status: Open Resolution: None Priority: 5 Private: No Submitted By: David Favor (dfavor) Assigned to: Nobody/Anonymous (nobody) Summary: 2.5.1 latest svn fails test_curses and test_timeout Initial Comment: [EMAIL PROTECTED] ~]# build_python mkdir -p /build/work/Python-2.5.1 cd /build/work/Python-2.5.1 unset CDPATH export TESTOPS='-l -u curses -u network -u urlfetch -u decimal -u compiler -u bsddb -u subprocess' export CFLAGS='-pipe -fwrapv' export MALLOC_CHECK_=0 make distclean ./configure --prefix=/usr/local/pkgs/python-2.5.1 --enable-shared --disable-static --disable-ipv6 make make testall ... ... ... 299 tests OK. 2 tests failed: test_curses test_timeout 20 tests skipped: test_aepack test_al test_applesingle test_bsddb185 test_cd test_cl test_gl test_imgfile test_macfs test_macostools test_nis test_pep277 test_plistlib test_scriptpackages test_startfile test_sunaudiodev test_unicode_file test_winreg test_winsound test_zipfile64 Those skips are all expected on linux2. warning: DBTxn aborted in destructor. No prior commit() or abort(). make: *** [testall] Error 1 exp=0, got ec=2, abort=1 -- >Comment By: David Favor (dfavor) Date: 2007-06-06 10:37 Message: Logged In: YES user_id=370230 Originator: YES test_curses ^[[?1049h^[[1;50r^[(B^[[m^[[4l^[[?7h^[[50;1H^[[?1049l^M^[[?1l^[>test test_curses crashed -- : endwin() returned ERR -- Comment By: David Favor (dfavor) Date: 2007-06-06 10:36 Message: Logged In: YES user_id=370230 Originator: YES test test_timeout failed -- Traceback (most recent call last): File "/build/work/Python-2.5.1/Lib/test/test_timeout.py", line 128, in testConnectTimeout %(_delta, self.fuzz, _timeout)) AssertionError: timeout (8.00152) is more than 2 seconds more than expected (0.001) -- Comment By: Neal Norwitz (nnorwitz) Date: 2007-06-03 17:19 Message: Logged In: YES user_id=33168 Originator: NO test_timeout often fails depending on if the system the test connects to is available or not (ie, the test sucks). How does test_curses fail? What platform? BTW, you can use -u all. -- Comment By: David Favor (dfavor) Date: 2007-06-02 09:54 Message: Logged In: YES user_id=370230 Originator: YES These fixes should also be dropped into the 2.6 tree. -- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1729930&group_id=5470 ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[ python-Bugs-1729930 ] 2.5.1 latest svn fails test_curses and test_timeout
Bugs item #1729930, was opened at 2007-06-02 09:51 Message generated for change (Comment added) made by dfavor You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1729930&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: Build Group: Python 2.5 Status: Open Resolution: None Priority: 5 Private: No Submitted By: David Favor (dfavor) Assigned to: Nobody/Anonymous (nobody) Summary: 2.5.1 latest svn fails test_curses and test_timeout Initial Comment: [EMAIL PROTECTED] ~]# build_python mkdir -p /build/work/Python-2.5.1 cd /build/work/Python-2.5.1 unset CDPATH export TESTOPS='-l -u curses -u network -u urlfetch -u decimal -u compiler -u bsddb -u subprocess' export CFLAGS='-pipe -fwrapv' export MALLOC_CHECK_=0 make distclean ./configure --prefix=/usr/local/pkgs/python-2.5.1 --enable-shared --disable-static --disable-ipv6 make make testall ... ... ... 299 tests OK. 2 tests failed: test_curses test_timeout 20 tests skipped: test_aepack test_al test_applesingle test_bsddb185 test_cd test_cl test_gl test_imgfile test_macfs test_macostools test_nis test_pep277 test_plistlib test_scriptpackages test_startfile test_sunaudiodev test_unicode_file test_winreg test_winsound test_zipfile64 Those skips are all expected on linux2. warning: DBTxn aborted in destructor. No prior commit() or abort(). make: *** [testall] Error 1 exp=0, got ec=2, abort=1 -- >Comment By: David Favor (dfavor) Date: 2007-06-06 10:39 Message: Logged In: YES user_id=370230 Originator: YES Latest 'svn up' shows both these tests still failing in both the 2.5.1 and 2.6 trees. -- Comment By: David Favor (dfavor) Date: 2007-06-06 10:37 Message: Logged In: YES user_id=370230 Originator: YES test_curses ^[[?1049h^[[1;50r^[(B^[[m^[[4l^[[?7h^[[50;1H^[[?1049l^M^[[?1l^[>test test_curses crashed -- : endwin() returned ERR -- Comment By: David Favor (dfavor) Date: 2007-06-06 10:36 Message: Logged In: YES user_id=370230 Originator: YES test test_timeout failed -- Traceback (most recent call last): File "/build/work/Python-2.5.1/Lib/test/test_timeout.py", line 128, in testConnectTimeout %(_delta, self.fuzz, _timeout)) AssertionError: timeout (8.00152) is more than 2 seconds more than expected (0.001) -- Comment By: Neal Norwitz (nnorwitz) Date: 2007-06-03 17:19 Message: Logged In: YES user_id=33168 Originator: NO test_timeout often fails depending on if the system the test connects to is available or not (ie, the test sucks). How does test_curses fail? What platform? BTW, you can use -u all. -- Comment By: David Favor (dfavor) Date: 2007-06-02 09:54 Message: Logged In: YES user_id=370230 Originator: YES These fixes should also be dropped into the 2.6 tree. -- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1729930&group_id=5470 ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[ python-Bugs-1732145 ] python 2.6 latest fails test_socketserver.py
Bugs item #1732145, was opened at 2007-06-06 10:41 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=1732145&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: None Group: None Status: Open Resolution: None Priority: 5 Private: No Submitted By: David Favor (dfavor) Assigned to: Nobody/Anonymous (nobody) Summary: python 2.6 latest fails test_socketserver.py Initial Comment: test_socket_ssl test_socketserver test test_socketserver crashed -- : (104, 'Connection reset by peer') test_softspace test_sort Exception in thread Thread-63: Traceback (most recent call last): File "/build/work/python-2.6/Lib/threading.py", line 465, in __bootstrap self.run() File "/build/work/python-2.6/Lib/test/test_socketserver.py", line 93, in run svr.serve_a_few() File "/build/work/python-2.6/Lib/test/test_socketserver.py", line 35, in serve_a_few self.handle_request() File "/build/work/python-2.6/Lib/SocketServer.py", line 224, in handle_request self.handle_error(request, client_address) File "/build/work/python-2.6/Lib/SocketServer.py", line 222, in handle_request self.process_request(request, client_address) File "/build/work/python-2.6/Lib/SocketServer.py", line 429, in process_request self.collect_children() File "/build/work/python-2.6/Lib/SocketServer.py", line 425, in collect_children self.active_children.remove(pid) ValueError: list.remove(x): x not in list -- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1732145&group_id=5470 ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[ python-Bugs-1732160 ] Unable to Start IDLE
Bugs item #1732160, was opened at 2007-06-06 21:00 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=1732160&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: IDLE Group: Python 2.5 Status: Open Resolution: None Priority: 5 Private: No Submitted By: Kishore (kishore_durai) Assigned to: Nobody/Anonymous (nobody) Summary: Unable to Start IDLE Initial Comment: HI, I am not unable to start Python IDLE from Start menu.. THe hour glass appears once i clikc the icon and vanishes quickly. Can anyone tell me how to fix this problem. Thanks. -- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1732160&group_id=5470 ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[ python-Bugs-1727024 ] subprocess: unreliability of returncode not clear from docs
Bugs item #1727024, was opened at 2007-05-28 13:41
Message generated for change (Comment added) made by collinwinter
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1727024&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: Documentation
Group: Python 2.5
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Dan O'Huiginn (ohuiginn)
Assigned to: Nobody/Anonymous (nobody)
Summary: subprocess: unreliability of returncode not clear from docs
Initial Comment:
The docs for the subprocess module (http://docs.python.org/lib/node533.html)
give the impression that you can reliably find the return code of a process by
checking returncode:
returncode
The child return code. A None value indicates that the process hasn't
terminated yet. A negative value -N indicates that the child was terminated by
signal N (Unix only).
But in fact, returncode is only updated when the poll() method is called, and
therefore will often be out-of-date. For instance
>>> process=subprocess.Popen('true') #*nix command to do nothing
>>> process.returncode
>>> process.returncode==None
True
>>> process.poll()
0
>>> process.returncode
0
As far as I can see, it is always better to use poll() to check the status or
return code of a subprocess. It might be good to either remove returncode from
the docs entirely, or at least to explain that it won't always be correct.
[incidentally, having returncode/poll() give None for a running process, and 0
for a process that has exited successfully, seems like a recipe for generating
bugs. But I guess it's too late to do anything about that now]
--
>Comment By: Collin Winter (collinwinter)
Date: 2007-06-06 12:20
Message:
Logged In: YES
user_id=1344176
Originator: NO
What wording would you rather see in the subprocess docs?
--
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1727024&group_id=5470
___
Python-bugs-list mailing list
Unsubscribe:
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[ python-Bugs-1651995 ] sgmllib _convert_ref UnicodeDecodeError exception, new in 2.
Bugs item #1651995, was opened at 2007-02-04 23:34 Message generated for change (Comment added) made by odormond You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1651995&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: None Status: Open Resolution: None Priority: 5 Private: No Submitted By: John Nagle (nagle) Assigned to: Nobody/Anonymous (nobody) Summary: sgmllib _convert_ref UnicodeDecodeError exception, new in 2. Initial Comment: I'm running a website page through BeautifulSoup. It parses OK with Python 2.4, but Python 2.5 fails with an exception: Traceback (most recent call last): File "./sitetruth/InfoSitePage.py", line 268, in httpfetch self.pagetree = BeautifulSoup.BeautifulSoup(sitetext) # parse into tree form File "./sitetruth/BeautifulSoup.py", line 1326, in __init__ BeautifulStoneSoup.__init__(self, *args, **kwargs) File "./sitetruth/BeautifulSoup.py", line 973, in __init__ self._feed() File "./sitetruth/BeautifulSoup.py", line 998, in _feed SGMLParser.feed(self, markup or "") File "/usr/lib/python2.5/sgmllib.py", line 99, in feed self.goahead(0) File "/usr/lib/python2.5/sgmllib.py", line 133, in goahead k = self.parse_starttag(i) File "/usr/lib/python2.5/sgmllib.py", line 291, in parse_starttag self.finish_starttag(tag, attrs) File "/usr/lib/python2.5/sgmllib.py", line 340, in finish_starttag self.handle_starttag(tag, method, attrs) File "/usr/lib/python2.5/sgmllib.py", line 376, in handle_starttag method(attrs) File "./sitetruth/BeautifulSoup.py", line 1416, in start_meta self._feed(self.declaredHTMLEncoding) File "./sitetruth/BeautifulSoup.py", line 998, in _feed SGMLParser.feed(self, markup or "") File "/usr/lib/python2.5/sgmllib.py", line 99, in feed self.goahead(0) File "/usr/lib/python2.5/sgmllib.py", line 133, in goahead k = self.parse_starttag(i) File "/usr/lib/python2.5/sgmllib.py", line 285, in parse_starttag self._convert_ref, attrvalue) UnicodeDecodeError: 'ascii' codec can't decode byte 0xa7 in position 0: ordinal not in range(128) The code that's failing is in "_convert_ref", which is new in Python 2.5. That function wasn't present in 2.4. I think the code is trying to handle single quotes inside of double quotes in HTML attributes, or something like that. To replicate, run http://www.bankofamerica.com or http://www.gm.com through BeautifulSoup. Something about this code doesn't like big companies. Web sites of smaller companies are going through OK. -- Comment By: Olivier Dormond (odormond) Date: 2007-06-06 18:38 Message: Logged In: YES user_id=512858 Originator: NO Hello, I've been able to fix this entity conversion bug with the following patch. Cheers, Odie --- /usr/lib/python2.5/sgmllib.py 2007-05-27 17:55:15.0 +0200 +++ modules/sgmllib.py 2007-06-06 18:29:13.0 +0200 @@ -396,7 +396,7 @@ return self.convert_codepoint(n) def convert_codepoint(self, codepoint): -return chr(codepoint) +return unichr(codepoint) def handle_charref(self, name): """Handle character reference, no need to override.""" -- Comment By: John Nagle (nagle) Date: 2007-04-27 23:41 Message: Logged In: YES user_id=5571 Originator: YES We've been running this fix for several months now, and it seems to work. Would someone please check it and put it into the trunk? Thanks. -- Comment By: John Nagle (nagle) Date: 2007-02-07 08:57 Message: Logged In: YES user_id=5571 Originator: YES Found the problem. In sgmllib.py for Python 2.5, in convert_charref, the code for handling character escapes assumes that ASCII characters have values up to 255. But the correct limit is 127, of course. If a Unicode string is run through SGMLparser, and that string has a character in an attribute with a value between 128 and 255, which is valid in Unicode, the value is passed through as a character with "chr", creating a one-character invalid ASCII string. Then, when the bad string is later converted to Unicode as the output is assembled, the UnicodeDecodeError exception is raised. So the fix is to change 255 to 127 in convert_charref in sgmllib.py, as shown below. This forces characters above 127 to be expressed with escape sequences. Please patch accordingly. Thanks. def convert_charref(self, name): """Convert character reference, may be overridden.""" try: n = int(name) except ValueError: return if not 0 <= n <= 127 : # ASCII ends at 127, not 255 return return sel
[ python-Bugs-1717900 ] Destructor behavior faulty
Bugs item #1717900, was opened at 2007-05-12 15:41 Message generated for change (Comment added) made by alanmcintyre You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1717900&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 Interpreter Core Group: None Status: Closed Resolution: None Priority: 5 Private: No Submitted By: Wolf Rogner (wrogner) Assigned to: Nobody/Anonymous (nobody) Summary: Destructor behavior faulty Initial Comment: I tried example 11.4. from bytesofpython (by C.H. Swaroop). Example works fine. Added a new Person instance 'wolf' -> Program terminated with: Exception exceptions.AttributeError: "'NoneType' object has no attribute 'population'" in > ignored added print list(globals()) -> ['kalam', '__builtins__', '__file__', 'DBGPHideChildren', 'swaroop', 'Person', 'wolf', '__name__', '__doc__'] changed wolf to aaa: print list(globals()) -> ['aaa', 'kalam', '__builtins__', '__file__', 'DBGPHideChildren', 'swaroop', 'Person', '__name__', '__doc__'] Please note the position of 'aaa' at the beginning of the list, before 'Person'. With 'wolf' being after 'Person'. If the destructing code removes items in this order, no wonder I get an error. Person should not get deleted if refcount is still > 0. Wolf Rogner -- Comment By: Alan McIntyre (alanmcintyre) Date: 2007-06-06 11:38 Message: Logged In: YES user_id=1115903 Originator: NO Brought this up on python-dev: http://mail.python.org/pipermail/python-dev/2007-May/073329.html Since there is some interest in making the change Armin suggested, I suggest re-opening this item so that it doesn't get overlooked/forgotten. -- Comment By: SourceForge Robot (sf-robot) Date: 2007-05-27 21:20 Message: Logged In: YES user_id=1312539 Originator: NO This Tracker item was closed automatically by the system. It was previously set to a Pending status, and the original submitter did not respond within 14 days (the time period specified by the administrator of this Tracker). -- Comment By: Georg Brandl (gbrandl) Date: 2007-05-17 03:15 Message: Logged In: YES user_id=849994 Originator: NO Alan: you should bring that up on python-dev. -- Comment By: Alan McIntyre (alanmcintyre) Date: 2007-05-16 17:58 Message: Logged In: YES user_id=1115903 Originator: NO I tried out a simple change (to the trunk) in _PyModule_Clear to prevent this particular problem. Between the "remove everything beginning with an underscore" and the "remove everything except __builtins__" steps, I added a step to remove all instance objects in the module's dictionary. It appears to stop this problem and passes the regression test suite. I can post it as a patch if this seems like a reasonable change to make. Also, I noticed that earlier I posted the wrong link for the location of the example code; it should have been: http://www.dpawson.co.uk/bop/byteofpython_120.txt -- Comment By: Gabriel Genellina (gagenellina) Date: 2007-05-16 17:06 Message: Logged In: YES user_id=479790 Originator: NO FWIW, the script name appears to be relevant as well. I were going to say that I could not reproduce it as it was; this same example saved as "a.py" doesn't show the error; "w.py" does. To the OP: Module finalization is a fragile step; this is a long standing issue and could be improved, but anyway I don't think it can be made robust enough (this is just my opinion!). I usually try to *never* reference any globals in destructors. In this case, using self.__class__ instead of Person is safer and works fine; if other globals were needed they could be passed as default argument values. -- Comment By: Gabriel Genellina (gagenellina) Date: 2007-05-16 06:19 Message: Logged In: YES user_id=479790 Originator: NO FWIW, the script name appears to be relevant as well. I were going to say that I could not reproduce it as it was; this same example saved as "a.py" doesn't show the error; "w.py" does. To the OP: Module finalization is a fragile step; this is a long standing issue and could be improved, but anyway I don't think it can be made robust enough (this is just my opinion!). I usually try to *never* reference any globals in destructors. In this case, using self.__class__ instead of Person is safer and works fine; if other globals were needed they could be passed as default argument values. -- Comment By: Gabriel Gen
[ python-Bugs-1712522 ] urllib.quote throws exception on Unicode URL
Bugs item #1712522, was opened at 2007-05-04 06:11 Message generated for change (Comment added) made by nagle You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1712522&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: None Status: Open Resolution: None Priority: 5 Private: No Submitted By: John Nagle (nagle) Assigned to: Nobody/Anonymous (nobody) Summary: urllib.quote throws exception on Unicode URL Initial Comment: The code in urllib.quote fails on Unicode input, when called by robotparser with a Unicode URL. Traceback (most recent call last): File "./sitetruth/InfoSitePage.py", line 415, in run pagetree = self.httpfetch() # fetch page File "./sitetruth/InfoSitePage.py", line 368, in httpfetch if not self.owner().checkrobotaccess(self.requestedurl) : # if access disallowed by robots.txt file File "./sitetruth/InfoSiteContent.py", line 446, in checkrobotaccess return(self.robotcheck.can_fetch(config.kuseragent, url)) # return can fetch File "/usr/local/lib/python2.5/robotparser.py", line 159, in can_fetch url = urllib.quote(urlparse.urlparse(urllib.unquote(url))[2]) or "/" File "/usr/local/lib/python2.5/urllib.py", line 1197, in quote res = map(safe_map.__getitem__, s) KeyError: u'\xe2' That bit of code needs some attention. - It still assumes ASCII goes up to 255, which hasn't been true in Python for a while now. - The initialization may not be thread-safe; a table is being initialized on first use. "robotparser" was trying to check if a URL with a Unicode character in it was allowed. Note the "KeyError: u'\xe2'" -- >Comment By: John Nagle (nagle) Date: 2007-06-06 16:49 Message: Logged In: YES user_id=5571 Originator: YES As a workaround, you can surround calls to "can_fetch" with an try-block and catch KeyError exceptions. That's what I'm doing. -- Comment By: Collin Winter (collinwinter) Date: 2007-06-05 23:39 Message: Logged In: YES user_id=1344176 Originator: NO Could you possibly provide a patch to fix this? -- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1712522&group_id=5470 ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[ python-Bugs-1732212 ] repr of 'nan' floats not parseable
Bugs item #1732212, was opened at 2007-06-06 16:50
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=1732212&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 Interpreter Core
Group: None
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Pete Shinners (shredwheat)
Assigned to: Nobody/Anonymous (nobody)
Summary: repr of 'nan' floats not parseable
Initial Comment:
The repr of float('nan') is not parsable as a literal in Python.
If the repr of 'nan' became "float('nan')" then the result could be evaluated
to produce the same results.
A better possible solution would be to add "nan" and "inf" as attributes on
float. These would be accessed as "float.nan" and "float.inf". This doesn't
allow for "-inf" as cleanly, but "float.ninf" could be acceptable. Repr would
be changed to return these.
A patch can be provided if the solution sounds resonable.
>>> repr((1.0, 2.0, 3.0))
'(1.0, 2.0, 3.0)'
>>> eval(_)
(1.0, 2.0, 3.0)
>>> repr((1.0, float('nan'), 3.0))
'(1.0, nan, 3.0)'
>>> eval(_)
NameError: name 'nan' is not defined
--
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1732212&group_id=5470
___
Python-bugs-list mailing list
Unsubscribe:
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[ python-Bugs-1731706 ] tkinter memory leak problem
Bugs item #1731706, was opened at 2007-06-05 15:47 Message generated for change (Comment added) made by robhancock You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1731706&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: Tkinter Group: None Status: Open Resolution: None Priority: 5 Private: No Submitted By: Robert Hancock (robhancock) Assigned to: Martin v. Löwis (loewis) Summary: tkinter memory leak problem Initial Comment: We have a Python application which displays a GUI using Tkinter and Pmw. We have seen that over time the memory usage of the app seems to continuously increase and eventually use up all of the system's RAM. I ran the app under Valgrind, and this leak seems to account for most of the memory that it detects as being leaked: ==31141== 2,630,208 (806,400 direct, 1,823,808 indirect) bytes in 21 blocks are definitely lost in loss record 156 of 159 ==31141==at 0x4A05809: malloc (vg_replace_malloc.c:149) ==31141==by 0x368268844A: TclThreadAllocObj (in /usr/lib64/libtcl8.4.so) ==31141==by 0x3682686BA0: Tcl_NewStringObj (in /usr/lib64/libtcl8.4.so) ==31141==by 0x8B3B258: AsObj (_tkinter.c:902) ==31141==by 0x8B3BB1C: Tkapp_CallArgs (_tkinter.c:1149) ==31141==by 0x8B3BD67: Tkapp_CallProc (_tkinter.c:1224) ==31141==by 0x36826786D4: Tcl_ServiceEvent (in /usr/lib64/libtcl8.4.so) ==31141==by 0x3682678A20: Tcl_DoOneEvent (in /usr/lib64/libtcl8.4.so) ==31141==by 0x8B3F55B: Tkapp_MainLoop (_tkinter.c:2532) ==31141==by 0x36900949D9: PyEval_EvalFrame (in /usr/lib64/libpython2.4.so.1.0) ==31141==by 0x3690095904: PyEval_EvalCodeEx (in /usr/lib64/libpython2.4.so.1.0) ==31141==by 0x369009405E: PyEval_EvalFrame (in /usr/lib64/libpython2.4.so.1.0) ==31141==by 0x3690094485: PyEval_EvalFrame (in /usr/lib64/libpython2.4.so.1.0) ==31141==by 0x3690095904: PyEval_EvalCodeEx (in /usr/lib64/libpython2.4.so.1.0) ==31141==by 0x3690095951: PyEval_EvalCode (in /usr/lib64/libpython2.4.so.1.0) ==31141==by 0x36900B1EA8: (within /usr/lib64/libpython2.4.so.1.0) ==31141==by 0x36900B3357: PyRun_SimpleFileExFlags (in /usr/lib64/libpython2.4.so.1.0) ==31141==by 0x36900B979C: Py_Main (in /usr/lib64/libpython2.4.so.1.0) ==31141==by 0x368161D8A3: (below main) (in /lib64/libc-2.5.so) Looking at the code in _tkinter.c, I am not sure how the Tkapp_CallDeallocArgs function is supposed to get called in the case where we push the request onto the Tcl interpreter thread in Tkapp_Call. That call is what would presumably release this allocated memory. This is using Python 2.4.3 and tcl/tk 8.4.13. Looking at Python SVN, there does not seem to be any relevant code changes in _tkinter.c in later versions.. -- >Comment By: Robert Hancock (robhancock) Date: 2007-06-06 10:53 Message: Logged In: YES user_id=1809277 Originator: YES Found a couple of issues in _tkinter.c that appear to have been causing this: -When calls were forwarded onto the Tcl interpreter thread, the Tkapp_CallDeallocArgs function was never called to clean up the converted arguments after the call. -Tcl_Condition variables were never finalized after being used. According to the Tcl documentation, if this is not done they are only cleaned up on program exit, resulting in them accumulating during runtime. I'm attaching a patch against Python 2.4.3 to fix this problem. It likely applies to later versions as well. File Added: python-2.4.3-memleak-fix.patch -- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1731706&group_id=5470 ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[ python-Bugs-1445210 ] embedding Python causes memory leaks
Bugs item #1445210, was opened at 2006-03-08 00:20
Message generated for change (Comment added) made by loewis
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1445210&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 Interpreter Core
Group: None
Status: Closed
Resolution: Wont Fix
Priority: 5
Private: No
Submitted By: Andrew Trevorrow (andykt)
Assigned to: Nobody/Anonymous (nobody)
Summary: embedding Python causes memory leaks
Initial Comment:
[This bug has been submitted by others but for some reason it
has been marked Closed. I consider it to be an extremely serious
bug -- if I can't solve it I'm going to have to abandon Python as
my app's scripting language, even though I've fallen in love!]
I've added Python script support to my cross-platfom wxWidgets app
so that users can run .py scripts from within the app to automate the
GUI and do other fancy things. It all works very nicely, except for
one nasty problem: *every* time a script is run there is a memory leak,
usually small (about 10K) but sometimes massive (about 4MB in the
case of one rather complicated script).
The problem occurs on both Mac OS 10.3.9 and Windows 2000.
I'm using Python 2.3 on the Mac and 2.4.2 on Windows.
Every time the user runs a script, my app makes these calls:
(I've removed a lot of irrelevant stuff.)
Py_Initialize();
PyRun_SimpleString("execfile('foo.py')");
Py_Finalize();
It's definitely not a wxWidgets problem. In fact it's quite easy to
see the memory leak using a simple command-line program:
#include
#include
main(int argc, char *argv[])
{
int i;
for (i=0; i<1000; i++) {
Py_Initialize();
Py_Finalize();
printf(".");
if ((i+1) % 50 == 0) printf("\n");
}
}
Note that it doesn't even execute a script. If I run this program on
my Mac and watch its memory usage with Activity Monitor, I see a leak
of about 10K each time through the loop. Similar result on Windows.
Curiously, on both machines, the Py_Finalize() call takes longer and
longer to complete whatever it's doing. The above program takes a
few *minutes* to complete on my 400MHz Mac.
Andrew
--
>Comment By: Martin v. Löwis (loewis)
Date: 2007-06-06 20:12
Message:
Logged In: YES
user_id=21627
Originator: NO
If you are calling Py_Finalize multiple times, (small) memory leaks are
expected. So don't call Py_Finalize until your program terminates.
--
Comment By: suresh (suresh_sf)
Date: 2007-06-06 08:22
Message:
Logged In: YES
user_id=1809507
Originator: NO
I too am having the exact similar problem with embedded python. Is this a
expected behaviour? if so how can we use python for long running tasks
without running out of memory eventually? We even tried doing Py_Initialize
once during startup and executing scripts before calling Py_Finalize. Even
this runs out of memory after some time. BTW, I am running Python 2.5.1.
--
Comment By: Martin v. Löwis (loewis)
Date: 2006-04-13 09:29
Message:
Logged In: YES
user_id=21627
That the documentation claims Py_Finalize releases all
memory is a bug; I just fixed this in r45344. The original
problem cannot be fixed (atleast not until Python 3000);
closing it as "won't fix".
--
Comment By: Andrew Trevorrow (andykt)
Date: 2006-03-10 06:43
Message:
Logged In: YES
user_id=1281947
See http://evanjones.ca/python-memory.html for some
useful info. Apparently the Python memory allocator never
releases memory back to the OS! So if a complicated script
happens to consume 100MB of interpreter memory then
that amount is no longer available to the app in which
Python is embedded. Even worse, if a script has a
(Python) memory leak then there's nothing the app can
do about it. It would be great if wrapping each script
inside Py_Initialize/Py_Finalize could avoid all that.
There should be some way to tell Python "release all
the memory you've ever allocated and start again
with a clean slate".
--
Comment By: Andrew Trevorrow (andykt)
Date: 2006-03-08 10:50
Message:
Logged In: YES
user_id=1281947
Bloody hell -- sorry for the bad line breaks.
One day I'll figure out how to use sf properly!
--
Comment By: Andrew Trevorrow (andykt)
Date: 2006-03-08 10:46
Message:
Logged In: YES
user_id=1281947
> Why do you call Py_Initialize/Py_Finalize more than once?
How else do I tell Python to free up memory after each PyRun_SimpleString
call?
I want users to be able to run scripts many t
[ python-Bugs-1730114 ] cStringIO no longer accepts array.array objects
Bugs item #1730114, was opened at 2007-06-03 01:01
Message generated for change (Comment added) made by gbrandl
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1730114&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: Python 2.5
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: reedobrien (reedobrien)
Assigned to: Georg Brandl (gbrandl)
Summary: cStringIO no longer accepts array.array objects
Initial Comment:
It worked fine in 2.5 and 2.4.4
Python 2.5.1 (r251:54863, Jun 2 2007, 19:09:15)
Type "copyright", "credits" or "license" for more information.
In [1]: from cStringIO import StringIO
In [2]: from array import array
In [3]: a = array('B', [0,1,2])
In [4]: StringIO(a)
---
Traceback (most recent call last)
/Users/reedobrien/ in ()
: expected a character buffer object
Recompiling with the 2.5 cStringIO.c it works.
Python 2.5.1 (r251:54863, Jun 2 2007, 20:06:12)
Type "copyright", "credits" or "license" for more information.
In [1]: from array import array
In [2]: from cStringIO import StringIO
In [3]: a = array('B', [0,1,2])
In [4]: StringIO(a)
Out[4]:
I blame Visual Studio.
I don't know enough c to fix it.
--
>Comment By: Georg Brandl (gbrandl)
Date: 2007-06-06 18:12
Message:
Logged In: YES
user_id=849994
Originator: NO
I'll look at it.
--
Comment By: Raymond Hettinger (rhettinger)
Date: 2007-06-03 06:40
Message:
Logged In: YES
user_id=80475
Originator: NO
Georgbot, I believe this was your checkin.
--
Comment By: reedobrien (reedobrien)
Date: 2007-06-03 05:49
Message:
Logged In: YES
user_id=995094
Originator: YES
It appears this is the change that broke it.
http://svn.python.org/view/python/branches/release25-maint/Modules/cStringIO.c?rev=52302&r1=51333&r2=52302
This is the log entry from that changeset:
Bug #1548891: The cStringIO.StringIO() constructor now encodes unicode
arguments with the system default encoding just like the write()
method does, instead of converting it to a raw buffer.
(backport from rev. 52301)
Perhaps the cPickle module should be used instead...
BUT at first glance the following seems to make both work:
if (PyUnicode_Check(s))
{
if (PyObject_AsCharBuffer(s, (const char **)&buf, &size) != 0)
{
PyErr_Format(PyExc_TypeError, "expected character
buffer, %.200s
found",
s->ob_type->tp_name);
return NULL;
}
}
else
{
if (PyObject_AsReadBuffer(s, (const void **)&buf, &size) != 0)
return NULL;
}
But the more I think about it the more I think cPickle is more appropriate
for this purpose. In that case I should make a blurb for the docs about
not storing arbitrary data in cStringIO.
Either way I am attaching the cStringIO.c file that worked for me...
File Added: cStringIO.c
--
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1730114&group_id=5470
___
Python-bugs-list mailing list
Unsubscribe:
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[ python-Bugs-1732212 ] repr of 'nan' floats not parseable
Bugs item #1732212, was opened at 2007-06-06 18:50
Message generated for change (Comment added) made by loewis
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1732212&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 Interpreter Core
Group: None
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Pete Shinners (shredwheat)
Assigned to: Nobody/Anonymous (nobody)
Summary: repr of 'nan' floats not parseable
Initial Comment:
The repr of float('nan') is not parsable as a literal in Python.
If the repr of 'nan' became "float('nan')" then the result could be evaluated
to produce the same results.
A better possible solution would be to add "nan" and "inf" as attributes on
float. These would be accessed as "float.nan" and "float.inf". This doesn't
allow for "-inf" as cleanly, but "float.ninf" could be acceptable. Repr would
be changed to return these.
A patch can be provided if the solution sounds resonable.
>>> repr((1.0, 2.0, 3.0))
'(1.0, 2.0, 3.0)'
>>> eval(_)
(1.0, 2.0, 3.0)
>>> repr((1.0, float('nan'), 3.0))
'(1.0, nan, 3.0)'
>>> eval(_)
NameError: name 'nan' is not defined
--
>Comment By: Martin v. Löwis (loewis)
Date: 2007-06-06 20:40
Message:
Logged In: YES
user_id=21627
Originator: NO
Please discuss this on python-dev.
--
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1732212&group_id=5470
___
Python-bugs-list mailing list
Unsubscribe:
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[ python-Bugs-1727024 ] subprocess: unreliability of returncode not clear from docs
Bugs item #1727024, was opened at 2007-05-28 17:41
Message generated for change (Comment added) made by ohuiginn
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1727024&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: Documentation
Group: Python 2.5
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Dan O'Huiginn (ohuiginn)
Assigned to: Nobody/Anonymous (nobody)
Summary: subprocess: unreliability of returncode not clear from docs
Initial Comment:
The docs for the subprocess module (http://docs.python.org/lib/node533.html)
give the impression that you can reliably find the return code of a process by
checking returncode:
returncode
The child return code. A None value indicates that the process hasn't
terminated yet. A negative value -N indicates that the child was terminated by
signal N (Unix only).
But in fact, returncode is only updated when the poll() method is called, and
therefore will often be out-of-date. For instance
>>> process=subprocess.Popen('true') #*nix command to do nothing
>>> process.returncode
>>> process.returncode==None
True
>>> process.poll()
0
>>> process.returncode
0
As far as I can see, it is always better to use poll() to check the status or
return code of a subprocess. It might be good to either remove returncode from
the docs entirely, or at least to explain that it won't always be correct.
[incidentally, having returncode/poll() give None for a running process, and 0
for a process that has exited successfully, seems like a recipe for generating
bugs. But I guess it's too late to do anything about that now]
--
>Comment By: Dan O'Huiginn (ohuiginn)
Date: 2007-06-06 18:41
Message:
Logged In: YES
user_id=1803299
Originator: YES
Thanks for the reply, Collin. Perhaps something like:
Note: The value stored in returncode may be out-of-date. Use poll() to
reliably find the current return code.
Alternatively, would it be possible to leave it out completely [and move
the explanation of what return codes mean up into the description of
poll()]? I can´t imagine many situations where it is a good idea to check
returncode directly, and as I understand it the module documentation only
covers variables that are useful to the outside world.
--
Comment By: Collin Winter (collinwinter)
Date: 2007-06-06 16:20
Message:
Logged In: YES
user_id=1344176
Originator: NO
What wording would you rather see in the subprocess docs?
--
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1727024&group_id=5470
___
Python-bugs-list mailing list
Unsubscribe:
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[ python-Bugs-1729930 ] 2.5.1 latest svn fails test_curses and test_timeout
Bugs item #1729930, was opened at 2007-06-02 09:51 Message generated for change (Comment added) made by dfavor You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1729930&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: Build Group: Python 2.5 Status: Open Resolution: None Priority: 5 Private: No Submitted By: David Favor (dfavor) Assigned to: Nobody/Anonymous (nobody) Summary: 2.5.1 latest svn fails test_curses and test_timeout Initial Comment: [EMAIL PROTECTED] ~]# build_python mkdir -p /build/work/Python-2.5.1 cd /build/work/Python-2.5.1 unset CDPATH export TESTOPS='-l -u curses -u network -u urlfetch -u decimal -u compiler -u bsddb -u subprocess' export CFLAGS='-pipe -fwrapv' export MALLOC_CHECK_=0 make distclean ./configure --prefix=/usr/local/pkgs/python-2.5.1 --enable-shared --disable-static --disable-ipv6 make make testall ... ... ... 299 tests OK. 2 tests failed: test_curses test_timeout 20 tests skipped: test_aepack test_al test_applesingle test_bsddb185 test_cd test_cl test_gl test_imgfile test_macfs test_macostools test_nis test_pep277 test_plistlib test_scriptpackages test_startfile test_sunaudiodev test_unicode_file test_winreg test_winsound test_zipfile64 Those skips are all expected on linux2. warning: DBTxn aborted in destructor. No prior commit() or abort(). make: *** [testall] Error 1 exp=0, got ec=2, abort=1 -- >Comment By: David Favor (dfavor) Date: 2007-06-06 14:00 Message: Logged In: YES user_id=370230 Originator: YES Answering platform request. Fedora 6 with latest patches. -- Comment By: David Favor (dfavor) Date: 2007-06-06 10:39 Message: Logged In: YES user_id=370230 Originator: YES Latest 'svn up' shows both these tests still failing in both the 2.5.1 and 2.6 trees. -- Comment By: David Favor (dfavor) Date: 2007-06-06 10:37 Message: Logged In: YES user_id=370230 Originator: YES test_curses ^[[?1049h^[[1;50r^[(B^[[m^[[4l^[[?7h^[[50;1H^[[?1049l^M^[[?1l^[>test test_curses crashed -- : endwin() returned ERR -- Comment By: David Favor (dfavor) Date: 2007-06-06 10:36 Message: Logged In: YES user_id=370230 Originator: YES test test_timeout failed -- Traceback (most recent call last): File "/build/work/Python-2.5.1/Lib/test/test_timeout.py", line 128, in testConnectTimeout %(_delta, self.fuzz, _timeout)) AssertionError: timeout (8.00152) is more than 2 seconds more than expected (0.001) -- Comment By: Neal Norwitz (nnorwitz) Date: 2007-06-03 17:19 Message: Logged In: YES user_id=33168 Originator: NO test_timeout often fails depending on if the system the test connects to is available or not (ie, the test sucks). How does test_curses fail? What platform? BTW, you can use -u all. -- Comment By: David Favor (dfavor) Date: 2007-06-02 09:54 Message: Logged In: YES user_id=370230 Originator: YES These fixes should also be dropped into the 2.6 tree. -- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1729930&group_id=5470 ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[ python-Bugs-1729930 ] 2.5.1 latest svn fails test_curses and test_timeout
Bugs item #1729930, was opened at 2007-06-02 07:51 Message generated for change (Comment added) made by nnorwitz You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1729930&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: Build Group: Python 2.5 Status: Open Resolution: None Priority: 5 Private: No Submitted By: David Favor (dfavor) Assigned to: Nobody/Anonymous (nobody) Summary: 2.5.1 latest svn fails test_curses and test_timeout Initial Comment: [EMAIL PROTECTED] ~]# build_python mkdir -p /build/work/Python-2.5.1 cd /build/work/Python-2.5.1 unset CDPATH export TESTOPS='-l -u curses -u network -u urlfetch -u decimal -u compiler -u bsddb -u subprocess' export CFLAGS='-pipe -fwrapv' export MALLOC_CHECK_=0 make distclean ./configure --prefix=/usr/local/pkgs/python-2.5.1 --enable-shared --disable-static --disable-ipv6 make make testall ... ... ... 299 tests OK. 2 tests failed: test_curses test_timeout 20 tests skipped: test_aepack test_al test_applesingle test_bsddb185 test_cd test_cl test_gl test_imgfile test_macfs test_macostools test_nis test_pep277 test_plistlib test_scriptpackages test_startfile test_sunaudiodev test_unicode_file test_winreg test_winsound test_zipfile64 Those skips are all expected on linux2. warning: DBTxn aborted in destructor. No prior commit() or abort(). make: *** [testall] Error 1 exp=0, got ec=2, abort=1 -- >Comment By: Neal Norwitz (nnorwitz) Date: 2007-06-06 19:02 Message: Logged In: YES user_id=33168 Originator: NO David, I don't have access to a fedora 6 box. Could you either debug the problem or provide access to such a box? I think I have seen the curses problem somewhere else, so this may be an API issue that the python module doesn't handle it correctly. -- Comment By: David Favor (dfavor) Date: 2007-06-06 12:00 Message: Logged In: YES user_id=370230 Originator: YES Answering platform request. Fedora 6 with latest patches. -- Comment By: David Favor (dfavor) Date: 2007-06-06 08:39 Message: Logged In: YES user_id=370230 Originator: YES Latest 'svn up' shows both these tests still failing in both the 2.5.1 and 2.6 trees. -- Comment By: David Favor (dfavor) Date: 2007-06-06 08:37 Message: Logged In: YES user_id=370230 Originator: YES test_curses ^[[?1049h^[[1;50r^[(B^[[m^[[4l^[[?7h^[[50;1H^[[?1049l^M^[[?1l^[>test test_curses crashed -- : endwin() returned ERR -- Comment By: David Favor (dfavor) Date: 2007-06-06 08:36 Message: Logged In: YES user_id=370230 Originator: YES test test_timeout failed -- Traceback (most recent call last): File "/build/work/Python-2.5.1/Lib/test/test_timeout.py", line 128, in testConnectTimeout %(_delta, self.fuzz, _timeout)) AssertionError: timeout (8.00152) is more than 2 seconds more than expected (0.001) -- Comment By: Neal Norwitz (nnorwitz) Date: 2007-06-03 15:19 Message: Logged In: YES user_id=33168 Originator: NO test_timeout often fails depending on if the system the test connects to is available or not (ie, the test sucks). How does test_curses fail? What platform? BTW, you can use -u all. -- Comment By: David Favor (dfavor) Date: 2007-06-02 07:54 Message: Logged In: YES user_id=370230 Originator: YES These fixes should also be dropped into the 2.6 tree. -- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1729930&group_id=5470 ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[ python-Bugs-1445210 ] embedding Python causes memory leaks
Bugs item #1445210, was opened at 2006-03-07 15:20
Message generated for change (Comment added) made by nnorwitz
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1445210&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 Interpreter Core
Group: None
Status: Closed
Resolution: Wont Fix
Priority: 5
Private: No
Submitted By: Andrew Trevorrow (andykt)
Assigned to: Nobody/Anonymous (nobody)
Summary: embedding Python causes memory leaks
Initial Comment:
[This bug has been submitted by others but for some reason it
has been marked Closed. I consider it to be an extremely serious
bug -- if I can't solve it I'm going to have to abandon Python as
my app's scripting language, even though I've fallen in love!]
I've added Python script support to my cross-platfom wxWidgets app
so that users can run .py scripts from within the app to automate the
GUI and do other fancy things. It all works very nicely, except for
one nasty problem: *every* time a script is run there is a memory leak,
usually small (about 10K) but sometimes massive (about 4MB in the
case of one rather complicated script).
The problem occurs on both Mac OS 10.3.9 and Windows 2000.
I'm using Python 2.3 on the Mac and 2.4.2 on Windows.
Every time the user runs a script, my app makes these calls:
(I've removed a lot of irrelevant stuff.)
Py_Initialize();
PyRun_SimpleString("execfile('foo.py')");
Py_Finalize();
It's definitely not a wxWidgets problem. In fact it's quite easy to
see the memory leak using a simple command-line program:
#include
#include
main(int argc, char *argv[])
{
int i;
for (i=0; i<1000; i++) {
Py_Initialize();
Py_Finalize();
printf(".");
if ((i+1) % 50 == 0) printf("\n");
}
}
Note that it doesn't even execute a script. If I run this program on
my Mac and watch its memory usage with Activity Monitor, I see a leak
of about 10K each time through the loop. Similar result on Windows.
Curiously, on both machines, the Py_Finalize() call takes longer and
longer to complete whatever it's doing. The above program takes a
few *minutes* to complete on my 400MHz Mac.
Andrew
--
>Comment By: Neal Norwitz (nnorwitz)
Date: 2007-06-06 19:19
Message:
Logged In: YES
user_id=33168
Originator: NO
Also, it is quite common for third party C extension modules (those not
distributed with Python) to contain memory leaks. If you are using any
third party extension, you should investigate it very carefully to verify
it is not leaking memory. You can use various memory debuggers to help
find this problem. Valrgind and purify come to mind.
--
Comment By: Martin v. Löwis (loewis)
Date: 2007-06-06 11:12
Message:
Logged In: YES
user_id=21627
Originator: NO
If you are calling Py_Finalize multiple times, (small) memory leaks are
expected. So don't call Py_Finalize until your program terminates.
--
Comment By: suresh (suresh_sf)
Date: 2007-06-05 23:22
Message:
Logged In: YES
user_id=1809507
Originator: NO
I too am having the exact similar problem with embedded python. Is this a
expected behaviour? if so how can we use python for long running tasks
without running out of memory eventually? We even tried doing Py_Initialize
once during startup and executing scripts before calling Py_Finalize. Even
this runs out of memory after some time. BTW, I am running Python 2.5.1.
--
Comment By: Martin v. Löwis (loewis)
Date: 2006-04-13 00:29
Message:
Logged In: YES
user_id=21627
That the documentation claims Py_Finalize releases all
memory is a bug; I just fixed this in r45344. The original
problem cannot be fixed (atleast not until Python 3000);
closing it as "won't fix".
--
Comment By: Andrew Trevorrow (andykt)
Date: 2006-03-09 21:43
Message:
Logged In: YES
user_id=1281947
See http://evanjones.ca/python-memory.html for some
useful info. Apparently the Python memory allocator never
releases memory back to the OS! So if a complicated script
happens to consume 100MB of interpreter memory then
that amount is no longer available to the app in which
Python is embedded. Even worse, if a script has a
(Python) memory leak then there's nothing the app can
do about it. It would be great if wrapping each script
inside Py_Initialize/Py_Finalize could avoid all that.
There should be some way to tell Python "release all
the memory you've ever allocated and start again
with a clean slate".
--
Comment By: Andrew Trevorrow
[ python-Bugs-1732557 ] T_LONGLONG chokes on ints
Bugs item #1732557, was opened at 2007-06-06 23:23 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=1732557&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: None Group: None Status: Open Resolution: None Priority: 5 Private: No Submitted By: Roger Upole (rupole) Assigned to: Nobody/Anonymous (nobody) Summary: T_LONGLONG chokes on ints Initial Comment: Structmember attributes defined as T_LONGLONG or T_ULONGLONG won't accept a plain int, and give a misleading error msg: TypeError: bad argument type for built-in operation -- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1732557&group_id=5470 ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[ python-Bugs-1731717 ] race condition in subprocess module
Bugs item #1731717, was opened at 2007-06-05 15:19
Message generated for change (Comment added) made by nnorwitz
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1731717&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
Private: No
Submitted By: dsagal (dsagal)
>Assigned to: Peter Åstrand (astrand)
Summary: race condition in subprocess module
Initial Comment:
Python's subprocess module has a race condition: Popen() constructor has a call
to global "_cleanup()" function on whenever a Popen object gets created, and
that call causes a check for all pending Popen objects whether their subprocess
has exited - i.e. the poll() method is called for every active Popen object.
Now, if I create Popen object "foo" in one thread, and then a.wait(), and
meanwhile I create another Popen object "bar" in another thread, then a.poll()
might get called by _clean() right at the time when my first thread is running
a.wait(). But those are not synchronized - each calls os.waitpid() if
returncode is None, but the section which checks returncode and calls
os.waitpid() is not protected as a critical section should be.
The following code illustrates the problem, and is known to break reasonably
consistenly with Python2.4. Changes to subprocess in Python2.5 seems to address
a somewhat related problem, but not this one.
import sys, os, threading, subprocess, time
class X(threading.Thread):
def __init__(self, *args, **kwargs):
super(X, self).__init__(*args, **kwargs)
self.start()
def tt():
s = subprocess.Popen(("/bin/ls", "-a", "/tmp"), stdout=subprocess.PIPE,
universal_newlines=True)
# time.sleep(1)
s.communicate()[0]
for i in xrange(1000):
X(target = tt)
This typically gives a few dozen errors like these:
Exception in thread Thread-795:
Traceback (most recent call last):
File "/usr/lib/python2.4/threading.py", line 442, in __bootstrap
self.run()
File "/usr/lib/python2.4/threading.py", line 422, in run
self.__target(*self.__args, **self.__kwargs)
File "z.py", line 21, in tt
s.communicate()[0]
File "/usr/lib/python2.4/subprocess.py", line 1083, in communicate
self.wait()
File "/usr/lib/python2.4/subprocess.py", line 1007, in wait
pid, sts = os.waitpid(self.pid, 0)
OSError: [Errno 10] No child processes
Note that uncommenting time.sleep(1) fixes the problem. So does wrapping
subprocess.poll() and wait() with a lock. So does removing the call to global
_cleanup() in Popen constructor.
--
>Comment By: Neal Norwitz (nnorwitz)
Date: 2007-06-06 22:26
Message:
Logged In: YES
user_id=33168
Originator: NO
Peter, could you take a look at this? Thanks.
--
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1731717&group_id=5470
___
Python-bugs-list mailing list
Unsubscribe:
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[ python-Bugs-1732160 ] Unable to Start IDLE
Bugs item #1732160, was opened at 2007-06-06 09:00 Message generated for change (Comment added) made by nnorwitz You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1732160&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: IDLE Group: Python 2.5 Status: Open Resolution: None Priority: 5 Private: No Submitted By: Kishore (kishore_durai) Assigned to: Nobody/Anonymous (nobody) Summary: Unable to Start IDLE Initial Comment: HI, I am not unable to start Python IDLE from Start menu.. THe hour glass appears once i clikc the icon and vanishes quickly. Can anyone tell me how to fix this problem. Thanks. -- >Comment By: Neal Norwitz (nnorwitz) Date: 2007-06-06 22:32 Message: Logged In: YES user_id=33168 Originator: NO Do you have any sort of firewall/anti-virus software installed? That can conflict with IDLE because it tries to open a port. You can try going to the software and allowing IDLE to access this port. You can also try to open a terminal window and start IDLE manually and see if that works or if that produces an error message. -- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1732160&group_id=5470 ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[ python-Bugs-1732160 ] Unable to Start IDLE
Bugs item #1732160, was opened at 2007-06-06 21:00 Message generated for change (Comment added) made by kishore_durai You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1732160&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: IDLE Group: Python 2.5 Status: Open Resolution: None Priority: 5 Private: No Submitted By: Kishore (kishore_durai) Assigned to: Nobody/Anonymous (nobody) Summary: Unable to Start IDLE Initial Comment: HI, I am not unable to start Python IDLE from Start menu.. THe hour glass appears once i clikc the icon and vanishes quickly. Can anyone tell me how to fix this problem. Thanks. -- >Comment By: Kishore (kishore_durai) Date: 2007-06-07 10:39 Message: Logged In: YES user_id=1810028 Originator: YES Hi..i checked my firewall also..tried opening it by disabling the firewall..Doesnt seem to help.How to let IDLE access thge port.Can someone give me more details. Terminal window in the sense starting IDLE from command ? I tried that too but didnt seem to help..Pls help. THanks. -- Comment By: Neal Norwitz (nnorwitz) Date: 2007-06-07 10:32 Message: Logged In: YES user_id=33168 Originator: NO Do you have any sort of firewall/anti-virus software installed? That can conflict with IDLE because it tries to open a port. You can try going to the software and allowing IDLE to access this port. You can also try to open a terminal window and start IDLE manually and see if that works or if that produces an error message. -- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1732160&group_id=5470 ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[ python-Bugs-1732160 ] Unable to Start IDLE
Bugs item #1732160, was opened at 2007-06-06 09:00 Message generated for change (Comment added) made by nnorwitz You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1732160&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: IDLE Group: Python 2.5 Status: Open Resolution: None Priority: 5 Private: No Submitted By: Kishore (kishore_durai) Assigned to: Nobody/Anonymous (nobody) Summary: Unable to Start IDLE Initial Comment: HI, I am not unable to start Python IDLE from Start menu.. THe hour glass appears once i clikc the icon and vanishes quickly. Can anyone tell me how to fix this problem. Thanks. -- >Comment By: Neal Norwitz (nnorwitz) Date: 2007-06-06 23:10 Message: Logged In: YES user_id=33168 Originator: NO It looks like you can only change the port by changing code. (idlelib\PyShell.py) The port it uses is 8833. Try starting IDLE without a subprocess (and port IIRC): python.exe idle.py -n (ie, add -n option to the command line. You could probably find the answer by googling for something like "python idle startup port". -- Comment By: Kishore (kishore_durai) Date: 2007-06-06 22:39 Message: Logged In: YES user_id=1810028 Originator: YES Hi..i checked my firewall also..tried opening it by disabling the firewall..Doesnt seem to help.How to let IDLE access thge port.Can someone give me more details. Terminal window in the sense starting IDLE from command ? I tried that too but didnt seem to help..Pls help. THanks. -- Comment By: Neal Norwitz (nnorwitz) Date: 2007-06-06 22:32 Message: Logged In: YES user_id=33168 Originator: NO Do you have any sort of firewall/anti-virus software installed? That can conflict with IDLE because it tries to open a port. You can try going to the software and allowing IDLE to access this port. You can also try to open a terminal window and start IDLE manually and see if that works or if that produces an error message. -- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1732160&group_id=5470 ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[ python-Bugs-1732160 ] Unable to Start IDLE
Bugs item #1732160, was opened at 2007-06-06 09:00 Message generated for change (Comment added) made by nnorwitz You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1732160&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: IDLE Group: Python 2.5 >Status: Closed >Resolution: Invalid Priority: 5 Private: No Submitted By: Kishore (kishore_durai) Assigned to: Nobody/Anonymous (nobody) Summary: Unable to Start IDLE Initial Comment: HI, I am not unable to start Python IDLE from Start menu.. THe hour glass appears once i clikc the icon and vanishes quickly. Can anyone tell me how to fix this problem. Thanks. -- >Comment By: Neal Norwitz (nnorwitz) Date: 2007-06-06 23:11 Message: Logged In: YES user_id=33168 Originator: NO BTW, for questions like these, it's better to ask on the Usenet group comp.lang.python. You can also reach it via [EMAIL PROTECTED] Also #python on IRC (freenode.net) are good ways of asking for help for questions like these that aren't really bugs. -- Comment By: Neal Norwitz (nnorwitz) Date: 2007-06-06 23:10 Message: Logged In: YES user_id=33168 Originator: NO It looks like you can only change the port by changing code. (idlelib\PyShell.py) The port it uses is 8833. Try starting IDLE without a subprocess (and port IIRC): python.exe idle.py -n (ie, add -n option to the command line. You could probably find the answer by googling for something like "python idle startup port". -- Comment By: Kishore (kishore_durai) Date: 2007-06-06 22:39 Message: Logged In: YES user_id=1810028 Originator: YES Hi..i checked my firewall also..tried opening it by disabling the firewall..Doesnt seem to help.How to let IDLE access thge port.Can someone give me more details. Terminal window in the sense starting IDLE from command ? I tried that too but didnt seem to help..Pls help. THanks. -- Comment By: Neal Norwitz (nnorwitz) Date: 2007-06-06 22:32 Message: Logged In: YES user_id=33168 Originator: NO Do you have any sort of firewall/anti-virus software installed? That can conflict with IDLE because it tries to open a port. You can try going to the software and allowing IDLE to access this port. You can also try to open a terminal window and start IDLE manually and see if that works or if that produces an error message. -- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1732160&group_id=5470 ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
