Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork33.7k
Description
Bug report
Bug description:
While working on an experiment with different scheduler priorities and themultiprocessing.Pool, I found out that using anos.sched_param object as one of theinitargs parameters raised the following exception:
Traceback (mostrecentcalllast):File"/usr/lib/python3.12/multiprocessing/forkserver.py",line274,inmaincode=_serve_one(child_r,fds,^^^^^^^^^^^^^^^^^^^^^^^^File"/usr/lib/python3.12/multiprocessing/forkserver.py",line313,in_serve_onecode=spawn._main(child_r,parent_sentinel)^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^File"/usr/lib/python3.12/multiprocessing/spawn.py",line132,in_mainself=reduction.pickle.load(from_parent)^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^TypeError:sched_param()takesatmost1argument (2given)
With a bit of investigation using the REPL, I quickly found out a simple way to reproduce the problem:
Python3.12.7 (main,Oct12024,11:15:50) [GCC14.2.120240910]onlinuxType"help","copyright","credits"or"license"formoreinformation.>>>importos>>>importpickle>>>withopen('schedparam','wb')asf:...pickle.dump(os.sched_param(99),f)...>>>withopen('schedparam','rb')asf:...pickle.load(f)...Traceback (mostrecentcalllast):File"<stdin>",line2,in<module>TypeError:sched_param()takesatmost1argument (2given)
The exact value used in theos.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 usesos.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 packagepython3 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
Metadata
Metadata
Assignees
Projects
Status