This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Repeated Pickler.dump() doesn't reset the state in the C implementation of pickle
Type: behavior Stage: resolved
Components: Extension Modules Versions: Python 3.8, Python 3.7, Python 3.6
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: alexandre.vassalotti, lukasz.langa, miss-islington, pitrou, serhiy.storchaka
Priority: normal Keywords: patch

Created on 2018-04-03 01:08 by serhiy.storchaka, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 6355 lukasz.langa, 2018-04-03 01:12
PR 6363 merged serhiy.storchaka, 2018-04-03 07:39
PR 6366 merged miss-islington, 2018-04-03 21:11
PR 6367 merged miss-islington, 2018-04-03 21:12
Messages (4)
msg314847 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2018-04-03 01:08
test_clear_pickler_memo tested only the default protocol and fails when bump the default protocol to 4. For some reasons C implementation writes FRAME before PROTO when call Pickler.dump() repeatedly.

Python implementation:
b'\x80\x04\x95\x13\x00\x00\x00\x00\x00\x00\x00]\x94(\x8c\x07abcdefg\x94h\x01K,e.'
    0: \x80 PROTO      4
    2: \x95 FRAME      19
   11: ]    EMPTY_LIST
   12: \x94 MEMOIZE    (as 0)
   13: (    MARK
   14: \x8c     SHORT_BINUNICODE 'abcdefg'
   23: \x94     MEMOIZE    (as 1)
   24: h        BINGET     1
   26: K        BININT1    44
   28: e        APPENDS    (MARK at 13)
   29: .    STOP
highest protocol among opcodes = 4

C implementation:
b'\x95\x15\x00\x00\x00\x00\x00\x00\x00\x80\x04]\x94(\x8c\x07abcdefg\x94h\x01K,e.'
    0: \x95 FRAME      21
    9: \x80 PROTO      4
   11: ]    EMPTY_LIST
   12: \x94 MEMOIZE    (as 0)
   13: (    MARK
   14: \x8c     SHORT_BINUNICODE 'abcdefg'
   23: \x94     MEMOIZE    (as 1)
   24: h        BINGET     1
   26: K        BININT1    44
   28: e        APPENDS    (MARK at 13)
   29: .    STOP
highest protocol among opcodes = 4
msg314898 - (view) Author: Łukasz Langa (lukasz.langa) * (Python committer) Date: 2018-04-03 21:11
New changeset c869529ea9fbed574d34cf7ac139ca3f81b62ef0 by Łukasz Langa (Serhiy Storchaka) in branch 'master':
bpo-33209: End framing at the end of C implementation of pickle.Pickler.dump(). (GH-6363)
https://github.com/python/cpython/commit/c869529ea9fbed574d34cf7ac139ca3f81b62ef0
msg314899 - (view) Author: Łukasz Langa (lukasz.langa) * (Python committer) Date: 2018-04-03 21:35
New changeset 74735e2a404949b2a0c17ac13a2de0e0cac6fc41 by Łukasz Langa (Miss Islington (bot)) in branch '3.7':
bpo-33209: End framing at the end of C implementation of pickle.Pickler.dump(). (GH-6366)
https://github.com/python/cpython/commit/74735e2a404949b2a0c17ac13a2de0e0cac6fc41
msg314903 - (view) Author: miss-islington (miss-islington) Date: 2018-04-03 22:05
New changeset a5c8830637cde632ab3bcf5475698dcf0fb0546d by Miss Islington (bot) in branch '3.6':
bpo-33209: End framing at the end of C implementation of pickle.Pickler.dump(). (GH-6363)
https://github.com/python/cpython/commit/a5c8830637cde632ab3bcf5475698dcf0fb0546d
History
Date User Action Args
2022-04-11 14:58:59adminsetgithub: 77390
2018-04-04 05:08:08serhiy.storchakasetstatus: open -> closed
resolution: fixed
stage: patch review -> resolved
2018-04-03 22:05:19miss-islingtonsetnosy: + miss-islington
messages: + msg314903
2018-04-03 21:35:13lukasz.langasetmessages: + msg314899
2018-04-03 21:12:36miss-islingtonsetpull_requests: + pull_request6078
2018-04-03 21:11:42miss-islingtonsetpull_requests: + pull_request6077
2018-04-03 21:11:31lukasz.langasetnosy: + lukasz.langa
messages: + msg314898
2018-04-03 07:39:24serhiy.storchakasetpull_requests: + pull_request6073
2018-04-03 01:12:46lukasz.langasetkeywords: + patch
stage: patch review
pull_requests: + pull_request6067
2018-04-03 01:08:54serhiy.storchakalinkissue23403 dependencies
2018-04-03 01:08:23serhiy.storchakacreate