inducer / inducer/pycparserext

TypeError: _generate_type() got an unexpected keyword argument 'emit_declname'

Open
#48 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
91
Forks
30
PR merge metrics
No merged PRs in 30d

Description

I am using `pycparserext` to parse, edit and then re-generate OpenCL kernels. During the re-generation phase, with some kernels, I get the following error:
```
File "/test.py", line 131, in instrument_file
f.write(gen.visit(ast))
File "/env/lib/python3.7/site-packages/pycparser/c_generator.py", line 28, in visit
return getattr(self, method, self.generic_visit)(node)
File "/env/lib/python3.7/site-packages/pycparserext/ext_c_generator.py", line 155, in visit_FileAST
s += self.visit(ext)
File "/env/lib/python3.7/site-packages/pycparser/c_generator.py", line 28, in visit
return getattr(self, method, self.generic_visit)(node)

... (long list of calls here) ...

File "/env/lib/python3.7/site-packages/pycparser/c_generator.py", line 122, in visit_Cast
s = '(' + self._generate_type(n.to_type, emit_declname=False) + ')'
TypeError: _generate_type() got an unexpected keyword argument 'emit_declname'
```
This error happens only when a call to `visit_Cast` occurs somewhere along the way.
Whats more, the only place where `pycparserext` is being used (and not `pycparser`) seems to be the second call in the trace above. Note that `gen` comes from `pycparserext`. From somewhere near the start of my script:
```
from pycparserext.ext_c_generator import OpenCLCGenerator
...
gen = OpenCLCGenerator()
```
It seems to me that **your** `_generate_type()` is called and not the one from `pycparser`, despite the fact that the trace says otherwise, given that it is the implementation of `_generate_type()` from `pycparserext` (and not from `pycparser`) that does not have the keyword argument `emit_declname`.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.