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

os.utime() docs not clear on behavior on nonexistant files #59433

Closed
dewin mannequin opened this issue Jun 30, 2012 · 4 comments
Closed

os.utime() docs not clear on behavior on nonexistant files #59433

dewin mannequin opened this issue Jun 30, 2012 · 4 comments
Labels
docs Documentation in the Doc dir type-feature A feature request or enhancement

Comments

@dewin
Copy link
Mannequin

dewin mannequin commented Jun 30, 2012

BPO 15228
Nosy @larryhastings
Files
  • issue15228-utime-touch-doc.patch
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = None
    closed_at = <Date 2013-10-06.16:57:21.793>
    created_at = <Date 2012-06-30.19:55:23.278>
    labels = ['type-feature', 'docs']
    title = 'os.utime() docs not clear on behavior on nonexistant files'
    updated_at = <Date 2013-10-06.16:57:21.792>
    user = 'https://bugs.python.org/dewin'

    bugs.python.org fields:

    activity = <Date 2013-10-06.16:57:21.792>
    actor = 'python-dev'
    assignee = 'docs@python'
    closed = True
    closed_date = <Date 2013-10-06.16:57:21.793>
    closer = 'python-dev'
    components = ['Documentation']
    creation = <Date 2012-06-30.19:55:23.278>
    creator = 'dewin'
    dependencies = []
    files = ['26306']
    hgrepos = []
    issue_num = 15228
    keywords = ['patch']
    message_count = 4.0
    messages = ['164422', '164904', '165457', '199101']
    nosy_count = 5.0
    nosy_names = ['larry', 'docs@python', 'bbrazil', 'python-dev', 'dewin']
    pr_nums = []
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'enhancement'
    url = 'https://bugs.python.org/issue15228'
    versions = []

    @dewin
    Copy link
    Mannequin Author

    dewin mannequin commented Jun 30, 2012

    The documentation for os.utime() at http://docs.python.org/py3k/library/os.html#os.utime states:

    "Set the access and modified times of the file specified by path. [...] The effect is similar to running the Unix program touch on the path.)"

    Unlike 'touch', os.utime() will not create an empty file if called on a file that does not exist. IMO the current behavior is correct, but the comparison of os.utime() to touch implies that it would create empty files.

    I suggest clarifying the documentation to emphasize that os.utime() will not create new files and raises OSError in the event that the file does not exist.

    @dewin dewin mannequin assigned docspython Jun 30, 2012
    @dewin dewin mannequin added docs Documentation in the Doc dir type-feature A feature request or enhancement labels Jun 30, 2012
    @bbrazil
    Copy link
    Mannequin

    bbrazil mannequin commented Jul 7, 2012

    Here's a patch that should clarify this.

    @larryhastings
    Copy link
    Contributor

    I don't think this needs clarifying. If you think the reference to "touch" currently only muddles the issue, let's remove it entirely.

    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented Oct 6, 2013

    New changeset 62321359c35b by Georg Brandl in branch '3.3':
    Closes bpo-15228: remove reference to Unix "touch"; it is confusing since the path needs to exist for os.utime() to succeed
    http://hg.python.org/cpython/rev/62321359c35b

    @python-dev python-dev mannequin closed this as completed Oct 6, 2013
    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    docs Documentation in the Doc dir type-feature A feature request or enhancement
    Projects
    None yet
    Development

    No branches or pull requests

    1 participant