Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

subclassing the math.Vector2 class results in Fatal Error #552

MattR0se opened this issue Oct 9, 2018 · 2 comments


Copy link

commented Oct 9, 2018

When I make a subclass of pygame.math.Vector2 and do a scalar multiplication, it results in a crash and a Fatal Error

import pygame

class Vector(pygame.math.Vector2):

# this stuff works fine
vec_a = Vector(2, 0)
vec_b = Vector(0, 1)

print(vec_a + vec_b)

vec_c = vec_a.rotate(90)

# but this raises the Error
vec_a *= 2

The Error message I get is

Fatal Python error: (pygame parachute) Segmentation Fault

Reproducability: I only tried this on two Windows 7 PCs with python 3.6 and in Spyder. Pygame Version is 1.9.3

Also someone on reddit said they got the same error


This comment has been minimized.

Copy link

commented Oct 9, 2018

Thanks :) I guess the *= part is just using a hardcoded self, when it probably has to do a more complicated lookup because of the inheritance.

Would it be possible to submit a pull request with this as a unit test?

@illume illume added this to the 1.9.5 milestone Oct 9, 2018

sw00 added a commit to sw00/pygame that referenced this issue Oct 14, 2018

cmtrapp02 added a commit to cmtrapp02/pygame that referenced this issue Oct 15, 2018

Added math.Vector2 subclass test for issue pygame#552
Added new function that tests a subclassed math.Vector2 for issue pygame#552.
This is my first contribution on Github, so any feedback if necessary would be greatly appreciated!

illume added a commit that referenced this issue Oct 16, 2018

Merge pull request #560 from cmtrapp02/cmtrapp02-patch-1
Added math.Vector2 subclass test for issue #552

@illume illume closed this in c39ddee Oct 16, 2018


This comment has been minimized.

Copy link

commented Mar 18, 2019

When is this going to be fixed? I am having some related issues

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
3 participants
You can’t perform that action at this time.