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

BUG: Default constructor for Game is permitted, but leads to uninitialised object #463

Open
tturocy opened this issue Jul 16, 2024 · 0 comments
Labels
bug cython Items which involve coding in Cython
Milestone

Comments

@tturocy
Copy link
Member

tturocy commented Jul 16, 2024

It's not intended to be able to call the default constructor on Game. However, doing so does not lead to an immediate error, but a RuntimeError later:

In [1]: import pygambit as gbt

In [2]: g = gbt.Game()

In [3]: g
Out[3]: ---------------------------------------------------------------------------
RuntimeError                              Traceback (most recent call last)
File ~/git/gambit/src/pygambit/game.pxi:513, in pygambit.gambit.Game.title.__get__()
    511     to be short.
    512     """
--> 513     return self.game.deref().GetTitle().decode("ascii")
    514 
    515 @title.setter

RuntimeError: Dereferenced null pointer

Although we probably want to give some further consideration to how we construct games (and indeed whether possibly we want more than one class for games, based on their representation), the simplest fix is just to disallow this with a suitable exception.

This should be fixed in maint16_1 first and merged forward.

@tturocy tturocy added bug cython Items which involve coding in Cython labels Jul 16, 2024
@tturocy tturocy added this to the gambit-16.3.0 milestone Jul 16, 2024
@tturocy tturocy changed the title Default constructor for Game is permitted, but leads to uninitialised object BUG: Default constructor for Game is permitted, but leads to uninitialised object Jul 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug cython Items which involve coding in Cython
Projects
None yet
Development

No branches or pull requests

1 participant