2
0
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:
Dave Abrahams
2002-03-10 06:38:50 +00:00
parent a56f66e721
commit be6016a972

View File

@@ -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)
{