Issue #19775: Add a samefile() method to pathlib Path objects.

Initial patch by Vajrasky Kok.
- Issue #17756: Fix test_code test when run from the installed location.
Merge from 3.4:
- Issue #17756: Fix test_code test when run from the installed location.