pFad - Phone/Frame/Anonymizer/Declutterfier! Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

URL: http://github.com/python/cpython/pull/116154/files

ia="all" rel="stylesheet" href="https://github.githubassets.com/assets/code-2d31826944fd3be8.css" /> [3.12] gh-87115: Set `__main__.__spec__` to `None` in pdb (GH-116141) by gaogaotiantian · Pull Request #116154 · python/cpython · GitHub
Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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 deletions Lib/pdb.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ def namespace(self):
__name__='__main__',
__file__=self,
__builtins__=__builtins__,
__spec__=None,
)

@property
Expand Down
12 changes: 12 additions & 0 deletions Lib/test/test_pdb.py
Original file line number Diff line number Diff line change
Expand Up @@ -2013,6 +2013,18 @@ def bœr():
('bœr', 1),
)

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_issue7964(self):
# open the file as binary so we can force \r\n newline
with open(os_helper.TESTFN, 'wb') as f:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Set ``__main__.__spec__`` to ``None`` when running a script with :mod:`pdb`
pFad - Phonifier reborn

Pfad - The Proxy pFad © 2024 Your Company Name. All rights reserved.





Check this box to remove all script contents from the fetched content.



Check this box to remove all images from the fetched content.


Check this box to remove all CSS styles from the fetched content.


Check this box to keep images inefficiently compressed and original size.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy