Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

gh-87115: Set__main__.__spec__ toNone in pdb#116141

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
iritkatriel merged 2 commits intopython:mainfromgaogaotiantian:fix-pdb-spec
Feb 29, 2024
Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletionsLib/pdb.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -188,6 +188,7 @@ def namespace(self):
__name__='__main__',
__file__=self,
__builtins__=__builtins__,
__spec__=None,
)

@property
Expand Down
12 changes: 12 additions & 0 deletionsLib/test/test_pdb.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -2695,6 +2695,18 @@ def bœr():
('bœr', 2),
)

def test_spec(self):
# Test that __main__.__spec__ is set to None when running a script
script = """
import __main__
print(__main__.__spec__)
"""

commands = "continue"

stdout, _ = self.run_pdb_script(script, commands)
self.assertIn('None', stdout)

def test_find_function_first_executable_line(self):
code = textwrap.dedent("""\
def foo(): pass
Expand Down
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
Set ``__main__.__spec__`` to ``None`` when running a script with :mod:`pdb`

[8]ページ先頭

©2009-2025 Movatter.jp