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-118500: Add pdb support for zipapp#118501

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 5 commits intopython:mainfromgaogaotiantian:pdb-support-zipapp
May 2, 2024

Conversation

gaogaotiantian
Copy link
Member

@gaogaotiantiangaogaotiantian commentedMay 2, 2024
edited by bedevere-appbot
Loading

When zipapp is being loaded, it seems to register the files in the zip to linecache so the other libraries can find the source. pdb can get the source file with no issue, the breakpoint mechanism needs a tweak, also not complicated.

Overall it worked without too much hassle.

@gaogaotiantian
Copy link
MemberAuthor

Hey@iritkatriel , this is something I always wanted to do and that's why I refactored the targets first. It turned out supporting zipapps is not that difficult at all. It basically just a special type of module and I followed the python interpreter to run the zipapp module in pdb. I added another type of target for*.pyz files and tweaked the function search a little bit to support breakpoints for zipapp. Hopefully this is not too much work for you for this to make 3.13 :)

try:
_, self._spec, self._code = runpy._get_main_module_details()
except ImportError as e:
print(f"ImportError: {e}")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Why do you need to special-case ImportError here?

Copy link
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

That's from#108791. This is a very common case but the exception traceback would be very large because it's generated rather deeply and it distracts users. It would be a better experience to simply show that there's an import error when the user passes in an invalid module.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Ok. there is also traceback.format_exception_only().

Copy link
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Yeah I think the orignal thought here was just to suppress the common import error, and leave the others be. In that case we need a special case forImportError anyway with or withoutformat_exception_only.

@iritkatrieliritkatriel merged commit4e2caf2 intopython:mainMay 2, 2024
@gaogaotiantiangaogaotiantian deleted the pdb-support-zipapp branchMay 2, 2024 21:03
@bedevere-bot
Copy link

⚠️⚠️⚠️ Buildbot failure⚠️⚠️⚠️

Hi! The buildbotARM64 MacOS M1 Refleaks NoGIL 3.x has failed when building commit4e2caf2.

