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
improved print_constant #1120
improved print_constant #1120
Conversation
Is this PR ready for its initial review or is it still in draft status? Both are indicated at the moment |
i was explaining to the new interns something and i forgot it my bad. |
@bauom what is the status of this PR? |
sorry i have totally forgotten about this PR i will fix it ASAP. |
@EmilyBourne
|fatal [syntax]: epyccel.py [29,11]| Pyccel has encountered syntax that has not been implemented yet. Please create an issue at https://github.com/pyccel/pyccel/issues and provide a small example of your problem. Do not forget to specify your target language (.join) i used this code to run it with
ERROR at shared library generation stage
Traceback (most recent call last):
File "/home/bauom/dev/sandbox/test.py", line 15, in <module>
test_pi('c')
File "/home/bauom/dev/sandbox/test.py", line 12, in test_pi
pf = epyccel(f, language=language)
File "/home/bauom/dev/pyccel/pyccel/epyccel.py", line 333, in epyccel
mod, fun = epyccel_seq( python_function_or_module, **kwargs )
File "/home/bauom/dev/pyccel/pyccel/epyccel.py", line 168, in epyccel_seq
execute_pyccel(pymod_filename,
File "/home/bauom/dev/pyccel/pyccel/codegen/pipeline.py", line 386, in execute_pyccel
generated_filepath = create_shared_library(codegen,
File "/home/bauom/dev/pyccel/pyccel/codegen/python_wrapper.py", line 135, in create_shared_library
wrapper_compiler.compile_module(wrapper_compile_obj,
File "/home/bauom/dev/pyccel/pyccel/codegen/compiling/compilers.py", line 305, in compile_module
self.run_command(cmd, verbose)
File "/home/bauom/dev/pyccel/pyccel/codegen/compiling/compilers.py", line 429, in run_command
raise RuntimeError(err_msg)
RuntimeError: Failed to build module
/home/bauom/dev/sandbox/__epyccel__/__pyccel__/mod_l2hcaikn18un_l2hcaikn18un_wrapper.c: In function ‘ret_pi_wrapper’:
/home/bauom/dev/sandbox/__epyccel__/__pyccel__/mod_l2hcaikn18un_l2hcaikn18un_wrapper.c:30:10: error: lvalue required as left operand of assignment
30 | M_PI = ret_pi();
| ^
/home/bauom/dev/sandbox/__epyccel__/__pyccel__/mod_l2hcaikn18un_l2hcaikn18un_wrapper.c:31:33: error: lvalue required as unary ‘&’ operand
31 | pi_tmp = Double_to_PyDouble(&M_PI);
| ^
/home/bauom/dev/sandbox/__epyccel__/__pyccel__/mod_l2hcaikn18un_l2hcaikn18un_wrapper.c:20:12: warning: unused variable ‘pi’ [-Wunused-variable]
20 | double pi;
| ^~ |
There is no difference between I'm not sure about the second half though, it looks like you named a variable |
those are two file different def ret_pi():
from math import pi
return pi I think there is a problem when we try to return a constant value that is an import but i am not sure if these are known issues. |
This is not a known problem. It is really weird!! We definitely need an issue for this |
I will create an issue for this not sure if these are 2 issues different or the same problem that cause different effects. |
I'm looking into it. It looks like the error is caused by the results of the FunctionDef at the syntactic stage |
Hello! Welcome to Pyccel! Thank you very much for your contribution ❤️. I am the GitHub bot. I will help guide you through the different stages necessary to validate a review in Pyccel. If you haven't yet seen our developer docs make sure you check them out here. Amongst other things they describe the review process that we have just started. You can also get in touch with our other developers on our Pyccel Discord Server. To begin with I will give you a short checklist to make sure your pull request is complete. Please tick items off when you have completed them or determined that they are not necessary for this pull request. If you want me to run any specific tests to check out corner cases that you can't easily check on your computer, you can request this using the command Here is your checklist:
|
@bauom Yearly reminder about the existence of this PR ;) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good job ! Your PR is using all the code it added/changed.
Hey @pyccel/pyccel-dev ! @bauom has just created this great new pull request! Check it out and let me know what you think! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approved. Looks good to merge
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good job ! Your PR is using all the code it added/changed.
Hey @yguclu, @EmilyBourne, this PR is looking pretty good. @bauom and @smazouz42 think it is ready to merge. Could you add your expertise to confirm that this follows all the coding conventions and fits in Pyccel's future plans? Thanks 😄 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am ok with this PR as is. Some of the work will be superceded in #1811 so it is not critical if it is not perfect.
However I finished cleaning it up so it is still missing a senior review.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me. I just have one question.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good job ! Your PR is using all the code it added/changed.
Print unknown constants using their values. This fixes pyccel#1047 but may be reverted in pyccel#1811 to prefer declaring constants with names. However this PR also adds support for `NaN` in C and an associated test. It also removes the duplicate `_print_Constant` function. --------- Co-authored-by: EmilyBourne <louise.bourne@gmail.com>
Print unknown constants using their values. This fixes #1047 but may be reverted in #1811 to prefer declaring constants with names. However this PR also adds support for
NaN
in C and an associated test. It also removes the duplicate_print_Constant
function.