classification
Title: [doc] Clarify copyreg.pickle() documentation
Type: behavior Stage: patch review
Components: Documentation Versions: Python 3.11, Python 3.10, Python 3.9
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: docs@python Nosy List: docs@python, kumaraditya303, miss-islington, peter.otten, serhiy.storchaka
Priority: normal Keywords: easy, patch

Created on 2014-03-02 08:46 by peter.otten, last changed 2022-01-18 20:17 by miss-islington.

Files
File name Uploaded Description Edit
copyreg.patch peter.otten, 2014-03-02 08:53 review
Pull Requests
URL Status Linked Edit
PR 30230 merged kumaraditya303, 2021-12-22 12:08
PR 30669 merged miss-islington, 2022-01-18 19:53
PR 30670 merged miss-islington, 2022-01-18 19:53
Messages (6)
msg212541 - (view) Author: Peter Otten (peter.otten) * Date: 2014-03-02 08:46
The documentation for 

copyreg.pickle(type, function, constructor=None)

has the sentence

"TypeError will be raised if *object* is a class or *constructor* is not callable."

It's not clear to me what "object" refers to. I believe it refers to the first arg (called ob_type in 2.x) and classic classes which were handled with

def pickle(ob_type, pickle_function, constructor_ob=None):
    if type(ob_type) is _ClassType:
        raise TypeError("copy_reg is not intended for use with classes")

in 2.x If I'm right the above sentence should become.

"A TypeError will be raised if *constructor* is not callable."

in 3.x. If I'm wrong please think of way to express the intended meaning more clearly.

Another minor change: class C need not inherit from object explicitly in  3.x.
msg288092 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2017-02-18 21:09
The phrase "*function* should return either a string or a tuple containing two or three elements." de-facto is outdated too. Since Python 2.3 a tuple returned by the function must have two to five elements.

copyreg.constructor() no longer does anything useful, and the constructor parameter of copyreg.pickle() is virtually ignored.
msg296271 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2017-06-18 12:45
Could you update your patch Peter, and since CPython development is moved to GitHub, create a pull request?
msg410883 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2022-01-18 19:53
New changeset 65940fa5c12a4b4a0650c7845044ffd63b94e227 by Kumar Aditya in branch 'main':
bpo-20823: Clarify copyreg.pickle() documentation (GH-30230)
https://github.com/python/cpython/commit/65940fa5c12a4b4a0650c7845044ffd63b94e227
msg410884 - (view) Author: miss-islington (miss-islington) Date: 2022-01-18 20:17
New changeset 9238a52cbc39c17ca6c7a8cbda32808dd5522a59 by Miss Islington (bot) in branch '3.10':
bpo-20823: Clarify copyreg.pickle() documentation (GH-30230)
https://github.com/python/cpython/commit/9238a52cbc39c17ca6c7a8cbda32808dd5522a59
msg410885 - (view) Author: miss-islington (miss-islington) Date: 2022-01-18 20:17
New changeset 8527f7a722aee3d9025267cc7ff2eb8afa38d166 by Miss Islington (bot) in branch '3.9':
bpo-20823: Clarify copyreg.pickle() documentation (GH-30230)
https://github.com/python/cpython/commit/8527f7a722aee3d9025267cc7ff2eb8afa38d166
History
Date User Action Args
2022-01-18 20:17:10miss-islingtonsetmessages: + msg410885
2022-01-18 20:17:03miss-islingtonsetmessages: + msg410884
2022-01-18 19:53:57miss-islingtonsetpull_requests: + pull_request28870
2022-01-18 19:53:52miss-islingtonsetnosy: + miss-islington
pull_requests: + pull_request28869
2022-01-18 19:53:52serhiy.storchakasetmessages: + msg410883
2021-12-22 12:08:45kumaraditya303setkeywords: + patch
nosy: + kumaraditya303
pull_requests: + pull_request28452
2021-12-09 23:26:15iritkatrielsetkeywords: + easy, - patch
title: Clarify copyreg.pickle() documentation -> [doc] Clarify copyreg.pickle() documentation
versions: + Python 3.9, Python 3.10, Python 3.11, - Python 3.5, Python 3.6, Python 3.7
2017-06-18 12:45:07serhiy.storchakasetmessages: + msg296271
2017-02-18 21:09:56serhiy.storchakasetversions: + Python 3.5, Python 3.6, Python 3.7, - Python 3.3
nosy: + serhiy.storchaka

messages: + msg288092

type: behavior
stage: patch review
2014-03-02 08:53:02peter.ottensetfiles: + copyreg.patch
keywords: + patch
2014-03-02 08:46:06peter.ottencreate