Mark (and anyone else who is In The Know),
I have been getting repeated crashes of Pythonwin trying to show very long
strings. I am using ActivePython 2.1 (210) on Windows 2000.
My conclusion is that you have a display buffer of length 4000 that is
overflowing.
My investigations
-----------------
At first I thought it was only Unicode strings -- if you try this:
>>> import win32com.client
>>> xd = win32com.client.Dispatch('Microsoft.XMLDOM')
>>> xd.async = 0
>>> xd.load('C:/Temp/big.xml')
>>> print xd.xml
everything is fine. But if you simply type
>>> xd.xml
some output is shown but then Pythonwin crashes into Dr Watson. Some
earlier crashes indicated a Unicode problem, but when I did this:
>>> sxml = string(xd.xml)
>>> sxml
I also got a crash. A crash also with:
>>> s = open('C:/Temp/a-7kb-text-file.txt', 'r').read()
>>> s
A 3KB file was OK. So I tried this:
>>> s = 'x'
>>> for i in xrange(3000):
>>> s += 'x'
>>>
>>> s
OK so far. Now this:
>>> for i in xrange(100):
>>> s += 'xxxxxxxxxx'
>>> len(s)
>>> s
>>>
It crashed around 4000 chars in length: in fact, a length of 3997 is OK but
3998 is too long. (Buffer of length 40000 includes "'" at the beginning and
end, and a terminating '\0'.)
A Unicode string is OK at length 3996 but crashes at 3997. (It uses one
more character to display the "u".)
Actually, print s doesn't work either when there are no newlines. So I
tried this:
>>> s = ''
>>> for i in xrange(399):
>>> s += '123456789\n'
>>>
len(s) returns 3990 and print s works fine but s causes a crash, presumably
because the displayed length is longer than 3998.
Two notes
---------
- I am sure I showed very long strings with Pythonwin build 202 or 203
without suffering crashes.
- I do not get crashes when I run "Python Interpreter Shell"
(python.exe).
Do I need to submit a formal bug to ActiveState?
--
Michael Strasser
Brisbane, Australia
_______________________________________________
ActivePython mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/activepython