Merge branch 'pybind:master' into master

This commit is contained in:
Steve R. Sun 2022-05-28 10:30:29 +08:00 committed by GitHub
commit d9ece32920
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 1 deletions

View File

@ -100,7 +100,7 @@ private:
if (size > remainder) {
str line(pbase(), size - remainder);
pywrite(line);
pywrite(std::move(line));
pyflush();
}

View File

@ -1581,6 +1581,8 @@ public:
capsule(const void *value, void (*destructor)(void *)) {
m_ptr = PyCapsule_New(const_cast<void *>(value), nullptr, [](PyObject *o) {
// guard if destructor called while err indicator is set
error_scope error_guard;
auto destructor = reinterpret_cast<void (*)(void *)>(PyCapsule_GetContext(o));
if (destructor == nullptr) {
if (PyErr_Occurred()) {