Ticket #4736 defect closed duplicate

Opened 3 years ago

Last modified 3 years ago

Make FilePath docstring mention that it also accepts unicode paths

Reported by: ivank Owned by: ivank
Priority: low Milestone:
Component: core Keywords:
Cc: Branch:
Author: Launchpad Bug:

Description

FilePath.__doc__ says:

    @type path: C{str}
    @ivar path: The path from which 'downward' traversal is permitted.

Unicode paths are sometimes needed on Windows, and FilePath does seem to work with them. The docstring should mention that they work.

Change History

1

  Changed 3 years ago by exarkun

  • owner changed from glyph to ivank

seems to work? Write some unit tests first, then maybe we can document it.

2

  Changed 3 years ago by glyph

Yeah, this made me wince.

Windows path semantics are different from UNIX. And MacOS has a couple of special rules of its own. If you want to start dealing with unicode pathnames and FilePath that would be great, but please let's enumerate the ways it's supposed to work on different platforms and properly make sure that the behavior is correct in all cases. For example, I'm pretty sure that on Windows our internal representation should always be unicode but on POSIX-y platforms our internal representation should always be bytes.

(If we're going to do this right, we also need to add some methods, like "tell me about the object I need to pass to external APIs like os.stat() to get to this path" and "tell me about some unicode object that I could display to the user that describes this path", which are sometimes distinct and sometimes the same.)

3

  Changed 3 years ago by jknight

Didn't I have a patch that did that already?

4

follow-up: ↓ 5   Changed 3 years ago by itamar

  • status changed from new to closed
  • resolution set to duplicate

Unicode support for filepath is addressed in #2366.

5

in reply to: ↑ 4   Changed 3 years ago by glyph

Replying to itamar:

Unicode support for filepath is addressed in #2366.

#2366 doesn't detail full unicode support. I'm leaving this closed because it isn't really valid (unicode support is a total accident here) but there are a few things that FilePath will need to do beyond just allowing access to paths on Windows, such as distinguishing between the path as displayed to the user and the path as relayed to OS APIs.

6

follow-up: ↓ 7   Changed 3 years ago by jknight

Well, the branch attached to that ticket does that too. But perhaps whoever works on it next would want to separate the two issues, I dunno.

7

in reply to: ↑ 6   Changed 3 years ago by glyph

Replying to jknight:

Well, the branch attached to that ticket does that too. But perhaps whoever works on it next would want to separate the two issues, I dunno.

I was just going off of the summary - it should probably be updated. (It would likely be sanest to do them together.)

Note: See TracTickets for help on using tickets.