Skip to content

Simplify resolving symlinks: replace native extension with pwd -P - #3389

Draft
native-api wants to merge 1 commit into
masterfrom
yy-no-realpath
Draft

Simplify resolving symlinks: replace native extension with pwd -P#3389
native-api wants to merge 1 commit into
masterfrom
yy-no-realpath

Conversation

@native-api

@native-api native-api commented Jan 12, 2026

Copy link
Copy Markdown
Member

Make sure you have checked all steps below.

Prerequisite

  • Please consider implementing the feature as a hook script or plugin as a first step.
    • pyenv has some powerful support for plugins and hook scripts. Please refer to Authoring plugins for details and try to implement it as a plugin if possible.
  • Please consider contributing the patch upstream to rbenv, since we have borrowed most of the code from that project.
    • We occasionally import the changes from rbenv. In general, you can expect changes made in rbenv will be imported to pyenv too, eventually.
    • Generally speaking, we prefer not to make changes in the core in order to keep compatibility with rbenv.
  • My PR addresses the following pyenv issue (if any)
    • N/A

Description

  • Here are some details about my PR

This method is used in Rbenv (rbenv/rbenv#1428) and Homebrew (https://github.com/Homebrew/brew/blob/fa5368edd38eb8d43f8cfcca15c7cfb83ee5a78d/Library/Homebrew/brew.sh#L76-L78).

pwd -P is portable between Linux and BSD (MacOS), unlike readlink -f.

Tests

  • My PR adds the following unit tests (if any)

@native-api
native-api requested review from a team as code owners January 12, 2026 13:26

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 3 files

@native-api

Copy link
Copy Markdown
Member Author

readlink -f is now supported by all no-EOL macOS and FreeBSD versions.

So we can just use that instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants