<feed xmlns='http://www.w3.org/2005/Atom'>
<title>llvm-project.git/lldb/test/Shell/ScriptInterpreter/Python/python.test, branch users/meinersbur/flang_runtime_split-headers</title>
<subtitle>Unnamed repository; edit this file 'description' to name the repository.
</subtitle>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/'/>
<entry>
<title>Fix `script -lpython` to handle control flow in one-line commands.</title>
<updated>2022-06-16T05:20:48+00:00</updated>
<author>
<name>Dave Lee</name>
<email>davelee.com@gmail.com</email>
</author>
<published>2022-06-16T05:08:21+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=e9349ef9e6d83aa8900b5e534f1d15fb4d44a33c'/>
<id>e9349ef9e6d83aa8900b5e534f1d15fb4d44a33c</id>
<content type='text'>
The fix is to append a newline to the source being evaluated.

Without this patch, the following commands **print no output, no errors**.

```
(lldb) script if "foo" in lldb.frame.name: print(lldb.thread)
(lldb) script for f in lldb.thread: print(f.name)
```

The issue is with `code.InteractiveConsole.runsource()`. A trailing newline is
needed for these expressions to be evaluated. I don't know why this is, the
docs don't mention anything.

From a python repl, the following samples show that a terminal newline allows
statements containing flow control to fully execute.

```
&gt;&gt;&gt; import code
&gt;&gt;&gt; repl = code.InteractiveConsole()
&gt;&gt;&gt; repl.runsource("if True: print(1)")
True
&gt;&gt;&gt; repl.runsource("if True: print(1)\n")
1
False
```

Notes:

From an interactive python repl, the output is not printed immediately. The
user is required to enter a blank line following the first.

```
&gt;&gt;&gt; if True: print(1)
...
1
```

However, `python -c 'if True: print(1)'` works without needing a newline.

Reviewed By: JDevlieghere

Differential Revision: https://reviews.llvm.org/D127586
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The fix is to append a newline to the source being evaluated.

Without this patch, the following commands **print no output, no errors**.

```
(lldb) script if "foo" in lldb.frame.name: print(lldb.thread)
(lldb) script for f in lldb.thread: print(f.name)
```

The issue is with `code.InteractiveConsole.runsource()`. A trailing newline is
needed for these expressions to be evaluated. I don't know why this is, the
docs don't mention anything.

From a python repl, the following samples show that a terminal newline allows
statements containing flow control to fully execute.

```
&gt;&gt;&gt; import code
&gt;&gt;&gt; repl = code.InteractiveConsole()
&gt;&gt;&gt; repl.runsource("if True: print(1)")
True
&gt;&gt;&gt; repl.runsource("if True: print(1)\n")
1
False
```

Notes:

From an interactive python repl, the output is not printed immediately. The
user is required to enter a blank line following the first.

```
&gt;&gt;&gt; if True: print(1)
...
1
```

However, `python -c 'if True: print(1)'` works without needing a newline.

Reviewed By: JDevlieghere

Differential Revision: https://reviews.llvm.org/D127586
</pre>
</div>
</content>
</entry>
<entry>
<title>[lldb] Drop REQUIRES where redundant because of lit.local.cfg</title>
<updated>2021-07-09T20:25:10+00:00</updated>
<author>
<name>Jonas Devlieghere</name>
<email>jonas@devlieghere.com</email>
</author>
<published>2021-07-09T20:20:37+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=3338819b08faa7f23f65fb4e67154583984ebf5c'/>
<id>3338819b08faa7f23f65fb4e67154583984ebf5c</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>[lldb] Add -l/--language option to script command</title>
<updated>2020-09-15T16:40:17+00:00</updated>
<author>
<name>Jonas Devlieghere</name>
<email>jonas@devlieghere.com</email>
</author>
<published>2020-09-15T16:36:28+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=127faae7529aee7e8508abebbc19212ce30bbf27'/>
<id>127faae7529aee7e8508abebbc19212ce30bbf27</id>
<content type='text'>
Make it possible to run the script command with a different language
than currently selected.

  $ ./bin/lldb -l python
  (lldb) script -l lua
  &gt;&gt;&gt; io.stdout:write("Hello, World!\n")
  Hello, World!

When passing the language option and a raw command, you need to separate
the flag from the script code with --.

  $ ./bin/lldb -l python
  (lldb) script -l lua -- io.stdout:write("Hello, World!\n")
  Hello, World!

Differential revision: https://reviews.llvm.org/D86996
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Make it possible to run the script command with a different language
than currently selected.

  $ ./bin/lldb -l python
  (lldb) script -l lua
  &gt;&gt;&gt; io.stdout:write("Hello, World!\n")
  Hello, World!

When passing the language option and a raw command, you need to separate
the flag from the script code with --.

  $ ./bin/lldb -l python
  (lldb) script -l lua -- io.stdout:write("Hello, World!\n")
  Hello, World!

Differential revision: https://reviews.llvm.org/D86996
</pre>
</div>
</content>
</entry>
</feed>
