Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 1506164

Summary: Warning rather than error displayed when "gio" is imported after "gi"
Product: Red Hat Enterprise Linux 7 Reporter: Petr Viktorin (pviktori) <pviktori>
Component: pygobject2Assignee: Matthew Barnes <mbarnes>
Status: CLOSED WONTFIX QA Contact: Desktop QE <desktop-qa-list>
Severity: low Docs Contact:
Priority: low    
Version: 7.5CC: cww, mclasen, mzalewsk, tpelka
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2019-10-28 08:44:32 UTC Type: Bug
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:    
Bug Blocks: 1115589, 1727111    

Description Petr Viktorin (pviktori) 2017-10-25 10:06:12 UTC
The modules "gio" (from pygobject2) and "gi" (from python-gobject-base) are incompatible. They should not be loaded in the same interpreter, as shown in gi's error message:

    $ python
    >>> import gio
    >>> import gi
    Traceback (most recent call last):
      ...
    ImportError: When using gi.repository you must not import static modules like "gobject". Please change all occurrences of "import gobject" to "from gi.repository import GObject".

However, when these modules are imported in the *opposite* order, there is only a warning logged to stderr:

    $ python
    >>> import gi
    >>> import gio
    /usr/lib64/python2.7/site-packages/gobject/constants.py:24: Warning: g_boxed_type_register_static: assertion 'g_type_from_name (name) == 0' failed
      import gobject._gobject

Further use of gi/gio can lead to segmentation faults (e.g. loading the gtk module, as in bug #1115589 )

Can a hard ImportError be added for this case to gio as well?


Version-Release number of selected component (if applicable):

pygobject2-2.28.6-11.el7.x86_64
python-gobject-base-3.22.0-1.el7.x86_64
(On CentOS; I'll test on RHEL if needed)


Steps to Reproduce:

# python
>>> import gi
>>> import gio

Actual results:

/usr/lib64/python2.7/site-packages/gobject/constants.py:24: Warning: g_boxed_type_register_static: assertion 'g_type_from_name (name) == 0' failed
  import gobject._gobject


Expected results:

ImportError

Comment 2 Charalampos Stratakis 2017-11-06 10:59:48 UTC
*** Bug 1507975 has been marked as a duplicate of this bug. ***