Skip to content

Support 3.13 in PyDev.Debugger #293

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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 28 commits into from
Oct 27, 2024
Merged

Conversation

rchiodo
Copy link
Contributor

@rchiodo rchiodo commented Oct 23, 2024

Fixes #291
Fixes #280

This gets 3.13 working in PyDev.Debugger. I originally made some of these changes to debugpy but there was extra work to get all of the PyDev.Debugger tests to pass.

  • Get 3.13 attach working (mostly the thread._is_stopped no longer usable)
  • Fixup some minor bugs after porting the changes I made for sys.monitoring
  • Skip tests that specifically fail in 3.13

I hope I got the workflow for the tests setup correctly. I'll fix it up if the tests don't start on 3.13. Tests did pass for 3.13 on my local machine.

@@ -1077,8 +1077,9 @@ def get_file_type(self, frame, abs_real_path_and_basename=None, _cache_file_type
if abs_real_path_and_basename[0] == "<string>":
# Consider it an untraceable file unless there's no back frame (ignoring
# internal files and runpy.py).
if frame.f_back is not None and self.get_file_type(frame.f_back) == self.PYDEV_FILE:
# Special case, this is a string coming from pydevd itself (or another internal file)
if frame.f_back is not None and self.get_file_type(frame.f_back) == self.PYDEV_FILE and is_pydevd_path(frame.f_back.f_code.co_filename):
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is the change required to let '' modules from debugpy to go through. Debugpy modules are marked as PYDEV_FILES but the code they run should be marked as NONE. Only the lambdas in pydevd should be marked as PYDEV_FILE.

Copy link
Owner

Choose a reason for hiding this comment

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

I must say I don't fully comprehend the use case... can you elaborate a bit on which use-case this happens? Maybe debugpy itself could not use <string> as the name to compile those in that use case?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I believe it was debugpy using runpy to execute some string code. I'll have to pull this back and see which tests fail.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's this test here.
https://github.com/microsoft/debugpy/blob/8ab4ee89e9ae9a926f711904900a27e3c96d43d4/tests/debugpy/test_breakpoints.py#L420

It's whenever debugpy is launched with a string. That string's caller is debugpy so it goes down this path.

I'll look into maybe making pydevd's strings to be marked special instead. Then we can eliminate this code.

@fabioz fabioz merged commit 6342533 into fabioz:main Oct 27, 2024
10 checks passed
@fabioz
Copy link
Owner

fabioz commented Oct 27, 2024

As I wanted to do a release I merged as is and did an additional commit: 801c446 with most things I commented about.

Note that there is 1 thing I'd still like to check (in a future commit):

Related to #293 (comment): I'm not sure why this is needed (I was going to revert but let it linger for now): the proper fix I guess would be making sure that in pydevd itself there'd be no modules created with <string>, it'd be always something as <pydevd-string> and then all of that would be kind of moot, so, those checks could be simplied and the workaround code for debugpy could be removed.

@fabioz
Copy link
Owner

fabioz commented Oct 27, 2024

p.s.: Thank you for the PR!

@fabioz
Copy link
Owner

fabioz commented Oct 28, 2024

Actually, I ended up removing that is_pydevd_path completely in
25249d9 because the logic just doesn't work if pydevd is installed in the site-packages.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support debugging 3.13 pydevd_sys_monitoring crashing with inexplicable TypeError
2 participants