Note: This is a public test instance of Red Hat Bugzilla. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback at bugzilla.redhat.com.

Bug 2219556

Summary: python-inotify doesn't work: imports asyncore removed in Python 3.12
Product: [Fedora] Fedora Reporter: Karolina Surma <ksurma>
Component: python-inotifyAssignee: Terje Røsten <terje.rosten>
Status: CLOSED NEXTRELEASE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 39CC: amoralej, apevec, epel-packagers-sig, jcapitao, karlthered, mhroncok, openstack-sig, steve.traylen, terje.rosten, troy
Target Milestone: ---Keywords: Reopened
Target Release: ---   
Hardware: Unspecified   
OS: Linux   
Whiteboard:
Fixed In Version: python-inotify-0.9.6-32.fc40, python-inotify-0.9.6-32.fc39 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2023-08-14 13:28:43 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 2223081, 2241084    
Bug Blocks: 2220387, 2226270, 2229354    

Description Karolina Surma 2023-07-04 09:55:42 UTC
Module asyncore has been deleted from Python 3.12 with a recommendation to use asyncio instead.
This hasn't been caught during the Python 3.12 mass-rebuild because the package runs no tests.

Python 3.12.0b3 (main, Jun 21 2023, 00:00:00) [GCC 13.1.1 20230614 (Red Hat 13.1.1-4)] on linux
>>> import pyinotify
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python3.12/site-packages/pyinotify.py", line 71, in <module>
    import asyncore
ModuleNotFoundError: No module named 'asyncore'



Reproducible: Always

Comment 1 Miro Hrončok 2023-07-04 12:13:44 UTC
This breaks python-oslo-log, so I'll reassign there and back to get the solo folks CCed.

Comment 2 Miro Hrončok 2023-07-04 12:14:51 UTC
(In reply to Miro Hrončok from comment #1)
> ...to get the solo folks CCed.

s/solo/oslo/

Comment 3 Joel Capitao 2023-07-04 14:26:13 UTC
Thank you for the heads-up I was about to look into the oslo-log FTBFS

Comment 4 Terje Røsten 2023-07-09 20:20:42 UTC
FYI:
 https://github.com/simonrob/pyasyncore

 This package contains the asyncore module as found in Python versions prior to 3.12. 
 It is provided so that existing code relying on import asyncore is able to continue being used without significant refactoring.

If porting is difficult this might be an option?

Comment 5 Terje Røsten 2023-07-15 09:48:04 UTC
New package request:

 https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=2223081

Comment 6 Troy Curtis 2023-08-08 02:28:40 UTC
It looks like "porting" isn't necessary, as there is already [asyncio support](https://github.com/seb-m/pyinotify/blob/master/python3/pyinotify.py#L1568). asyncore is only used to provide one particular [asyncore utility](https://github.com/seb-m/pyinotify/blob/0f3f8950d12e4a6534320153eed1a90a778da4ae/python3/pyinotify.py#L1497). So really all that needs to happen is to make asyncore import optional, and not create this class if it doesn't exist. Of course, if the user of pyinotify uses this class they will need to port over to one of the other options. However, they likely want to use that implementation because they are using elsewhere, and thus they'd already be broken under 3.12 anyway.

Comment 7 Alfredo Moralejo 2023-08-09 09:34:32 UTC
from oslo-log user, it is not using any AsyncNotifier, however fails to import inotify as it imports asyncio unconditionally. If at least we could mak it optional import, that would unblock it

Comment 8 Troy Curtis 2023-08-11 02:34:58 UTC
I just posted a PR to fix the issue by making the import of asyncore optional: https://src.fedoraproject.org/rpms/python-inotify/pull-request/4

Comment 9 Terje Røsten 2023-08-13 18:32:09 UTC
https://koji.fedoraproject.org/koji/buildinfo?buildID=2273341

* Thu Aug 10 2023 Troy Curtis, Jr <troycurtisjr> - 0.9.6-32
- Fixes build for Python 3.12 (#2219556)

Comment 10 Alfredo Moralejo 2023-08-14 07:00:41 UTC
Note that this needs to be backported to f39

Comment 11 Miro Hrončok 2023-08-14 13:00:11 UTC
Building python-inotify-0.9.6-32.fc39 for f39-candidate
Created task: 104828199
Task info: https://koji.fedoraproject.org/koji/taskinfo?taskID=104828199

Comment 12 Miro Hrončok 2023-08-14 13:28:43 UTC
Successfully waited 0:00 for python-inotify-0.9.6-32.fc39 to appear in the f39-build repo