Skip to content

datetime.datetime.fromtimestamp have different behaviour on windows and mac #82414

Closed

Description

@AlexandreOuellet
BPO 38233
Nosy @pfmoore, @ronaldoussoren, @tjguk, @ned-deily, @zware, @zooba, @ammaraskar, @pganssle
Superseder
  • bpo-36439: Inconsistencies with datetime.fromtimestamp(t) when t < 0
  • 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 2020-10-25.15:02:55.662>
    created_at = <Date 2019-09-20.14:55:16.580>
    labels = ['OS-mac', 'type-bug', 'OS-windows']
    title = 'datetime.datetime.fromtimestamp have different behaviour on windows and mac'
    updated_at = <Date 2020-10-25.15:02:55.662>
    user = 'https://bugs.python.org/AlexandreOuellet'

    bugs.python.org fields:

    activity = <Date 2020-10-25.15:02:55.662>
    actor = 'eryksun'
    assignee = 'none'
    closed = True
    closed_date = <Date 2020-10-25.15:02:55.662>
    closer = 'eryksun'
    components = ['macOS', 'Windows']
    creation = <Date 2019-09-20.14:55:16.580>
    creator = 'Alexandre Ouellet'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 38233
    keywords = []
    message_count = 4.0
    messages = ['352853', '352863', '355820', '379571']
    nosy_count = 9.0
    nosy_names = ['paul.moore', 'ronaldoussoren', 'tim.golden', 'ned.deily', 'zach.ware', 'steve.dower', 'ammar2', 'p-ganssle', 'Alexandre Ouellet']
    pr_nums = []
    priority = 'normal'
    resolution = 'duplicate'
    stage = 'resolved'
    status = 'closed'
    superseder = '36439'
    type = 'behavior'
    url = 'https://bugs.python.org/issue38233'
    versions = ['Python 3.6']

    Activity

    1. AlexandreOuellet commented on Sep 20, 2019

      AlexandreOuelletmannequin
      MannequinAuthor

      in a python console on a windows machine:

      import datetime
      d = datetime.datetime.fromtimestamp(0)
      d
      >datetime.datetime(1969, 12, 31, 19, 0)
      d.timestamp()
      >OSError: [Errno 22] Invalid argument

      on a macOS machine :

      d = datetime.datetime.fromtimestamp(-1)
      d
      >datetime.datetime(1969, 12, 31, 19, 0)
      d.timestamp()
      >-1.0

      both machines running 3.6.9

      I would expect them have the same behaviour.

    2. added
      type-crash
      on Sep 20, 2019
    3. ammaraskar commented on Sep 20, 2019

      @ammaraskar
      Member

      Thanks for the report Alexandre, this has to do with issues with negative numbers in Window's time APIs. There's already a bug open for this, so I've marked it as a duplicate.

    4. added
      type-bug
      and removed
      type-crash
      on Sep 20, 2019
    5. pganssle commented on Nov 1, 2019

      @pganssle
      Member

      Changing the superceder here as I think bpo-36439 matches better than bpo-37527.

    6. ronaldoussoren commented on Oct 25, 2020

      @ronaldoussoren
      Contributor

      Can this issue be closed? Fixing bpo-36439 would also fix this issue.

    7. transferred this issue fromon Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

    Metadata

    Metadata

    Assignees

    No one assigned

      Labels

      OS-macOS-windowstype-bug

      Projects

      No projects

        Milestone

        No milestone

        Relationships

        None yet

        Development

        No branches or pull requests

        Issue actions