Comments (10)
We don't need to document every detail of what realpath()
does. Tests would be welcome, though
from cpython.
os.path.realpath()
resolves the path using the current OS's rules, which might be more specific than POSIX. Both my Linux and macOS machines resolve //foo
to /foo
. Are there any supported Python platforms where //
isn't resolved to /
?
from cpython.
I'm currently on my Windows laptop, so I can't check.
In any case, the old implementation can never return //foo
because path
is set to os.sep
.
Is there a "needs investigation" label?
from cpython.
There doesn't seem to be anything like a "needs investigation" label.
Happy to leave this issue open for a bit while you further research a repro case, but if we can't find one, then I think this issue should be closed as "can't repro".
from cpython.
Also, the current behaviour is undocumented:
Join two paths, normalizing and eliminating any symbolic links encountered in the second path.
Normalizing doesn't touch the double slash & //
is not a symlink.
from cpython.
You're quoting a comment above the internal _joinrealpath()
function.
Both the posixpath.realpath()
docstring, and the online docs, describe it as returning a canonical path. The online docs add:
This function emulates the operating system’s procedure for making a path canonical
from cpython.
OK, but that comment doesn't document this feature, which it probably should, in case this works correctly.
from cpython.
Why do you want to fix this, and could you describe in more detail how the changes relate to the specification you are pointing to? I don't see what in the specification requires this.
from cpython.
Yep, the old behaviour seems to be correct (cd doesn't resolve symlinks), in that case the feature should just be documented and tested.
from cpython.
I've added just one sentence in this pull request: #117350.
Join two paths, normalizing and eliminating any symbolic links encountered in the second path. Two leading slashes are replaced by a single slash.
Where should I add the test though? It doesn't really fit in with the rest of the changes.
from cpython.
Related Issues (20)
- Difference in _use_fd_functions in shutil.py and test_shutil.py HOT 2
- Defer `import warnings` in pathlib HOT 2
- Add the ``--duration`` option to the test suite HOT 5
- ZipFile.mkdir(ZipInfo.from_file(...)) CRC AttributeError
- Implement the fast path for `list.__getitem__` HOT 4
- Documentation of pathlib.Path methods is disorganised
- Make ZeroDivisionError message more precise when floor-dividing by zero HOT 7
- Popen.send_signal(sigint.SIGKILL) does not seem to work with Popen(*, shell=True)? HOT 4
- Make Python 3.13 coroutines work with multithreading automatically like Goroutines does and some like `go` keyword for later. HOT 1
- Test with the path protocol, not with pathlib.Path
- String module should have a string like printable but without whitespace HOT 10
- Version numbers not supported for shebang line virtual command /usr/bin/env python on windows HOT 7
- "No module named 'Cython'", but only when installing a package and only with pip 23.1 or later HOT 2
- pyrepl doesn't print result if any part came from paste HOT 2
- venv tutorial wrong/confusing about python version used HOT 8
- weird behavior of the import statement HOT 1
- Backport changes from python/cpython#119065 HOT 1
- Regular Expression: re.split behavior weird when have a sub pattern HOT 5
- "TypeError: catching classes that do not inherit from BaseException is not allowed" error when using generic in `except` block HOT 4
- Misleading sqlite3.Cursor.rowcount docs HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cpython.