-
Notifications
You must be signed in to change notification settings - Fork 164
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement input(prompt)
#2655
base: main
Are you sure you want to change the base?
Implement input(prompt)
#2655
Conversation
@Shaikh-Ubaid , there is a small issue occurring here. Because we are directing calls to name: str = input("Your name: ")
print("Hello,", name) gives the following output (base) saurabh-kumar@Awadh:~/Projects/System/lpython$ ./src/bin/lpython ./examples/example.py
Your name: Segmentation fault (core dumped) I request you to see if the implementation is correct. Instead of a separate function |
@kmr-srbh the following works: % cat examples/expr2.py
name: str = " "
name = input("Your name: ")
print("Hello,", name)
% python examples/expr2.py
Your name: John
Hello, John
% lpython examples/expr2.py
Your name: John
Hello,John We just needed |
We need to see what other better alternative approaches can be for the workaround (for |
You are right @Shaikh-Ubaid. How do we go about working a fix for the return type issue? This is a real problem. I am new to this area of the code-base and learning. |
Let's modify the semantics of the FileRead ASR node: if the "value" expr argument is an allocatable string, then the backend (LLVM/WASM, etc.) implementation of the FileRead node will allocate the string to hold the whole input, and assign it to it. |
@certik Do you mean handling lpython/src/libasr/codegen/asr_to_llvm.cpp Lines 7493 to 7510 in fce0b35
|
No description provided.