Bug 342730 - Make it able to run python code with comments
Summary: Make it able to run python code with comments
Status: RESOLVED FIXED
Alias: None
Product: cantor
Classification: Applications
Component: python2-backend (show other bugs)
Version: unspecified
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: Filipe Saraiva
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-01-11 13:02 UTC by Minh Ngo
Modified: 2015-01-13 19:50 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Minh Ngo 2015-01-11 13:02:40 UTC
Currently this code can be run:
print(1 + 2) #some comment,

but this one will return an error:

#some comment
print(1 + 2)

Comments are important part for the code, and it will be nice to make it runnable too with code.

Reproducible: Always

Steps to Reproduce:
1. print:
#some comment
print(1 + 2)
2. and try to run this code

Actual Results:  
Error

Expected Results:  
3

I will work on this problem :)
Comment 1 Filipe Saraiva 2015-01-12 08:38:13 UTC
Hum, you can to run it in previous stable Cantor version. I will review your patch.
Comment 2 Minh Ngo 2015-01-12 08:40:42 UTC
Not sure, doesn't work with the stable release of Cantor in Fedora 20 at least.

Anyway, I have added unit tests to be sure that it didn't work.
Comment 3 Minh Ngo 2015-01-13 19:50:13 UTC
Git commit c81c2f71fe134f652fef3aca83733d79556f875c by Minh Ngo.
Committed on 13/01/2015 at 19:44.
Pushed by minhngo into branch 'frameworks'.

Makes it able to run python code with comments & a bit of refactoring.
REVIEW: 122005

M  +33   -21   src/backends/python/pythonsession.cpp
M  +21   -4    src/backends/python2/testpython2.cpp
M  +3    -3    src/backends/python2/testpython2.h

http://commits.kde.org/cantor/c81c2f71fe134f652fef3aca83733d79556f875c