What do you need to do:

  1. Don't panic.
  2. Checkthe buildbot page in the devguide if you don't know what the buildbots are or how they work.
  3. Go to the page of the buildbot that failed (https://buildbot.python.org/all/#builders/1368/builds/902) and take a look at the build logs.
  4. Check if the failure is related to this commit (4e2caf2) or if it is a false positive.
  5. If the failure is related to this commit, please, reflect that on the issue and make a new Pull Request with a fix.

You can take a look at the buildbot page here:

https://buildbot.python.org/all/#builders/1368/builds/902

Failed tests:

  • test_free_threading

Test leaking resources:

  • test_processes: memory blocks

Summary of the results of the build (if available):

==

Click to see traceback logs
remote:Enumerating objects: 15, done.remote:Counting objects:   7% (1/14)remote:Counting objects:  14% (2/14)remote:Counting objects:  21% (3/14)remote:Counting objects:  28% (4/14)remote:Counting objects:  35% (5/14)remote:Counting objects:  42% (6/14)remote:Counting objects:  50% (7/14)remote:Counting objects:  57% (8/14)remote:Counting objects:  64% (9/14)remote:Counting objects:  71% (10/14)remote:Counting objects:  78% (11/14)remote:Counting objects:  85% (12/14)remote:Counting objects:  92% (13/14)remote:Counting objects: 100% (14/14)remote:Counting objects: 100% (14/14), done.remote:Compressing objects:  11% (1/9)remote:Compressing objects:  22% (2/9)remote:Compressing objects:  33% (3/9)remote:Compressing objects:  44% (4/9)remote:Compressing objects:  55% (5/9)remote:Compressing objects:  66% (6/9)remote:Compressing objects:  77% (7/9)remote:Compressing objects:  88% (8/9)remote:Compressing objects: 100% (9/9)remote:Compressing objects: 100% (9/9), done.remote:Total 15 (delta 5), reused 6 (delta 5), pack-reused 1From https://github.com/python/cpython * branch                  main       -> FETCH_HEADNote:switching to '4e2caf2aa046bf80e87e9b858837bb527459a034'.You are in 'detached HEAD' state. You can look around, make experimentalchanges and commit them, and you can discard any commits you make in thisstate without impacting any branches by switching back to a branch.If you want to create a new branch to retain commits you create, you maydo so (now or later) by using -c with the switch command. Example:  git switch -c <new-branch-name>Or undo this operation with:  git switch -Turn off this advice by setting config variable advice.detachedHead to falseHEAD is now at 4e2caf2aa0 gh-118500: Add pdb support for zipapp (#118501)Switched to and reset branch 'main'In file included from ./Modules/_tkinter.c:52:In file included from /opt/homebrew/Cellar/tcl-tk/8.6.13_5/include/tcl-tk/tk.h:99:/opt/homebrew/Cellar/tcl-tk/8.6.13_5/include/tcl-tk/X11/Xlib.h:131:21: warning: a function declaration without a prototype is deprecated in all versions of C [-Wstrict-prototypes]int (*free_private)();/* called to free private storage*/^                            void/opt/homebrew/Cellar/tcl-tk/8.6.13_5/include/tcl-tk/X11/Xlib.h:334:33: warning: a function declaration without a prototype is deprecated in all versions of C [-Wstrict-prototypes]        struct _XImage*(*create_image)();^                                        void/opt/homebrew/Cellar/tcl-tk/8.6.13_5/include/tcl-tk/X11/Xlib.h:453:23: warning: a function declaration without a prototype is deprecated in all versions of C [-Wstrict-prototypes]        XID (*resource_alloc)();/* allocator function*/^                              void/opt/homebrew/Cellar/tcl-tk/8.6.13_5/include/tcl-tk/X11/Xlib.h:471:20: warning: a function declaration without a prototype is deprecated in all versions of C [-Wstrict-prototypes]int (*synchandler)();/* Synchronization handler*/^                           void/opt/homebrew/Cellar/tcl-tk/8.6.13_5/include/tcl-tk/X11/Xlib.h:496:24: warning: a function declaration without a prototype is deprecated in all versions of C [-Wstrict-prototypes]        Bool (*event_vec[128])();/* vectorfor wire to event*/^                               void/opt/homebrew/Cellar/tcl-tk/8.6.13_5/include/tcl-tk/X11/Xlib.h:497:25: warning: a function declaration without a prototype is deprecated in all versions of C [-Wstrict-prototypes]        Status (*wire_vec[128])();/* vectorfor event to wire*/^                                void/opt/homebrew/Cellar/tcl-tk/8.6.13_5/include/tcl-tk/X11/Xlib.h:509:20: warning: a function declaration without a prototype is deprecated in all versions of C [-Wstrict-prototypes]        Bool (**error_vec)();/* vectorfor wire to error*/^                           void/opt/homebrew/Cellar/tcl-tk/8.6.13_5/include/tcl-tk/X11/Xlib.h:522:25: warning: a function declaration without a prototype is deprecated in all versions of C [-Wstrict-prototypes]int (*savedsynchandler)();/* user synchandler when Xlib usurps*/^                                void/opt/homebrew/Cellar/tcl-tk/8.6.13_5/include/tcl-tk/X11/Xlib.h:1053:24: warning: a function declaration without a prototype is deprecated in all versions of C [-Wstrict-prototypes]typedef void (*XIMProc)();^                        voidIn file included from ./Modules/tkappinit.c:17:In file included from /opt/homebrew/Cellar/tcl-tk/8.6.13_5/include/tcl-tk/tk.h:99:/opt/homebrew/Cellar/tcl-tk/8.6.13_5/include/tcl-tk/X11/Xlib.h:131:21: warning: a function declaration without a prototype is deprecated in all versions of C [-Wstrict-prototypes]int (*free_private)();/* called to free private storage*/^                            void/opt/homebrew/Cellar/tcl-tk/8.6.13_5/include/tcl-tk/X11/Xlib.h:334:33: warning: a function declaration without a prototype is deprecated in all versions of C [-Wstrict-prototypes]        struct _XImage*(*create_image)();^                                        void/opt/homebrew/Cellar/tcl-tk/8.6.13_5/include/tcl-tk/X11/Xlib.h:453:23: warning: a function declaration without a prototype is deprecated in all versions of C [-Wstrict-prototypes]        XID (*resource_alloc)();/* allocator function*/^                              void/opt/homebrew/Cellar/tcl-tk/8.6.13_5/include/tcl-tk/X11/Xlib.h:471:20: warning: a function declaration without a prototype is deprecated in all versions of C [-Wstrict-prototypes]int (*synchandler)();/* Synchronization handler*/^                           void/opt/homebrew/Cellar/tcl-tk/8.6.13_5/include/tcl-tk/X11/Xlib.h:496:24: warning: a function declaration without a prototype is deprecated in all versions of C [-Wstrict-prototypes]        Bool (*event_vec[128])();/* vectorfor wire to event*/^                               void/opt/homebrew/Cellar/tcl-tk/8.6.13_5/include/tcl-tk/X11/Xlib.h:497:25: warning: a function declaration without a prototype is deprecated in all versions of C [-Wstrict-prototypes]        Status (*wire_vec[128])();/* vectorfor event to wire*/^                                void/opt/homebrew/Cellar/tcl-tk/8.6.13_5/include/tcl-tk/X11/Xlib.h:509:20: warning: a function declaration without a prototype is deprecated in all versions of C [-Wstrict-prototypes]        Bool (**error_vec)();/* vectorfor wire to error*/^                           void/opt/homebrew/Cellar/tcl-tk/8.6.13_5/include/tcl-tk/X11/Xlib.h:522:25: warning: a function declaration without a prototype is deprecated in all versions of C [-Wstrict-prototypes]int (*savedsynchandler)();/* user synchandler when Xlib usurps*/^                                void/opt/homebrew/Cellar/tcl-tk/8.6.13_5/include/tcl-tk/X11/Xlib.h:1053:24: warning: a function declaration without a prototype is deprecated in all versions of C [-Wstrict-prototypes]typedef void (*XIMProc)();^                        void9 warnings generated.9 warnings generated.make:*** [buildbottest] Error 2

SonicField pushed a commit to SonicField/cpython that referenced this pull requestMay 8, 2024
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@iritkatrieliritkatrieliritkatriel approved these changes

Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

3 participants
@gaogaotiantian@bedevere-bot@iritkatriel

[8]ページ先頭

©2009-2025 Movatter.jp