Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

An os.sched_param object can be dumped with pickle, but loading raises TypeError #126303

Closed
@Willy19921992

Description

@Willy19921992

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

No one assigned

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp