Skip to content

Revisit IsoCalendarDate being private from pickle perspective #86236

Closed
@msimpasona

Description

@msimpasona
BPO 42070
Nosy @terryjreedy, @abalkin, @pganssle

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 = None
created_at = <Date 2020-10-18.18:44:55.085>
labels = ['type-feature', 'library', '3.10']
title = 'Revisit IsoCalendarDate being private from pickle perspective'
updated_at = <Date 2020-10-24.03:46:18.232>
user = 'https://bugs.python.org/msimpasona'

bugs.python.org fields:

activity = <Date 2020-10-24.03:46:18.232>
actor = 'terry.reedy'
assignee = 'none'
closed = False
closed_date = None
closer = None
components = ['Library (Lib)']
creation = <Date 2020-10-18.18:44:55.085>
creator = 'msimpasona'
dependencies = []
files = []
hgrepos = []
issue_num = 42070
keywords = []
message_count = 6.0
messages = ['378884', '378896', '379466', '379480', '379482', '379515']
nosy_count = 4.0
nosy_names = ['terry.reedy', 'belopolsky', 'p-ganssle', 'msimpasona']
pr_nums = []
priority = 'normal'
resolution = None
stage = None
status = 'open'
superseder = None
type = 'enhancement'
url = 'https://bugs.python.org/issue42070'
versions = ['Python 3.10']

Activity

msimpasona

msimpasona commented on Oct 18, 2020

@msimpasona
MannequinAuthor

IsoCalendarDate is pickled as a regular tuple and so requires a slightly different code flow in case the pickle file is used as cache. More details here: https://stackoverflow.com/questions/64408303/python-3-9-unpickling-of-isocalendardate-data-returns-a-tuple

My question is what's the benefit of hiding the new class IsoCalendarDate?

added
3.9only security fixes
type-bugAn unexpected behavior, bug, or error
stdlibPython modules in the Lib dir
on Oct 18, 2020
pganssle

pganssle commented on Oct 18, 2020

@pganssle
Member

That's a reasonable enough objection, though what use case do you have for storing the IsocalendarDate object? The main reason we switched to using a named tuple like this was because the vast majority of uses of isocalendar() that I saw were people doing stuff like dt.isocalendar()[0], rather than destructuring the tuple or accessing more than one element from the result.

It seems to me that if you are using a pickle for a cache, you'd either pickle the datetime itself (and call .isocalendar() in the process that has read from the cache already), or you'd store one or more of the fields directly on the object that you are caching.

A real life use case for this would help.

terryjreedy

terryjreedy commented on Oct 23, 2020

@terryjreedy
Member

If the current situation is not a bug, a mismatch between behavior and doc, a change would be an enhancement limited to the next release.

added
3.10only security fixes
and removed
3.9only security fixes
on Oct 23, 2020
changed the title [-]I think the rationale to keep IsoCalendarDate private from the pickle perspective should get revisited[/-] [+]Revisit IsoCalendarDate being private from pickle perspective[/+] on Oct 23, 2020
added
type-featureA feature request or enhancement
3.10only security fixes
and removed
type-bugAn unexpected behavior, bug, or error
on Oct 23, 2020

11 remaining items

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

    3.10only security fixesstdlibPython modules in the Lib dirtype-featureA feature request or enhancement

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Revisit IsoCalendarDate being private from pickle perspective · Issue #86236 · python/cpython

      Follow Lee on X/Twitter - Father, Husband, Serial builder creating AI, crypto, games & web tools. We are friends :) AI Will Come To Life!

      Check out: eBank.nz (Art Generator) | Netwrck.com (AI Tools) | Text-Generator.io (AI API) | BitBank.nz (Crypto AI) | ReadingTime (Kids Reading) | RewordGame | BigMultiplayerChess | WebFiddle | How.nz | Helix AI Assistant