@@ -1207,18 +1207,10 @@ absl::Nullable<PyObject*> PyDataBag_merge_inplace(PyObject* self,
12071207 Py_RETURN_NONE;
12081208}
12091209
1210- absl::Nullable<PyObject*> PyDataBag_adopt (PyObject* self,
1211- PyObject* const * py_args,
1212- Py_ssize_t nargs) {
1210+ absl::Nullable<PyObject*> PyDataBag_adopt (PyObject* self, PyObject* ds) {
12131211 arolla::python::DCheckPyGIL ();
1214- DataBagPtr db = UnsafeDataBagPtr (self);
1215- if (nargs != 1 ) {
1216- PyErr_Format (PyExc_ValueError,
1217- " DataBag.adopt accepts exactly 1 argument, got %d" , nargs);
1218- return nullptr ;
1219- }
1220-
1221- const DataSlice* slice = UnwrapDataSlice (py_args[0 ], " slice" );
1212+ const DataBagPtr& db = UnsafeDataBagPtr (self);
1213+ const DataSlice* slice = UnwrapDataSlice (ds, " slice" );
12221214 if (!slice) {
12231215 return nullptr ;
12241216 }
@@ -1231,18 +1223,10 @@ absl::Nullable<PyObject*> PyDataBag_adopt(PyObject* self,
12311223 return WrapPyDataSlice (slice->WithBag (std::move (db)));
12321224}
12331225
1234- absl::Nullable<PyObject*> PyDataBag_adopt_stub (PyObject* self,
1235- PyObject* const * py_args,
1236- Py_ssize_t nargs) {
1226+ absl::Nullable<PyObject*> PyDataBag_adopt_stub (PyObject* self, PyObject* ds) {
12371227 arolla::python::DCheckPyGIL ();
1238- DataBagPtr db = UnsafeDataBagPtr (self);
1239- if (nargs != 1 ) {
1240- PyErr_Format (PyExc_ValueError,
1241- " DataBag.adopt_stub accepts exactly 1 argument, got %d" ,
1242- nargs);
1243- return nullptr ;
1244- }
1245- const DataSlice* slice = UnwrapDataSlice (py_args[0 ], " slice" );
1228+ const DataBagPtr& db = UnsafeDataBagPtr (self);
1229+ const DataSlice* slice = UnwrapDataSlice (ds, " slice" );
12461230 if (!slice) {
12471231 return nullptr ;
12481232 }
@@ -1663,7 +1647,7 @@ have different ids.
16631647 " *bags)\n "
16641648 " --\n\n "
16651649 " DataBag._merge_inplace" },
1666- {" adopt" , (PyCFunction)PyDataBag_adopt, METH_FASTCALL ,
1650+ {" adopt" , (PyCFunction)PyDataBag_adopt, METH_O ,
16671651 " adopt(slice, /)\n "
16681652 " --\n\n "
16691653 R"""( Adopts all data reachable from the given slice into this DataBag.
@@ -1674,7 +1658,7 @@ have different ids.
16741658Returns:
16751659 The DataSlice with this DataBag (including adopted data) attached.
16761660)""" },
1677- {" adopt_stub" , (PyCFunction)PyDataBag_adopt_stub, METH_FASTCALL ,
1661+ {" adopt_stub" , (PyCFunction)PyDataBag_adopt_stub, METH_O ,
16781662 " adopt_stub(slice, /)\n "
16791663 " --\n\n "
16801664 R"""( Copies the given DataSlice's schema stub into this DataBag.
0 commit comments