question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

`async with` doesn't allow newlines

See original GitHub issue

When writing a with statement, pressing enter goes onto a new line, rather than immediately running the code:

In [26]: with example:
    ...:     do_1()[enter]
    ...:     [<-pointer goes here]

However, when using async with, this does not apply to any lines except for the first after the colon:

In [26]: async with example:
    ...:     do_1()[enter]
[code is run]

(Tested in latest PyPI: IPython.__version__ == "7.23.1")

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
Carreaucommented, Jan 10, 2022

Yes you are right, test were not properly added in previous fix, I just made #13436 that should fix it.

0reactions
hrmorley34commented, Jan 9, 2022

I’ve just come back to this issue, and it doesn’t seem to be fixed; I’ve tested with IPython 7.31.0 in Python 3.8.10, 3.9.9, and 3.10.1, with IPython 7.28.0 (when the backport was introduced) in Python 3.10.1, and with IPython 8.0.0.dev (pip install git+https://github.com/ipython/ipython) in Python 3.10.1; all of these versions have the same problem as in the original example.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Fix: `async with` doesn't allow newlines (ipython ... - GitHub
I'm wondering if the regexp is the best way to check for async await. I believe the re are flags for compile commands,...
Read more >
How to async read new lines from logfiles when written in ...
I'm using the aiofile module for reading the file async, but the seek in this module only takes one argument so seeking end...
Read more >
How to handle file names containing backslash or newline in ...
Answer. Overview. Aspera transfer and sync subsystems do not allow file names containing backslash and newlines. These characters are legal ...
Read more >
Async - Fullstack Node.js
The core fs module has methods that allow us to interact with the filesystem. Most often we'll use this to read and write...
Read more >
Asynchronous file access (C#) - Microsoft Learn
Learn how to use the async feature to access files in C#. You can call into asynchronous methods without using callbacks or splitting...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found