Menu

#5 Errors handling static and class methods

v1.1
closed-fixed
inspection (59)
5
2002-11-02
2002-10-31
No

The UID module chokes on static and class methods such
as __new__, because it doesn't realize they're methods.
Instead of just checking '_MethodType', make_uid
should check for the staticmethod and classmethod types
as well.

To support pre-2.2 versions, the list of types to check
should be encapsulated external to the make_uid
function, or else dummy 'staticmethod' and
'classmethod' variables could be created for older
versions.

Discussion

  • Edward Loper

    Edward Loper - 2002-11-02

    Logged In: YES
    user_id=195958

    This should now be fixed in the development (CVS)
    version of the code. If you get a chance, I'd appreciate it
    if you could chech out the CVS code, and test it on your
    Python scripts, to make sure that it's giving the desired
    behavior.

    My fix ended up being somewhat different than you
    suggest. Basically, I changed the ClassDoc code to use
    dir() and getattr(...), rather than accessing fields through
    __dict__. This also solves a problem where __dict__
    does not include methods inherited from builtin types,
    because dir() *does* list them, and getattr(...) returns
    them.

    The HTML output currently lists all methods in a single
    list for "method summary," and breaks it out into 3
    separate details lists: method details; class method
    details; and instance method details. (If a details list is
    empty, then it is omitted). I would appreciate feedback
    on whether you think this is an appropriate way to
    present the methods to the user.

     
  • Edward Loper

    Edward Loper - 2002-11-02
    • status: open --> closed-fixed
     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.