Skip to content

Commit

Permalink
Remove all smart_holder.h includes and PYBIND11_SMART_HOLDER_TYPE_CAS…
Browse files Browse the repository at this point in the history
…TERS macros.

The include and the PYBIND11_SMART_HOLDER_TYPE_CASTERS were made obsolete by pybind/pybind11#5257 (merged on Jul 31, 2024).
  • Loading branch information
rwgk committed Mar 6, 2025
1 parent 6d024a3 commit b44ccec
Show file tree
Hide file tree
Showing 16 changed files with 0 additions and 58 deletions.
1 change: 0 additions & 1 deletion open_spiel/python/pybind11/bots.cc
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
#include "pybind11/include/pybind11/detail/common.h"
#include "pybind11/include/pybind11/pybind11.h"
#include "pybind11/include/pybind11/pytypes.h"
#include "pybind11/include/pybind11/smart_holder.h"

// Optional headers.
#if OPEN_SPIEL_BUILD_WITH_ROSHAMBO
Expand Down
2 changes: 0 additions & 2 deletions open_spiel/python/pybind11/games_backgammon.cc
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@ using open_spiel::State;
using open_spiel::backgammon::BackgammonState;
using open_spiel::backgammon::CheckerMove;

PYBIND11_SMART_HOLDER_TYPE_CASTERS(BackgammonState);

