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
Magic %paste error #1258
Comments
Yup, confirmed. Swamped right now, but we definitely need this one fixed, along with an added test... Thanks for the report! |
The line that is triggering the problem is the |
Normally we only run prefilter when the input is a single line. Is there a good reason we use it on multiline code for %paste? |
On Thu, Jan 12, 2012 at 1:53 PM, Thomas
Well, we still want magics and such to work in pasted blocks. |
Of course. But we could use inputsplitter, as we do for multiline cells. It just means automagics ( |
On Thu, Jan 12, 2012 at 4:14 PM, Thomas
Ah, we most certainly should be doing that! It's probably then that |
For that matter, we should probably unify inputsplitter and prefilter, as they now do largely equivalent things (since inputsplitter is no longer responsible for actually splitting input). |
On Thu, Jan 12, 2012 at 5:18 PM, Thomas
Yes, a cleanup on this front would be great. It's important that we maintain an entry point for users to provide |
@takluyver, do you want to tackle this one? I'm kind of triaging what's realistic for 0.13, and this one is indeed a bit of a nasty bug, but there's only so much we'll be able to chew before release... |
I'll have a look, but it may be that it needs to wait for a proper refactoring of prefilter & inputsplitter, which I guess would be post 0.13. |
OK, thanks. I'll leave it to you then: if you decide not to tackle it soon, then go ahead and remove the milestone marker on it so that it doesn't appear for 0.13. It would be great to have this cleaned up, bug given how going deep into that machinery is potentially very disruptive, the wiser course of action may just be to wait so we don't break something critical just prior to release. |
Another case where this can bite you is the % magic syntax:
|
BTW, I'm working on this one... Just pinging here so nobody starts at the same time and we don't repeat work. |
As indicated by @jseabold on the mailing list: I am able to reproduce this with the latest master. Can anyone Ie., this code
if copied and pasted into the IPython interpreter via paste looks like this
I need to add a test for this as well... |
OK folks, I'd greatly appreciate a review of #2015 now. I'm not willing to admit in public how long it took me to code this, it proved to be quite tricky and I kept stumbling on odd edge cases. But the code is now well tested and does fix a pretty broken Hence my plea for review :) @wesm, let me know if #2015 indeed fixes all the problem cases you'd found... |
FWIW, this fixes the issues I was seeing. Thanks. |
Great, glad to hear that @jseabold, thanks for the feedback! I'll leave it in case @takluyver has a chance to review it tomorrow, but if he can't make it we'll merge it for sure; your data point helps cement that decision. |
Fixes for %paste with special transformations. Fix the fact that we use prefilter too aggressively in `%paste`, which results in applying single-line transformations inside of strings and function definitions. Closes ipython#1258.
This requires applying email quote removal, input splitting and prefiltering of all single-line inputs in a fairly careful manner. New method `clean_input` was added to the terminal magics to implement this logic in an isolated and easy to test place. Closes ipython#1258.
Fixes for %paste with special transformations. Fix the fact that we use prefilter too aggressively in `%paste`, which results in applying single-line transformations inside of strings and function definitions. Closes ipython#1258.
off git master
The text was updated successfully, but these errors were encountered: