We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 589a3db commit 5c61667Copy full SHA for 5c61667
1 file changed
src/pygambit/game.pxi
@@ -307,10 +307,10 @@ class GamePlayers:
307
raise ValueError(f"Game has multiple players with label '{index}'")
308
return matches[0]
309
if isinstance(index, int):
310
- if index in range(self.game.deref().NumPlayers()):
+ try:
311
return Player.wrap(self.game.deref().GetPlayer(index + 1))
312
- else:
313
- raise IndexError("Index out of range")
+ except IndexError:
+ raise IndexError("Index out of range") from None
314
raise TypeError(f"Player index must be int or str, not {index.__class__.__name__}")
315
316
@property
0 commit comments