diff options
author | Eli Bendersky <eliben@gmail.com> | 2015-04-21 17:04:53 -0700 |
---|---|---|
committer | Eli Bendersky <eliben@gmail.com> | 2015-04-21 17:04:53 -0700 |
commit | 978ad7a61d7e1cfe77dbacb81f1690e6bb89a11b (patch) | |
tree | 4ab6b9e94950df6f24cc089f6e886d8f13ebeb9c /pycparser/_ast_gen.py | |
parent | 40af8bdaf34f42c488ea45f98b40c951250bc6d1 (diff) | |
download | pycparser-978ad7a61d7e1cfe77dbacb81f1690e6bb89a11b.tar.gz |
Support weakref to AST objects.
weakref support was broken by setting __slots__ on AST objects to conserve
memory.
Reinstate it. See issue #76, #75
Diffstat (limited to 'pycparser/_ast_gen.py')
-rw-r--r-- | pycparser/_ast_gen.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/pycparser/_ast_gen.py b/pycparser/_ast_gen.py index 654fad6..ddbfd67 100644 --- a/pycparser/_ast_gen.py +++ b/pycparser/_ast_gen.py @@ -93,10 +93,10 @@ class NodeCfg(object): if self.all_entries: args = ', '.join(self.all_entries) slots = ', '.join("'{0}'".format(e) for e in self.all_entries) - slots += ", 'coord'" + slots += ", 'coord', '__weakref__'" arglist = '(self, %s, coord=None)' % args else: - slots = "'coord'," + slots = "'coord', '__weakref__'" arglist = '(self, coord=None)' src += " __slots__ = (%s)\n" % slots |