[pypy-svn] r44136 - pypy/branch/kill-ctypes/pypy/rpython/lltypesystem
arigo at codespeak.net
arigo at codespeak.net
Mon Jun 11 13:51:54 CEST 2007
Author: arigo
Date: Mon Jun 11 13:51:54 2007
New Revision: 44136
Modified:
pypy/branch/kill-ctypes/pypy/rpython/lltypesystem/rffi.py
Log:
Minor: avoid mutating the incoming dictionary kwds['hints'] in-place.
Modified: pypy/branch/kill-ctypes/pypy/rpython/lltypesystem/rffi.py
==============================================================================
--- pypy/branch/kill-ctypes/pypy/rpython/lltypesystem/rffi.py (original)
+++ pypy/branch/kill-ctypes/pypy/rpython/lltypesystem/rffi.py Mon Jun 11 13:51:54 2007
@@ -47,12 +47,13 @@
""" A small helper to create external C structure, not the
pypy one
"""
- if 'hints' not in kwds:
- kwds['hints'] = {}
- kwds['hints']['external'] = 'C'
- kwds['hints']['c_name'] = name
- # XXX obscure hack, stolen for unknown reason from ctypes,
- # probably because of _ attributes
+ hints = kwds.get('hints', {})
+ hints = hints.copy()
+ kwds['hints'] = hints
+ hints['external'] = 'C'
+ hints['c_name'] = name
+ # Hack: prefix all attribute names with 'c_' to cope with names starting
+ # with '_'. The genc backend removes the 'c_' prefixes...
c_fields = [('c_' + key, value) for key, value in fields]
return lltype.Ptr(lltype.Struct(name, *c_fields, **kwds))
More information about the Pypy-commit
mailing list