Just tested, and it still works fine on my machine.
Since it isn’t 100% clear from your code snippet quote, the import Foundation
is part of the script. Without it it won’t work. So the entire script is this:
import Foundation
LSSetDefaultRoleHandlerForContentType("com.adobe.pdf" as CFString, LSRolesMask.all, "com.adobe.Acrobat.Pro" as CFString)