[Patches] [ python-Patches-997284 ] Allow pydoc to work with XP Themes (.manifest file)

SourceForge.net noreply at sourceforge.net
Mon Aug 23 22:03:44 CEST 2004


Patches item #997284, was opened at 2004-07-25 00:52
Message generated for change (Comment added) made by loewis
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=997284&group_id=5470

Category: Library (Lib)
Group: Python 2.3
Status: Closed
Resolution: Accepted
Priority: 5
Submitted By: Greg Chapman (glchapman)
Assigned to: Nobody/Anonymous (nobody)
Summary: Allow pydoc to work with XP Themes (.manifest file)

Initial Comment:
In Python 2.3.4, if you run pydoc -g under Windows XP
when one of the special XP theme manifest files has
been defined for python.exe or pythonw.exe, pydoc will
cause an access violation when it closes.  One solution
is obviously to get rid of the manifest files, but
wxPython installs them by default and apps written with
it work without a problem.  So it would be nice if
pydoc would also work, and it turns out it didn't take
a big change.  Attached is a patch which fixes the
problem (at least on my system).  I noticed that idle
did not have the access violation problem, and so
copied what it does in PyShell.main.

It might be better to introduce a more general fix for
Tkinter.  The problem seems to be that Uxtheme.dll
frees up some global data before all the windows have
called CloseThemeData (at app shutdown).  The AV seems
to happen when a call to CloseThemeData (presumably in
response to a WM_DESTROY message) passes a bad pointer
to RtlEnterCriticalSection.  Anyway, it seems that if
you get the window handles destroyed earlier in
shutdown, the problem is fixed.  Perhaps there is some
way to provide the Tkinter module with an atexit
handler which would destroy any existing widgets?


----------------------------------------------------------------------

>Comment By: Martin v. Löwis (loewis)
Date: 2004-08-23 22:03

Message:
Logged In: YES 
user_id=21627

I'd still woud prefer if a "proper" patch would be found,
i.e. one that doesn't cause a crash in response to
WM_DESTROY. For that, one would have to understand why it
crashes, and see whether it is Tk's fault - if so, Tk should
be fixed. If it really is presumed to be a Windows
bug/limitation, I'd like to see the KB article that
acknowledges the problem, and apply the work-around
suggested in the KB.

----------------------------------------------------------------------

Comment By: Greg Chapman (glchapman)
Date: 2004-08-23 15:27

Message:
Logged In: YES 
user_id=86307

I admit the cause is obscure, but I think the problem will
potentially affect most Tkinter programs (see for example,
www.python.org/sf/774188 -- which links to a wiki article
referring to crashes in Tkinter with manifest files
present).  I just tried pynche.pyw, redemo.py, wcgui.py, and
wsgui.py (from the Tools branch) and they all crashed on
exit (at the same location in kernel32, with the same
attempt to read 0x00000028).  This is with Python 2.3.4
under XP (I don't have access to an XP SP2 machine right
now: I wonder if this has been fixed).

Anyway, I added the following to Tkinter, and the crashes
went away (I don't usually use Tkinter, so this may not be
the best way to accomplish this):

import atexit

def _tkAtExit():
    if _default_root is not None:
        _default_root.destroy()

atexit.register(_tkAtExit)


----------------------------------------------------------------------

Comment By: Martin v. Löwis (loewis)
Date: 2004-08-22 18:15

Message:
Logged In: YES 
user_id=21627

This is quite an obscure problem, so I added a comment an
committed it as pydoc.py 1.86.8.3 and 1.97, NEWS 1.831.4.144.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=997284&group_id=5470


More information about the Patches mailing list