Bugs item #1598678, was opened at 2006-11-17 19:20
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=551954&aid=1598678&group_id=78018
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: win32
Group: None
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Ross Ridge (ross_ridge)
Assigned to: Nobody/Anonymous (nobody)
Summary: PyConsoleScreenBuffer doesn't keep reference to handle
Initial Comment:
PyConsoleScreenBufferType doesn't keep a reference
to the PyHANDLE passed in when constructing an object.
If you run the following test case:
import win32con
import win32file
import win32console
h = win32file.CreateFile("CONIN$",
win32con.GENERIC_READ
| win32con.GENERIC_WRITE,
win32con.FILE_SHARE_READ
| win32con.FILE_SHARE_WRITE,
None, win32con.OPEN_EXISTING,
0, None)
c = win32console.PyConsoleScreenBufferType(h)
c.GetConsoleMode() # call 1
h = None
c.GetConsoleMode() # call 2
You get the following output:
Traceback (most recent call last):
File "test2.py", line 12, in ?
c.GetConsoleMode() # call 2
pywintypes.error: (6, 'GetConsoleMode', 'The handle is invalid.')
The handle is invalid because it was closed after the
previous line ("h = None") was executed despite the
fact that "c" should still be maintaining a
reference to the PyHANDLE object it's using.
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=551954&aid=1598678&group_id=78018
|