Opened 2 years ago

Closed 2 years ago

#5790 defect closed fixed (fixed)

threads_init not always present in gi bindings

Reported by: itamar Owned by: itamar
Priority: normal Milestone:
Component: core Keywords:
Cc: jesstess Branch:
Author: itamarst Launchpad Bug:

Description

Jessica reported the following:

$ python -c "import twisted; print twisted.__version__; from twisted.internet import gtk3reactor"
 12.0.0+r34756
 Traceback (most recent call last):
   File "<string>", line 1, in <module>
   File "twisted/internet/gtk3reactor.py", line 22, in <module>
     from twisted.internet import gireactor
   File "twisted/internet/gireactor.py", line 53, in <module>
     _oldGiInit()
   File "twisted/internet/gireactor.py", line 42, in _oldGiInit
     GLib.threads_init()
   File "/usr/lib/python2.7/dist-packages/gi/module.py", line 268, in __getattr__
     return getattr(self._introspection_module, name)
   File "/usr/lib/python2.7/dist-packages/gi/module.py", line 101, in __getattr__
     self.__name__, name))
 AttributeError: 'gi.repository.GLib' object has no attribute 'threads_init'

Change History (6)

comment:1 Changed 2 years ago by itamar

  • Cc jesstess added

What OS was this? What version of pygobject?

comment:2 Changed 2 years ago by jesstess

This is Ubuntu Natty:

$ apt-cache show python-gobject | grep Version
Version: 2.28.3-1ubuntu1
Version: 2.28.3-1ubuntu1.1
$ uname -a
Linux kid-charlemagne 2.6.38-13-generic #53-Ubuntu SMP Mon Nov 28 19:33:45 UTC 2011 x86_64 x86_64 x86_64 GNU/Linux
$ cat /etc/issue
Ubuntu 11.04 \n \l

comment:3 Changed 2 years ago by itamar

AFAICT it just doesn't exist in that version. hasattr() time!

comment:4 Changed 2 years ago by itamarst

  • Author set to itamarst
  • Branch set to branches/old-gi-5790

(In [35156]) Branching to 'old-gi-5790'

comment:5 Changed 2 years ago by itamar

  • Branch branches/old-gi-5790 deleted

I will do this as part of #5676, since otherwise the fixes will conflict.

comment:6 Changed 2 years ago by itamarst

  • Resolution set to fixed
  • Status changed from new to closed

(In [35285]) Merge pygtkcompat-5676: Better support for newer and older gi versions.

Author: itamar
Review: jesstess
Fixes: #5676, #5790

Work with old versions of gi that didn't wrap enable_threads(), and with newer versions that have the gi.pygtkcompat compatability layer.

Note: See TracTickets for help on using tickets.