Skip to content

Commit e0aa141

Browse files
committed
Use default value for default_
1 parent 8a9b35d commit e0aa141

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

include/pybind11/pytypes.h

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1292,25 +1292,22 @@ class dict : public object {
12921292
return PyDict_Contains(m_ptr, detail::object_or_cast(std::forward<T>(key)).ptr()) == 1;
12931293
}
12941294

1295-
object get(handle key, handle default_) const {
1295+
object get(handle key, handle default_ = none()) const {
12961296
if (PyObject *result = PyDict_GetItem(m_ptr, key.ptr())) {
12971297
return reinterpret_borrow<object>(result);
12981298
} else {
12991299
return reinterpret_borrow<object>(default_);
13001300
}
13011301
}
13021302

1303-
object get(const char *key, handle default_) const {
1303+
object get(const char *key, handle default_ = none()) const {
13041304
if (PyObject *result = PyDict_GetItemString(m_ptr, key)) {
13051305
return reinterpret_borrow<object>(result);
13061306
} else {
13071307
return reinterpret_borrow<object>(default_);
13081308
}
13091309
}
13101310

1311-
object get(handle key) const { return get(key, none()); }
1312-
object get(const char *key) const { return get(key, none()); }
1313-
13141311
private:
13151312
/// Call the `dict` Python type -- always returns a new reference
13161313
static PyObject *raw_dict(PyObject *op) {

0 commit comments

Comments
 (0)