Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

#2 readtlb and GUID changes

closed-fixed
Thomas Heller
None
5
2003-05-08
2003-05-07
Shane Holloway
No

ctypes.com.tools.readtlb
--------------------------------------
Changed records and enums to lists from dictionaries
since they are generally not associated with unique GUIDs.
Prevented guids being converted to strings since there
is a nice GUID class.
Added somre more documentation related output to the
generated python source.

ctypes.com.__init__.GUID
----------------------------------------
__hash__ # added to support readtlb uses
__copy__ # added to support readtlb
__nonzero__ # changed

Discussion

  • Shane Holloway
    Shane Holloway
    2003-05-07

    GUID and readtlb changes

     
  • Shane Holloway
    Shane Holloway
    2003-05-07

    • assigned_to: nobody --> theller
     
  • Thomas Heller
    Thomas Heller
    2003-05-08

    Logged In: YES
    user_id=11105

    Shane, thanks for the patch.

    Discussion:
    I didn't add __hash__ to the GUID class because instances
    are mutable, and the hash value would then possibly change
    over time. No issue for readtlb, but anywhere else. So
    converting to a string seemed logical to me.

    Using int.__or__ looks somewhat uncommon to me, shouldn't
    operator.__or__ be used instead?

     
  • Shane Holloway
    Shane Holloway
    2003-05-08

    Logged In: YES
    user_id=283742

    You are very welcome. You have created a great tool for all
    of us!

    I added the __hash__ because the guids were being added to a
    dictionary, and it kept complaining about the type not being
    hashable. I liked the idea of using your GUID class for
    readtlb since one could use the already implemented
    comparisons... Maybe the answer is to make the GUID class
    immutable? Is there a use case that depends upon the
    mutability?

    The int.__or__ method was used because I knew the types of
    all the involved operands... but feel free to change it you
    prefer. :)

     
  • Thomas Heller
    Thomas Heller
    2003-05-08

    Logged In: YES
    user_id=11105

    Shane, the __hash__ issue and dictionaries goes very deep.
    In short it is my understading that you cannot (or should
    not) store mutable objects in a dictionary. As I said, this
    is probably no issue for the readtlb utility, but generally
    it is a problem. And I cannot make ctypes' instances
    immutable, at least when passing them to dll functions they
    can be mutated. If you are interested in this, I'll be happy
    to discuss this on the ctypes-users list.

    I've incorporated and commited your changes wrt records and
    enums, this is a very valuable patch.

    I have not yet included your documentation changes and the
    typelib base class, if you still need it please submit a new
    patch against the CVS version.

    Besides this, any comments about the COM stuff?

     
  • Shane Holloway
    Shane Holloway
    2003-05-08

    Logged In: YES
    user_id=283742

    Fair enough :) It sounds like these things have been well
    thought through. It's too bad that it has to effect the
    usability in python. But if it keeps me from writing C, so
    be it! Shall we call this closed then?

    COM stuff looks very very good. I'll answer more
    extensively in a real email.

     
  • Thomas Heller
    Thomas Heller
    2003-05-08

    Logged In: YES
    user_id=11105

    Sure. And thanks again, keep the patches coming.

     
  • Thomas Heller
    Thomas Heller
    2003-05-08

    • status: open --> closed-fixed