Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 548718 - dev-python/pycparser-2.11: TypeError: cannot create weak reference to 'Struct' object
Summary: dev-python/pycparser-2.11: TypeError: cannot create weak reference to 'Struct...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal major (vote)
Assignee: Python Gentoo Team
URL:
Whiteboard:
Keywords:
: 549410 (view as bug list)
Depends on:
Blocks:
 
Reported: 2015-05-05 20:47 UTC by Antoine Lemoine
Modified: 2015-05-17 19:29 UTC (History)
5 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Antoine Lemoine 2015-05-05 20:47:01 UTC
I am unable to use portage, layman, pip, python-updater and other programs due to a python (?) error. The error seems to be linked to OpenSSL.

Reproducible: Always

Steps to Reproduce:
1. emerge --info
Actual Results:  
Traceback (most recent call last):
  File "/usr/lib/python-exec/python2.7/emerge", line 44, in <module>
    from _emerge.main import emerge_main
  File "/usr/lib/python2.7/site-packages/_emerge/main.py", line 23, in <module>
    from portage.sync import _SUBMODULE_PATH_MAP
  File "/usr/lib/python2.7/site-packages/portage/sync/__init__.py", line 21, in <module>
    module_controller = Modules(path=path, namepath="portage.sync.modules")
  File "/usr/lib/python2.7/site-packages/portage/module.py", line 84, in __init__
    self._modules = self._get_all_modules()
  File "/usr/lib/python2.7/site-packages/portage/module.py", line 109, in _get_all_modules
    new_module = Module(entry, self._namepath)
  File "/usr/lib/python2.7/site-packages/portage/module.py", line 30, in __init__
    self.initialized = self._initialize()
  File "/usr/lib/python2.7/site-packages/portage/module.py", line 40, in _initialize
    self._module = __import__(mod_name, [], [], ["not empty"])
  File "/usr/lib/python2.7/site-packages/portage/sync/modules/laymansync/__init__.py", line 14, in <module>
    import layman
  File "/usr/lib/python2.7/site-packages/layman/__init__.py", line 13, in <module>
    from layman.api import LaymanAPI
  File "/usr/lib/python2.7/site-packages/layman/api.py", line 25, in <module>
    from layman.remotedb        import RemoteDB
  File "/usr/lib/python2.7/site-packages/layman/remotedb.py", line 46, in <module>
    from   sslfetch.connections     import Connector
  File "/usr/lib/python2.7/site-packages/sslfetch/connections.py", line 39, in <module>
    import requests
  File "/usr/lib/python2.7/site-packages/requests/__init__.py", line 53, in <module>
    from .packages.urllib3.contrib import pyopenssl
  File "/usr/lib/python2.7/site-packages/requests/packages/urllib3/contrib/pyopenssl.py", line 53, in <module>
    import OpenSSL.SSL
  File "/usr/lib/python2.7/site-packages/OpenSSL/__init__.py", line 8, in <module>
    from OpenSSL import rand, crypto, SSL
  File "/usr/lib/python2.7/site-packages/OpenSSL/rand.py", line 11, in <module>
    from OpenSSL._util import (
  File "/usr/lib/python2.7/site-packages/OpenSSL/_util.py", line 3, in <module>
    from cryptography.hazmat.bindings.openssl.binding import Binding
  File "/usr/lib/python2.7/site-packages/cryptography/hazmat/bindings/openssl/binding.py", line 60, in <module>
    class Binding(object):
  File "/usr/lib/python2.7/site-packages/cryptography/hazmat/bindings/openssl/binding.py", line 109, in Binding
    libraries=_get_libraries(sys.platform)
  File "/usr/lib/python2.7/site-packages/cryptography/hazmat/bindings/utils.py", line 97, in build_ffi_for_binding
    extra_link_args=extra_link_args,
  File "/usr/lib/python2.7/site-packages/cryptography/hazmat/bindings/utils.py", line 106, in build_ffi
    ffi.cdef(cdef_source)
  File "/usr/lib/python2.7/site-packages/cffi/api.py", line 106, in cdef
    self._parser.parse(csource, override=override, packed=packed)
  File "/usr/lib/python2.7/site-packages/cffi/cparser.py", line 165, in parse
    self._internal_parse(csource)
  File "/usr/lib/python2.7/site-packages/cffi/cparser.py", line 184, in _internal_parse
    self._parse_decl(decl)
  File "/usr/lib/python2.7/site-packages/cffi/cparser.py", line 256, in _parse_decl
    self._get_struct_union_enum_type('struct', node)
  File "/usr/lib/python2.7/site-packages/cffi/cparser.py", line 434, in _get_struct_union_enum_type
    return self._structnode2type[type]
  File "/usr/lib/python2.7/weakref.py", line 315, in __getitem__
    return self.data[ref(key)]
TypeError: cannot create weak reference to 'Struct' object
Comment 1 Antoine Lemoine 2015-05-05 21:10:04 UTC
The error is knows and appears after the installation of pycparser-2.11.
According to https://bugs.launchpad.net/openstack-gate/+bug/1446882 the solution is to downgrade pycparser to 2.10 version.
Comment 2 Antoine Lemoine 2015-05-05 21:57:54 UTC
Maybe this is not the right place to ask a question, but it may help people in the same situation: 
How can I downgrade a package without emerge, ebuild or a similar tool?
Comment 3 PaX Team 2015-05-05 22:22:38 UTC
as a quick fix just manually edit /usr/lib64/python2.7/site-packages/pycparser/c_ast.py to look like this (line numbers shown just for context):

 22 class Node(object):
 23     __slots__ = ('__weakref__',)
 24     """ Abstract base class for AST nodes.

this is basically commit https://github.com/markrwilliams/pycparser/commit/5298fd85018735462bdc037b47a62ce0fc5164d7 applied by hand.
Comment 4 Mike Gilbert gentoo-dev 2015-05-06 00:25:41 UTC
It sounds like you have app-portage/layman[sync-plugin-portage] installed, and that is breaking portage installation due to this issue.
Comment 5 Mike Gilbert gentoo-dev 2015-05-06 00:51:10 UTC
Thanks for the report, and sorry for the breakage.

You may also be able to work around this by running emerge using python3.

+*pycparser-2.12 (06 May 2015)
+
+  06 May 2015; Mike Gilbert <floppym@gentoo.org> +pycparser-2.12.ebuild,
+  -pycparser-2.11.ebuild:
+  Version bump, should fix bug 548718.
Comment 6 Kobboi 2015-05-06 06:59:23 UTC
I had a pycparser-2.10.tbz2 lying around (long live binary packages) and just extracted that over /. I had to do something, you have no idea how broken my system was :/
Comment 7 Brian Dolbec (RETIRED) gentoo-dev 2015-05-06 07:27:33 UTC
I've reworked the laymansync plugin so that this type of problem would only affect an actual sync, not any other emerge operation.

Also, this problem is only affecting py2.7. Layman running in py-3.3, 3.4 do not make use of this pkg.
Comment 8 tot-to 2015-05-17 19:29:03 UTC
*** Bug 549410 has been marked as a duplicate of this bug. ***