classification
Title: Raise a pickleError when convert _functools module to use PyType_FromModuleAndSpec
Type: behavior Stage: patch review
Components: Extension Modules Versions: Python 3.10
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: petr.viktorin, serhiy.storchaka, shihai1991, vstinner
Priority: normal Keywords: patch

Created on 2020-11-19 15:39 by shihai1991, last changed 2020-11-23 19:50 by serhiy.storchaka.

Pull Requests
URL Status Linked Edit
PR 23407 open shihai1991, 2020-11-19 15:58
Messages (5)
msg381436 - (view) Author: hai shi (shihai1991) * (Python triager) Date: 2020-11-19 15:39
Touch an error when convert _functools module to use PyType_FromModuleAndSpec, the error info:
_pickle.PicklingError: Can't pickle <class 'functools.partial'>: it's not the same object as functools.partial

The related PR: PR3405
msg381437 - (view) Author: hai shi (shihai1991) * (Python triager) Date: 2020-11-19 15:40
Oh, sorry, wrong PR number. the right one: PR23405
msg381440 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2020-11-19 16:45
> _pickle.PicklingError: Can't pickle <class 'functools.partial'>: it's not the same object as functools.partial

I don't understand this error. It looks like a bug in functools.

The PR 23407 looks like a workaround rather than a fix.

You should analyze why "cls != obj" conditon is true: why cls is not obj?
msg381675 - (view) Author: hai shi (shihai1991) * (Python triager) Date: 2020-11-23 16:06
> You should analyze why "cls != obj" conditon is true: why cls is not obj?

You are right. I am in the wrong way definitely. It's weird to me.I try to figure it out in this week~
msg381693 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2020-11-23 19:50
It looks like you imported the functools module twice and have two different classes functools.partial. When you try to import one of them, you found the other one.
History
Date User Action Args
2020-11-23 19:50:19serhiy.storchakasetnosy: + serhiy.storchaka
messages: + msg381693
2020-11-23 16:06:10shihai1991setmessages: + msg381675
2020-11-19 16:45:56vstinnersetmessages: + msg381440
2020-11-19 15:58:31shihai1991setkeywords: + patch
stage: patch review
pull_requests: + pull_request22300
2020-11-19 15:40:09shihai1991setmessages: + msg381437
2020-11-19 15:39:07shihai1991create