gh-142570: Check the file type before skipping the source first line
pymain_run_file_obj: Check the file type before skipping the source first line.
- Issue: gh-142570
@picnixz
@ZeroIntensity
A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated.
Once you have made the requested changes, please leave a comment on this pull request containing the phrase I have made the requested changes; please review again. I will then notify any core developers who have left a review that you're ready for them to take another look at this pull request.
I have made the requested changes; please review again.
Thanks for making the requested changes!
@ZeroIntensity: please review the changes made to this pull request.
A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated.
Once you have made the requested changes, please leave a comment on this pull request containing the phrase I have made the requested changes; please review again. I will then notify any core developers who have left a review that you're ready for them to take another look at this pull request.
And if you don't make the requested changes, you will be poked with soft cushions!
Anyway, I'm almost certain there's already a test that stresses the "correct" case. I don't think we need to add another one with this PR.
If that's the case, then I agree with you.
However, so what we should do with:
- The current order of operations in the
pymain_run_file_objwhich I believe it does not make sense. - The interception of the directory arguments by
pymain_get_importerwill make dead code inside thepymain_run_file_obj. For this reason, even if we reorder the operations insidepymain_run_file_obj(as in this PR), still, keeping the check-for-directory code does not make sense if we believe that thepymain_run_file_objwill be called only when thefilenameis a script file.