Issue #18 resolved

pygame.sprite.DirtySprite.__repr__: Invalid reference to 'self.__g'

illume
created an issue

== Håkan Johansson, 2008-06-30 02:52:10 -0700

{{{ When looking at the code I noticed that the 'repr' method of the 'DirtySprite' class uses the 'self.__g' attribute. The problem is that this attribute does not exist for the 'DirtySprite' class. It is a member of the 'Sprite' class but is not easily accessed by subclasses.

It is very easy to reproduce the error. Just start Python (any recent version will do):

import pygame sp = pygame.sprite.DirtySprite() repr(sp) Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/opt/local/lib/python2.5/site-packages/pygame/sprite.py", line 213, in repr return "<%s DirtySprite(in %d groups)>" % (self.class.name, len(self.g)) AttributeError: 'DirtySprite' object has no attribute '_DirtySpriteg'

A simple fix is to replace 'len(self.__g)' with 'len(self.groups())'. }}}


== Thorbrian, 2008-07-01 01:43:42 -0700

{{{ committed 1441, thanks Hakan! }}}


Comments (0)

  1. Log in to comment