[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[pygame] Bug in Font.size
- To: pygame-users@seul.org
- Subject: [pygame] Bug in Font.size
- From: Ludek Smid <qark@seznam.cz>
- Date: Tue, 03 Jun 2003 17:31:27 +0200
- Delivered-to: archiver@seul.org
- Delivered-to: pygame-users-outgoing@seul.org
- Delivered-to: pygame-users@seul.org
- Delivery-date: Tue, 03 Jun 2003 11:33:11 -0400
- Reply-to: pygame-users@seul.org
- Sender: owner-pygame-users@seul.org
- User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.4) Gecko/20030529
Hi,
after long debugging session I've finally found the problem causing
"can't resize shared unicode objects" exception in my small pygame
program (120 kB of the source code :-)). The problem is on the line 508
in the file font.c:
Py_DECREF(text);
it should be
Py_DECREF(strob);
The sample program demonstrating the bug:
import pygame
from pygame.locals import *
pygame.init()
screen = pygame.display.set_mode((800, 600), SWSURFACE, 32)
font = pygame.font.Font(None, 30)
text = u""
for i in xrange(0, 10):
text = u'%s%d' % (text, i)
textSize = font.size(text) # comment this to remove the bug
srfc = font.render(text, 1, (0xff, 0xff, 0xff), (0x00, 0x00, 0x00))
screen.blit(srfc, (0, 0))
pygame.display.update()
Tested on Python 2.2.3, Pygame 1.5.5D, Window 2000.
I hope it can be fixed soon :-)
Ludek