Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add pathlib._abc.PathModuleBase #113893

Merged
merged 6 commits into from
Jan 14, 2024
Merged

Commits on Jan 10, 2024

  1. Add pathlib._abc.PathModuleBase

    Path modules provide a subset of the `os.path` API, specifically those
    functions needed to provide `PurePathBase` functionality. Each
    `PurePathBase` subclass references its path module via a `pathmod` class
    attribute.
    
    This commit adds a new `PathModuleBase` class, which provides abstract
    methods that unconditionally raise `UnsupportedOperation`. An instance of
    this class is assigned to `PurePathBase.pathmod`, replacing `posixpath`.
    As a result, `PurePathBase` is no longer POSIX-y by default, and almost[^1]
    all its methods raise `UnsupportedOperation` courtesy of `pathmod`.
    
    Users who subclass `PurePathBase` or `PathBase` should choose the path
    syntax by setting `pathmod` to `posixpath`, `ntpath`, `os.path`, or their
    own subclass of `PathModuleBase`, as circumstances demand.
    
    [^1] Except `joinpath()`, `__truediv__()`, `__rtruediv__()`. See pythonGH-113888.
    barneygale committed Jan 10, 2024
    Configuration menu
    Copy the full SHA
    f130f75 View commit details
    Browse the repository at this point in the history

Commits on Jan 13, 2024

  1. Configuration menu
    Copy the full SHA
    9f16cd9 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    ba23f5d View commit details
    Browse the repository at this point in the history
  3. Remove unnecessary methods

    barneygale committed Jan 13, 2024
    Configuration menu
    Copy the full SHA
    2e505ad View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    52adec5 View commit details
    Browse the repository at this point in the history
  5. Fix join() signature.

    barneygale committed Jan 13, 2024
    Configuration menu
    Copy the full SHA
    3fe8593 View commit details
    Browse the repository at this point in the history