-
-
Notifications
You must be signed in to change notification settings - Fork 30.4k
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
An os.sched_param object can be dumped with pickle, but loading raises TypeError #126303
Comments
I took a look into this with pickletools (on Debian 12 Python 3.11.2). It seems that the problem is pickle creates tuple with 99 and an empty dictionary for keyword arguments.
|
cc @serhiy-storchaka as the pickle expert |
There are two ways to fix this issue:
The former is more complex and error-prone. The latter needs adding internal C API for overriding methods specified by PyMethodDef. I hope this is enough. |
…ythonGH-126336) (cherry picked from commit d384050) Co-authored-by: Serhiy Storchaka <[email protected]>
…jects (pythonGH-126336) (cherry picked from commit d384050) Co-authored-by: Serhiy Storchaka <[email protected]>
…H-126336) (GH-126423) (cherry picked from commit d384050) Co-authored-by: Serhiy Storchaka <[email protected]>
Bug report
Bug description:
While working on an experiment with different scheduler priorities and the multiprocessing.Pool, I found out that using an os.sched_param object as one of the initargs parameters raised the following exception:
With a bit of investigation using the REPL, I quickly found out a simple way to reproduce the problem:
The exact value used in the os.sched_param constructor doesn't affect the result. My specific use case is in Linux, where I'm trying to create a pool of processes where each one uses os.sched_setscheduler as an initializer to change their own scheduling policy to something different from the parent process and see the resulting behavior.
Im using Arch Linux with the package python3 3.12.7-1, which is the latest version as the time of writting. I have also found that this issue is also present in Pypy, if it is of any use.
CPython versions tested on:
3.12
Operating systems tested on:
Linux
Linked PRs
The text was updated successfully, but these errors were encountered: