DIP29: make dup functions pure