'access unexported function in R package and assign to python object

Up to version 3.4.0 (certainly before 3.5.0), I used to be able to do the following:

from rpy2.robjects.packages import importr
import rpy2.robjects as robjs

importr("PKGNAME")
someFUN = robjs.r("""rfname <- PKGNAME:::.unexportedFUN""")

But in the latest 3.5.0, calling the function someFUN in python leads the error below:

E   RecursionError: maximum recursion depth exceeded in comparison
!!! Recursion detected (same locals & position)

How should this be done in the latest rpy2? Thanks



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source