Opened 5 years ago

Closed 4 years ago

#7166 defect closed duplicate (duplicate)

FilePath silently accepts texts

Reported by: Alex Gaynor Owned by:
Priority: normal Milestone: Python-3.x
Component: core Keywords:
Cc: Branch:

Description (last modified by Jean-Paul Calderone)

It's documented that self.path is only bytes, but it silently accepts text, and sometimes some of the functions even work, but mostly they blow up on Py3k.

In addition to the initializer, a few methods accept a string interpreted as part of a path (for example, child and sibling).

The first step towards a solution is deciding on an encoding policy. Should text be transparently encoded to bytes using UTF-8? Using sys.getfilesystemencoding()? Using a per-FilePath configurable encoding? Should values be encoded by FilePath at all (some Python 3 APIs operate just fine on text)? Should the results produced by FilePath always be bytes? Always be text? Depend on how it was initialized? Be controlled by some other (per-FilePath? configurable policy)?

Change History (5)

comment:1 Changed 5 years ago by Alex Gaynor

Type: enhancementdefect

comment:2 Changed 5 years ago by Jean-Paul Calderone

Description: modified (diff)

comment:4 Changed 4 years ago by Adi Roiban

See #7805 which ask to Unicode support ... in case #7805 is accepted, I think that this should be closed as wont fix.

comment:5 Changed 4 years ago by hawkowl

Resolution: duplicate
Status: newclosed

#7805 is the way to go. Closing this as a duplicate.

Note: See TracTickets for help on using tickets.