See a83c89b#commitcomment-9978862
My inclination is to back out the compatibility code for now and simply not have this API on 5.1, until lua-compat-5.2/issues#22 is fixed (documentation for how to do this) and we can easily add it back properly.
If someone else would like to provide a patch according to the instructions in the comment above, that would also be most welcome.