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

Breaking change in PyDate_FromTimeStamp API #80206

Closed
pganssle opened this issue Feb 18, 2019 · 4 comments
Closed

Breaking change in PyDate_FromTimeStamp API #80206

pganssle opened this issue Feb 18, 2019 · 4 comments
Assignees
Labels
3.8 only security fixes release-blocker stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error

Comments

@pganssle
Copy link
Member

BPO 36025
Nosy @abalkin, @encukou, @ambv, @berkerpeksag, @serhiy-storchaka, @pganssle
PRs
  • bpo-36025: Restore original function API for PyDate_FromTimestamp #11922
  • 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 = 'https://github.com/pganssle'
    closed_at = <Date 2019-04-27.19:59:54.756>
    created_at = <Date 2019-02-18.17:22:05.656>
    labels = ['3.8', 'type-bug', 'library', 'release-blocker']
    title = 'Breaking change in PyDate_FromTimeStamp API'
    updated_at = <Date 2019-04-27.19:59:54.756>
    user = 'https://github.com/pganssle'

    bugs.python.org fields:

    activity = <Date 2019-04-27.19:59:54.756>
    actor = 'berker.peksag'
    assignee = 'p-ganssle'
    closed = True
    closed_date = <Date 2019-04-27.19:59:54.756>
    closer = 'berker.peksag'
    components = ['Library (Lib)']
    creation = <Date 2019-02-18.17:22:05.656>
    creator = 'p-ganssle'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 36025
    keywords = ['patch']
    message_count = 4.0
    messages = ['335854', '335858', '335893', '341009']
    nosy_count = 6.0
    nosy_names = ['belopolsky', 'petr.viktorin', 'lukasz.langa', 'berker.peksag', 'serhiy.storchaka', 'p-ganssle']
    pr_nums = ['11922']
    priority = 'release blocker'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue36025'
    versions = ['Python 3.8']

    @pganssle
    Copy link
    Member Author

    The PyO3 test suite has been breaking since the alpha release of Python 3.8 because PyDateTimeAPI->Date_FromTimeStamp has had a breaking change in its API: PyO3/pyo3#352

    I believe this happened when datetime.date.fromtimestamp and datetime.datetime.fromtimestamp were converted over to using the argument clinic. The function date_from_local_object was renamed to date_fromtimestamp, without a corresponding change to the PyDateTimeCAPI struct.

    @pganssle pganssle added the 3.8 only security fixes label Feb 18, 2019
    @pganssle pganssle self-assigned this Feb 18, 2019
    @pganssle pganssle added the stdlib Python modules in the Lib dir label Feb 18, 2019
    @pganssle
    Copy link
    Member Author

    I've put *a* fix in there by introducing a new wrapper function. Ideally we would just point the C API at the argument clinic-generated function, but because it takes a single positional argument the argument clinic outputs a METH_O function instead of METH_VARARGS.

    I think these are the options:

    1. Modify the argument clinic spec to force METH_VARARGS for a single positional argument taking an object - if that's possible.
    2. Maintain a wrapper function for the C API that just unpacks the tuple and passes it to the date_fromtimestamp function that the argument clinic is *also* wrapping.
    3. Revert the argument clinic change and manually manage the date_fromtimestamp function as a METH_VARARGS classmethod.

    I don't know enough about the argument clinic to know if #1 is feasible, if it is and someone can point me in the right direction, I can update my PR. If not, I think I mildly prefer #2, since maintaining a thin wrapper that unpacks a tuple is not terribly difficult compared to maintaining the method definition stuff.

    Since this was an accidental break in the C API, I've marked it as a release blocker.

    @serhiy-storchaka
    Copy link
    Member

    I prefer option 2. Your PR LGTM.

    @berkerpeksag
    Copy link
    Member

    New changeset 4d8c8c0 by Berker Peksag (Paul Ganssle) in branch 'master':
    bpo-36025: Fix PyDate_FromTimestamp API (GH-11922)
    4d8c8c0

    @berkerpeksag berkerpeksag added the type-bug An unexpected behavior, bug, or error label Apr 27, 2019
    @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
    3.8 only security fixes release-blocker stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error
    Projects
    None yet
    Development

    No branches or pull requests

    3 participants