aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite/gdb.python/source2.py
diff options
context:
space:
mode:
authorTom Tromey <tromey@adacore.com>2024-03-08 11:15:01 -0700
committerTom Tromey <tromey@adacore.com>2024-03-18 07:20:14 -0600
commita8e1e2aaf8783092b74330e2d4c727f814533cc9 (patch)
tree1634b4e06e275f2f84683871a8db4068c15243f3 /gdb/testsuite/gdb.python/source2.py
parent2518ce94704e54597bec273cafb090693b2de098 (diff)
downloadgdb-a8e1e2aaf8783092b74330e2d4c727f814533cc9.zip
gdb-a8e1e2aaf8783092b74330e2d4c727f814533cc9.tar.gz
gdb-a8e1e2aaf8783092b74330e2d4c727f814533cc9.tar.bz2
Set __file__ when source'ing a Python script
This patch arranges to set __file__ when source'ing a Python script. This fixes a problem that was introduced by the "source" rewrite, and then pointed out by Lancelot Six. Reviewed-by: Lancelot Six <lancelot.six@amd.com> Approved-By: Andrew Burgess <aburgess@redhat.com>
Diffstat (limited to 'gdb/testsuite/gdb.python/source2.py')
-rw-r--r--gdb/testsuite/gdb.python/source2.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/gdb/testsuite/gdb.python/source2.py b/gdb/testsuite/gdb.python/source2.py
index 60d59d9..79dc1c2 100644
--- a/gdb/testsuite/gdb.python/source2.py
+++ b/gdb/testsuite/gdb.python/source2.py
@@ -15,4 +15,7 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
+# Make sure __file__ is defined.
+assert type(__file__) == str
+
print("y%ss" % "e")