mirror of
https://github.com/boostorg/python.git
synced 2026-01-25 06:22:15 +00:00
Prevent dangling reference returns
[SVN r13163]
This commit is contained in:
@@ -66,6 +66,13 @@ namespace detail
|
||||
, lvalue_from_python_registration*const& converters)
|
||||
{
|
||||
ref holder(source);
|
||||
if (source->ob_refcnt <= 2)
|
||||
{
|
||||
PyErr_SetString(
|
||||
PyExc_ReferenceError
|
||||
, const_cast<char*>("Attempt to return dangling internal reference"));
|
||||
throw error_already_set();
|
||||
}
|
||||
void* result = find(source, converters);
|
||||
if (!result)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user