Skip to content

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

Description

@tturocy

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.

Metadata

Metadata

Assignees

Labels

bugcythonItems which involve coding in Cython

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions