Menu

#183 Py 2.4 + MS Excel COM --> crash

closed-fixed
nobody
com (105)
5
2005-02-17
2004-12-14
sitecap
No

Any code that tries to dispatch an Excel (2003)
application ends up crashing Python 2.4.

(Used bForDemand=1 in makepy to generate MS Excel 11.0
Object Library, otherwise makepy itself crashes.)

Discussion

  • bard

    bard - 2004-12-16

    Logged In: YES
    user_id=49828

    I'm having a similar problem with Excel 2002 in Python 2.4.
    The script:

    #>

    from win32com.client import gencache
    gencache.EnsureModule('{00020813-0000-0000-C000-000000000046}',
    0, 1, 3, bForDemand=1)

    import win32com.client

    ExcelApp=win32com.client.Dispatch("Excel.Application")

    #<

    Causes a access violation in python

    AppName: python.exe AppVer: 0.0.0.0 ModName: ntdll.dll
    ModVer: 5.1.2600.1217 Offset: 00033905

     
  • Mark Hammond

    Mark Hammond - 2005-01-25

    Logged In: YES
    user_id=14198

    gencache.py (1.30)
    makepy.py (1.19)

    From that checkin message:

    Avoid crashes on Python 2.4 by defaulting to bForDemand=True
    - ie, each typelib actually creates a "skeleton" Python
    package, and populates the package as each interface is
    requested.

    Cause of the underling crash is that the generated .py
    causes an overflow as the byte-code is generated - something
    in 2.4 bloated the byte-code for these modules.

     
  • Mark Hammond

    Mark Hammond - 2005-01-25
    • status: open --> closed-fixed
     
  • Roger Upole

    Roger Upole - 2005-01-26

    Logged In: YES
    user_id=771074

    Python still crashes when you invoke one of the methods
    whose generated code caused the original crash. Looks to be
    related to this bug in the tokenizer:
    www.python.org/sf/1089395
    It hits an assertion failure on lines longer than 512.
    For a workaround, remove the mbcs encoding tag in genpy.py
    and makepy works correctly even with bForDemand=0.

     
  • Mark Hammond

    Mark Hammond - 2005-01-26

    Logged In: YES
    user_id=14198

    Thanks Roger - I'll dig a little deeper on this.

     
  • Mark Hammond

    Mark Hammond - 2005-01-26
    • status: closed-fixed --> open
     
  • Brian Dorsey

    Brian Dorsey - 2005-02-17

    Logged In: YES
    user_id=292730

    Just wanted to note than I also see this crash, and that
    commenting out the mbcs encoding line in genpy.py seems to
    allow it work for me as well.

     
  • Mark Hammond

    Mark Hammond - 2005-02-17

    Logged In: YES
    user_id=14198

    This has been fixed in CVS by avoiding the generation of
    huge lines.

     
  • Mark Hammond

    Mark Hammond - 2005-02-17
    • status: open --> closed-fixed