Bug 91561 - Nested class in waflib/Context.py causes pickle exception during build
Summary: Nested class in waflib/Context.py causes pickle exception during build
Status: RESOLVED DUPLICATE of bug 76759
Alias: None
Product: pycairo
Classification: Unclassified
Component: general (show other bugs)
Version: unspecified
Hardware: All Linux (All)
: medium critical
Assignee: Steve Chaplin
QA Contact:
Depends on:
Reported: 2015-08-04 21:22 UTC by Barry Warsaw
Modified: 2017-07-05 15:00 UTC (History)
1 user (show)

See Also:
i915 platform:
i915 features:

Move node_class to the module globals so it can be pickled. (472 bytes, text/plain)
2015-08-04 21:22 UTC, Barry Warsaw

Description Barry Warsaw 2015-08-04 21:22:54 UTC
Created attachment 117532 [details]
Move node_class to the module globals so it can be pickled.

In Debian/Ubuntu, we are building py3cairo 1.10.0.  With the transition to Python 3.5 currently ongoing in Ubuntu, a build failure has surfaced which actually affects Python 3.4 and 3.5, although we've only just noticed it.

The problem is that in waflib/Context.py, the Context class has a node_class nested inside the __init__.py.  Inside the __init__() it assigns this class to the self.node_class attribute.  The build process attempts to pickle the Context instance, but this nested class breaks that because it cannot be pickled.  Python cannot pickle classes which are nested inside methods because they cannot be unpickled; Python can't look up the class when it comes to unpickling it.  I'm rather surprised this ever built correctly.

The fix I'm applying for Ubuntu (and eventually Debian) is rather simple.  There's no obvious reason why node_class has to be nested inside __init__(), so I just moved it to being a module global.

See attached patch.
Comment 1 Barry Warsaw 2015-08-05 00:10:48 UTC
For some reason which I don't yet understand, this patch only fixed the py3cairo build on some, but not all platforms.


It looks like we're still getting similar failures for arm64, powerpc, and ppc64el:




I clearly have to better understand why this pickling is done, and why it would be different on different platform builds.

If you can provide insights, please get in touch!
Comment 2 Barry Warsaw 2015-08-05 22:08:27 UTC
This patch probably doesn't work correctly anyway.  After much pdb'ing I still don't understand how this is failing.
Comment 3 David H. Gutteridge 2015-12-12 07:27:36 UTC
This appears to be a duplicate of bug 76759. Probably both don't need to be open.
Comment 4 Christoph Reiter 2017-07-05 15:00:00 UTC
Since 1.11 pycairo uses distutils for building. If there are any problems with the new system please file a bug: https://github.com/pygobject/pycairo/issues

*** This bug has been marked as a duplicate of bug 76759 ***

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.