void open_spiel::init_pyspiel_games_backgammon(py::module& m) {
py::class_<CheckerMove>(m, "CheckerMove")
.def_readwrite("pos", &CheckerMove::pos)
Expand Down
3 changes: 0 additions & 3 deletions open_spiel/python/pybind11/games_bargaining.cc
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,6 @@ using open_spiel::bargaining::BargainingState;
using open_spiel::bargaining::Instance;
using open_spiel::bargaining::Offer;

PYBIND11_SMART_HOLDER_TYPE_CASTERS(BargainingGame);
PYBIND11_SMART_HOLDER_TYPE_CASTERS(BargainingState);

void open_spiel::init_pyspiel_games_bargaining(py::module& m) {
py::class_<Instance>(m, "Instance")
.def(py::init<>())
Expand Down
3 changes: 0 additions & 3 deletions open_spiel/python/pybind11/games_bridge.cc
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,6 @@
#include "open_spiel/python/pybind11/pybind11.h"
#include "open_spiel/spiel.h"

PYBIND11_SMART_HOLDER_TYPE_CASTERS(open_spiel::bridge::BridgeGame);
PYBIND11_SMART_HOLDER_TYPE_CASTERS(open_spiel::bridge::BridgeState);

namespace open_spiel {

namespace py = ::pybind11;
Expand Down
5 changes: 0 additions & 5 deletions open_spiel/python/pybind11/games_chess.cc
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
#include "open_spiel/spiel.h"
#include "pybind11/include/pybind11/cast.h"
#include "pybind11/include/pybind11/pybind11.h"
#include "pybind11/include/pybind11/smart_holder.h"

namespace py = ::pybind11;
using open_spiel::Game;
Expand All @@ -38,10 +37,6 @@ using open_spiel::chess::Piece;
using open_spiel::chess::PieceType;
using open_spiel::chess::Move;

PYBIND11_SMART_HOLDER_TYPE_CASTERS(ChessGame);
PYBIND11_SMART_HOLDER_TYPE_CASTERS(ChessState);
PYBIND11_SMART_HOLDER_TYPE_CASTERS(ChessBoard);

void open_spiel::init_pyspiel_games_chess(py::module& m) {
py::module_ chess = m.def_submodule("chess");

Expand Down
3 changes: 0 additions & 3 deletions open_spiel/python/pybind11/games_colored_trails.cc
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,6 @@ using open_spiel::colored_trails::kDefaultNumColors;
using open_spiel::colored_trails::kNumChipsLowerBound;
using open_spiel::colored_trails::kNumChipsUpperBound;

PYBIND11_SMART_HOLDER_TYPE_CASTERS(ColoredTrailsGame);
PYBIND11_SMART_HOLDER_TYPE_CASTERS(ColoredTrailsState);

void open_spiel::init_pyspiel_games_colored_trails(py::module& m) {
m.attr("NUM_COLORS") = py::int_(kDefaultNumColors);
m.attr("NUM_CHIPS_LOWER_BOUND") = py::int_(kNumChipsLowerBound);
Expand Down
3 changes: 0 additions & 3 deletions open_spiel/python/pybind11/games_dots_and_boxes.cc
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@

#include "open_spiel/games/dots_and_boxes/dots_and_boxes.h"
#include "open_spiel/spiel.h"
#include "pybind11/include/pybind11/smart_holder.h"
#include "pybind11/include/pybind11/pybind11.h"


Expand All @@ -29,8 +28,6 @@ using open_spiel::Game;
using open_spiel::State;
using open_spiel::dots_and_boxes::DotsAndBoxesState;

PYBIND11_SMART_HOLDER_TYPE_CASTERS(DotsAndBoxesState);

void open_spiel::init_pyspiel_games_dots_and_boxes(py::module& m) {
py::classh<DotsAndBoxesState, State>(m, "DotsAndBoxesState")
.def("dbn_string", &DotsAndBoxesState::DbnString)
Expand Down
3 changes: 0 additions & 3 deletions open_spiel/python/pybind11/games_euchre.cc
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,6 @@
#include "pybind11/include/pybind11/detail/common.h"
#include "pybind11_abseil/absl_casters.h"

PYBIND11_SMART_HOLDER_TYPE_CASTERS(open_spiel::euchre::EuchreGame);
PYBIND11_SMART_HOLDER_TYPE_CASTERS(open_spiel::euchre::EuchreState);

namespace open_spiel {

namespace py = ::pybind11;
Expand Down
3 changes: 0 additions & 3 deletions open_spiel/python/pybind11/games_gin_rummy.cc
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,6 @@
#include "pybind11/include/pybind11/detail/common.h"
#include "pybind11_abseil/absl_casters.h"

PYBIND11_SMART_HOLDER_TYPE_CASTERS(open_spiel::gin_rummy::GinRummyGame);
PYBIND11_SMART_HOLDER_TYPE_CASTERS(open_spiel::gin_rummy::GinRummyState);

namespace open_spiel {

namespace py = ::pybind11;
Expand Down
2 changes: 0 additions & 2 deletions open_spiel/python/pybind11/games_leduc_poker.cc
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@ using open_spiel::State;
using open_spiel::leduc_poker::LeducState;
using open_spiel::leduc_poker::ActionType;

PYBIND11_SMART_HOLDER_TYPE_CASTERS(LeducState);

void open_spiel::init_pyspiel_games_leduc_poker(py::module& m) {
py::module_ leduc_poker = m.def_submodule("leduc_poker");

Expand Down
2 changes: 0 additions & 2 deletions open_spiel/python/pybind11/games_negotiation.cc
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@ using open_spiel::Game;
using open_spiel::State;
using open_spiel::negotiation::NegotiationState;

PYBIND11_SMART_HOLDER_TYPE_CASTERS(NegotiationState);

void open_spiel::init_pyspiel_games_negotiation(py::module& m) {
py::classh<NegotiationState, State>(m, "NegotiationState")
.def("item_pool",
Expand Down
3 changes: 0 additions & 3 deletions open_spiel/python/pybind11/games_spades.cc
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,6 @@
#include "open_spiel/spiel.h"
#include "open_spiel/spiel_utils.h"

PYBIND11_SMART_HOLDER_TYPE_CASTERS(open_spiel::spades::SpadesGame);
PYBIND11_SMART_HOLDER_TYPE_CASTERS(open_spiel::spades::SpadesState);

namespace open_spiel {

namespace py = ::pybind11;
Expand Down
2 changes: 0 additions & 2 deletions open_spiel/python/pybind11/games_tarok.cc
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@
#include "open_spiel/games/tarok/tarok.h"
#include "open_spiel/python/pybind11/pybind11.h"

PYBIND11_SMART_HOLDER_TYPE_CASTERS(open_spiel::tarok::TarokState);

namespace open_spiel {

namespace py = ::pybind11;
Expand Down
3 changes: 0 additions & 3 deletions open_spiel/python/pybind11/games_tiny_bridge.cc
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,6 @@ using open_spiel::State;
using open_spiel::tiny_bridge::TinyBridgeAuctionState;
using open_spiel::tiny_bridge::TinyBridgePlayState;

PYBIND11_SMART_HOLDER_TYPE_CASTERS(TinyBridgePlayState);
PYBIND11_SMART_HOLDER_TYPE_CASTERS(TinyBridgeAuctionState);

void open_spiel::init_pyspiel_games_tiny_bridge(py::module& m) {
py::classh<TinyBridgePlayState, State>(m, "TinyBridgePlayState")
// Pickle support
Expand Down
1 change: 0 additions & 1 deletion open_spiel/python/pybind11/games_trade_comm.cc
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ using open_spiel::Game;
using open_spiel::State;
using open_spiel::trade_comm::TradeCommState;

PYBIND11_SMART_HOLDER_TYPE_CASTERS(TradeCommState);
void open_spiel::init_pyspiel_games_trade_comm(py::module& m) {
py::classh<TradeCommState, State>(m, "TradeCommState")
// Pickle support
Expand Down
19 changes: 0 additions & 19 deletions open_spiel/python/pybind11/pybind11.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,8 @@
#include "pybind11/include/pybind11/functional.h" // IWYU pragma: keep
#include "pybind11/include/pybind11/numpy.h" // IWYU pragma: keep
#include "pybind11/include/pybind11/pybind11.h"
#include "pybind11/include/pybind11/smart_holder.h" // IWYU pragma: keep
#include "pybind11/include/pybind11/stl.h" // IWYU pragma: keep

// Runtime errors happen if we're inconsistent about whether or not a type has
// PYBIND11_SMART_HOLDER_TYPE_CASTERS applied to it or not. So we do it mostly
// in one place to help with consistency.

namespace open_spiel {

class Policy;
Expand All @@ -67,20 +62,6 @@ class ISMCTSBot;

} // namespace open_spiel

PYBIND11_SMART_HOLDER_TYPE_CASTERS(open_spiel::State);
PYBIND11_SMART_HOLDER_TYPE_CASTERS(open_spiel::Game);
PYBIND11_SMART_HOLDER_TYPE_CASTERS(open_spiel::Policy);
PYBIND11_SMART_HOLDER_TYPE_CASTERS(open_spiel::TabularPolicy);
PYBIND11_SMART_HOLDER_TYPE_CASTERS(open_spiel::PartialTabularPolicy);
PYBIND11_SMART_HOLDER_TYPE_CASTERS(open_spiel::UniformPolicy);
PYBIND11_SMART_HOLDER_TYPE_CASTERS(open_spiel::PreferredActionPolicy);
PYBIND11_SMART_HOLDER_TYPE_CASTERS(open_spiel::NormalFormGame);
PYBIND11_SMART_HOLDER_TYPE_CASTERS(open_spiel::matrix_game::MatrixGame);
PYBIND11_SMART_HOLDER_TYPE_CASTERS(open_spiel::tensor_game::TensorGame);
PYBIND11_SMART_HOLDER_TYPE_CASTERS(open_spiel::Bot);
PYBIND11_SMART_HOLDER_TYPE_CASTERS(open_spiel::algorithms::MCTSBot);
PYBIND11_SMART_HOLDER_TYPE_CASTERS(open_spiel::algorithms::ISMCTSBot);

namespace open_spiel {
// Trampoline helper class to allow implementing Bots in Python. See
// https://pybind11.readthedocs.io/en/stable/advanced/classes.html#overriding-virtual-functions-in-python
Expand Down

0 comments on commit b44ccec

Please sign in to comment.