Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 914873 - sys-apps/portage: eliminate deprecated asyncio.get_child_watcher() usage
Summary: sys-apps/portage: eliminate deprecated asyncio.get_child_watcher() usage
Status: RESOLVED FIXED
Alias: None
Product: Portage Development
Classification: Unclassified
Component: Core (show other bugs)
Hardware: All Linux
: Normal normal
Assignee: Portage team
URL: https://github.com/python/cpython/iss...
Whiteboard:
Keywords: InVCS
Depends on: 915120
Blocks:
  Show dependency tree
 
Reported: 2023-09-28 03:43 UTC by Zac Medico
Modified: 2023-10-20 00:51 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Zac Medico gentoo-dev 2023-09-28 03:43:05 UTC
This DeprecationWarning is triggered by lib/portage/tests/dbapi/test_auxdb.py:

> lib/portage/tests/dbapi/test_auxdb.py::AuxdbTestCase::test_anydbm
>   /usr/lib/python3.12/asyncio/events.py:824: DeprecationWarning: 'get_child_watcher' is deprecated as of Python 3.12 and will be removed in Python 3.14.
>     return get_event_loop_policy().get_child_watcher()

In https://github.com/python/cpython/issues/94597 it seems to indicate that we can use PidfdChildWatcher from asyncio.unix_events on supported linux kernels (linux-5.3+) and otherwise use ThreadedChildWatcher.
Comment 1 Larry the Git Cow gentoo-dev 2023-10-05 07:14:02 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/proj/portage.git/commit/?id=690ac6e78c4099e83b84ef11c0b4064b077a8ef0

commit 690ac6e78c4099e83b84ef11c0b4064b077a8ef0
Author:     Zac Medico <zmedico@gentoo.org>
AuthorDate: 2023-10-05 06:27:27 +0000
Commit:     Zac Medico <zmedico@gentoo.org>
CommitDate: 2023-10-05 06:57:11 +0000

    Eliminate deprecated asyncio.get_child_watcher() usage
    
    Use PidfdChildWatcher if os.pidfd_open is available and works, and
    otherwise use ThreadedChildWatcher which should work in any case.
    
    The _ChildWatcherThreadSafetyWrapper class is not needed because
    both PidfdChildWatcher and ThreadedChildWatcher use the running
    event loop to invoke the child handler callback, and it is safe
    to assume that the current AsyncioEventLoop instance is the
    running loop when it is used to obtain a child watcher instance.
    
    Bug: https://bugs.gentoo.org/914873
    Signed-off-by: Zac Medico <zmedico@gentoo.org>

 lib/portage/util/_eventloop/asyncio_event_loop.py | 51 +++++++++++------------
 1 file changed, 24 insertions(+), 27 deletions(-)
Comment 2 Larry the Git Cow gentoo-dev 2023-10-05 09:21:18 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/proj/portage.git/commit/?id=c98240fba21b319e27fe595d70c671c9ddfb7fd0

commit c98240fba21b319e27fe595d70c671c9ddfb7fd0
Author:     Zac Medico <zmedico@gentoo.org>
AuthorDate: 2023-10-05 08:20:14 +0000
Commit:     Zac Medico <zmedico@gentoo.org>
CommitDate: 2023-10-05 08:21:47 +0000

    AsyncioEventLoop: Put back _ChildWatcherThreadSafetyWrapper
    
    In case there are multiple loops running in different threads,
    use _ChildWatcherThreadSafetyWrapper. This partially reverts
    commit 690ac6e78c4099e83b84ef11c0b4064b077a8ef0.
    
    Bug: https://bugs.gentoo.org/914873
    Signed-off-by: Zac Medico <zmedico@gentoo.org>

 lib/portage/util/_eventloop/asyncio_event_loop.py | 30 ++++++++++++++++++++++-
 1 file changed, 29 insertions(+), 1 deletion(-)
Comment 3 Larry the Git Cow gentoo-dev 2023-10-20 00:51:25 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=3500483f75789c36e379c1b6546a09df7c11e2b1

commit 3500483f75789c36e379c1b6546a09df7c11e2b1
Author:     Sam James <sam@gentoo.org>
AuthorDate: 2023-10-20 00:49:33 +0000
Commit:     Sam James <sam@gentoo.org>
CommitDate: 2023-10-20 00:51:00 +0000

    sys-apps/portage: add 3.0.53
    
    Closes: https://bugs.gentoo.org/915120
    Closes: https://bugs.gentoo.org/821529
    Closes: https://bugs.gentoo.org/914441
    Closes: https://bugs.gentoo.org/914722
    Closes: https://bugs.gentoo.org/914873
    Closes: https://bugs.gentoo.org/915099
    Closes: https://bugs.gentoo.org/915123
    Closes: https://bugs.gentoo.org/915128
    Closes: https://bugs.gentoo.org/915136
    Closes: https://bugs.gentoo.org/915330
    Closes: https://bugs.gentoo.org/915494
    Closes: https://bugs.gentoo.org/915834
    Closes: https://bugs.gentoo.org/915903
    Closes: https://bugs.gentoo.org/900224
    Signed-off-by: Sam James <sam@gentoo.org>

 sys-apps/portage/Manifest              |   1 +
 sys-apps/portage/portage-3.0.53.ebuild | 238 +++++++++++++++++++++++++++++++++
 2 files changed, 239 insertions(+)