#332 Selecttlb doesn't handle hexadecimal version numbers

closed-fixed
Mark Hammond
pythonwin (176)
7
2007-08-25
2007-08-14
Johan Lindvall
No

It appears Selecttlb.py for pywin32 210 doesn't handle typelibs with
hexadecimal version numbers. After updating our app to version 10.0
(a.0), we cannot use makepy anymore

The attached patch fixed the problem.

Discussion

  • Johan Lindvall
    Johan Lindvall
    2007-08-14

    Selecttlb.py patch

     
    Attachments
  • Johan Lindvall
    Johan Lindvall
    2007-08-14

    • priority: 5 --> 7
    • assigned_to: nobody --> mhammond
     
  • Mark Hammond
    Mark Hammond
    2007-08-14

    Logged In: YES
    user_id=14198
    Originator: NO

    I'd love to find some documentation that states the tlb version numbers are hex! Are you sure that you aren't simply creating an invalid typelib for yourself? Office 10, for example, doesn't use hex to the best of my knowledge.

     
  • Johan Lindvall
    Johan Lindvall
    2007-08-14

    Logged In: YES
    user_id=1585378
    Originator: YES

    Not sure if there is a standard, but a simple version statement like the following actually produces a a.0:

    [
    uuid(...),
    version(10.0),
    helpstring(...)
    ]

    library OURLIB
    {
    ...

    By googling around a bit there seems to be several apps using this scheme (Corel Wordperfect 12)

    Why disallow it in the first place?

     
  • Mark Hammond
    Mark Hammond
    2007-08-14

    Logged In: YES
    user_id=14198
    Originator: NO

    Thanks for that - at least this confirms that (a) they *should* be hex, and (b) that even MS manages to get this wrong. I'd prefer to simply remove the int() calls alltogether, and then fix any code which still assumes integers. I've made that change locally, but I'm travelling, so unable to fully test this until I get home. I'd appreciate it if you could make a similar change (ie, remove the int() calls, and the try/except block completely) and see if anything else breaks for you.

     
  • Johan Lindvall
    Johan Lindvall
    2007-08-15

    Logged In: YES
    user_id=1585378
    Originator: YES

    Yes, at least interactive makepy from pythonwin works without the int calls (I even removed minor and major completely from selecttlb.py).

    The bug doesn't appear with most typelibs, since their version numbers aren't high enough. For me, this is the case with all the Microsoft Office typelibs.

    Note that the Microsoft office Typelib browser doesn't show the version numbers at all. It only shows the typelib "helpstring". Maybe you should remove the version number too?

     
  • Mark Hammond
    Mark Hammond
    2007-08-25

    • status: open --> closed-fixed
     
  • Mark Hammond
    Mark Hammond
    2007-08-25

    Logged In: YES
    user_id=14198
    Originator: NO

    Checking in selecttlb.py;
    new revision: 1.9; previous revision: 1.8