Due to my cousin’s wedding this weekend I will be missing the talks section of the Desktop Summit but will be in Berlin during the BOFs to attend the GObject Introspection hackfest.
[read this post in:
ar de es fr it ja ko pt ru zh-CN ]
Comments Off
I would like to thank everyone who came and hacked at the PyGObject hackfest, thank the GNOME Foundation Board for supporting us, Collabora for sponsoring us and Brmlab for hosting us. I would also like to give a big thanks to Tomeu for showing us true Prague hospitality (besides being a super hacker). I was a bit distracted the last day of the hackfest because of a small scare that ended up with me cancelling the talk I was going to give and rushing off to two Prague hospitals. I hope I didn’t worry everyone too much as it turned out to be a minor issue that was taken care of with some antibiotics. Tomeu was key in getting me where I needed to go.
A hundred things were going through my head as I had never had medical issues while being abroad – should I wait for my flight back home in three days, should I get emergency tickets back home, how much would it cost to go to a local hospital? Luckily my doctors office has web apps set up so I could securely be in communication with them while I was deciding what to do. I found out my insurance company would cover me though as it ended up Prague hospital care was a little more than what my copay would be. it all worked out in the end.
I promised the board to write-up a how-to on setting up a successful hackfest. I believe I will add a section on handling issues that may come up. We should have a policy of listing emergency information on the wiki of events we hold, including the closest places to seek care and approximate costs for travellers abroad. It is important to keep out guests safe and make them feel comfortable when they take time to help make GNOME better.
[read this post in:
ar de es fr it ja ko pt ru zh-CN ]
Comments Off
The hackfest is over and a lot of things got fixed but unfortunately Python3 support was broken. I just committed a couple of patches to fix this. Here are some things PyGObject developers should look out for. When I note to only use something in tests it means that there is a compat module that is only available to the tests. Actual code should either add the workaround to the top of their module or try not to have a distinction between things such as unicode and longs which no longer exist in Python 3.
- use range instead of xrange – loss of performance in Python 2 but Python 3 treats range similarly to python 2’s xrange
- use dict.items() instead of dict.iteritems() – same as the xrange issue
- callable does not exist in 3.x, use hasattr(obj, ‘__call__’) or
if sys.version_info > (3, 0):
def callable(obj):
return hasattr(obj, '__call__')
- using unicode in tests is tricky, you can’t use u” even in a versioned conditional as python3’s parser chokes on it. Do this in tests (and only i
in tests):
from compathelper import _unicode
unicode_string = _unicode('this is a unicode string')
- exception caching changed in 2.7, instead of except Exception, e we now use except Exception as e. Do this to be compatible with older versions:
except Exception:
etype, e = sys.exc_info()[:2]
- Unbound methods with an im_func attribute no longer exits in 3.x. Unbound methods are now just functions so class.method in 3.x is equivalent to class.method.im_func in 2.x. If you have to go this low level do this:
func = class.method
if sys.version_info < (3,0):
func = func.im_func
Update: It was pointed out to me that this can be expressed as a simple getattr triple:
getattr(class.method, 'im_func', class.method)
- all numbers are long in 3.x so 42L is invalid in 3.x. In tests (and only in tests) do this:
from compathelper import _long
l = _long(42)
[read this post in: ar de es fr it ja ko pt ru zh-CN ]