I am unsure about creating a copy and returning it, but testing fails about half the time in 3.x if this part is removed. Through debugging I was able to detect that in the failing scenarios the ``ret`` pointer would be valid until this function returns. When dereferenced it immediately afterwards in the calling function, a segfault would occur. If anyone has any insight, please let me know.