mirror of
https://github.com/pybind/pybind11.git
synced 2025-01-19 01:15:52 +00:00
store reintpreted_key
This commit is contained in:
parent
7f7b70b943
commit
19e033c481
@ -1377,11 +1377,12 @@ obj_attr_accessor object_api<D>::attr_with_type_hint(handle key) const {
|
||||
"https://en.cppreference.com/w/cpp/language/static#Static_data_members");
|
||||
#endif
|
||||
object ann = annotations();
|
||||
if (ann.contains(key)) {
|
||||
throw std::runtime_error("__annotations__[\"" + std::string(key) + "\"] was set already.");
|
||||
object reinterpreted_key = reinterpret_borrow<object>(key);
|
||||
if (ann.contains(reinterpreted_key)) {
|
||||
throw std::runtime_error("__annotations__[\"" + std::string(py::str(reinterpreted_key)) + "\"] was set already.");
|
||||
}
|
||||
ann[key] = make_caster<T>::name.text;
|
||||
return {derived(), reinterpret_borrow<object>(key)};
|
||||
return {derived(), reinterpreted_key};
|
||||
}
|
||||
|
||||
template <typename D>
|
||||
|
Loading…
Reference in New Issue
Block a user