Giter Club home page Giter Club logo

Comments (4)

mratsim avatar mratsim commented on August 16, 2024

After adding some debug comments (completely new to the codebase)

I get the following trace:

CPU.PY: printf("hello world %f\n", i)
<_ast.Expr object at 0x7ff230b7f550>
<bound method CPPUnparser._Expr of <dace.codegen.cppunparse.CPPUnparser object at 0x7ff230a4bdc0>> - <_ast.Expr object at 0x7ff230b7f550>
<bound method CPPUnparser._Call of <dace.codegen.cppunparse.CPPUnparser object at 0x7ff230a4bdc0>> - <_ast.Call object at 0x7ff230b7f5e0>
<bound method CPPUnparser._Name of <dace.codegen.cppunparse.CPPUnparser object at 0x7ff230a4bdc0>> - <_ast.Name object at 0x7ff230b7f670>
<bound method CPPUnparser._Constant of <dace.codegen.cppunparse.CPPUnparser object at 0x7ff230a4bdc0>> - <_ast.Constant object at 0x7ff230b7f6a0>
<bound method CPPUnparser._Name of <dace.codegen.cppunparse.CPPUnparser object at 0x7ff230a4bdc0>> - <_ast.Name object at 0x7ff230b7f760>
result:     printf('hello world %f\n', i);

I expect at one point, the dispatch should have been _Str which contain a replacement line for Python mis-quotes:

def _Str(self, tree, infer_type=False):
result = ''
if six.PY3:
result = repr(tree.s)
else:
# if from __future__ import unicode_literals is in effect,
# then we want to output string literals using a 'b' prefix
# and unicode literals with no prefix.
if "unicode_literals" not in self.future_imports:
result = repr(tree.s)
elif isinstance(tree.s, str):
result = "b" + repr(tree.s)
elif isinstance(tree.s, unicode):
result = repr(tree.s).lstrip("u")
else:
assert False, "shouldn't get here"
self.write(result.replace('\'', '\"'), infer_type)
return dace.pointer(dace.int8) if infer_type else None

from dace.

tbennun avatar tbennun commented on August 16, 2024

Thanks for reporting. The issue is related to Python 3.8. Your trace is helpful! You can see it detects _Constant instead of _Str, which was not using the replacement. It is now refactored in #87 to _write_constant and other cases have been fixed as well.

from dace.

tbennun avatar tbennun commented on August 16, 2024

@mratsim please let me know if the issue is fixed in the latest master for you.

from dace.

mratsim avatar mratsim commented on August 16, 2024

Confirmed working, thanks.

from dace.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.