FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Add command line parameter -P by naonus · Pull Request #4611 · RustPython/RustPython · GitHub

Add command line parameter -P - #4611

Merged
youknowone merged 5 commits into
RustPython:mainfrom
naonus:main
Aug 30, 2023
Merged

Add command line parameter -P#4611
youknowone merged 5 commits into
RustPython:mainfrom
naonus:main

Conversation

naonus commented Mar 2, 2023
edited by youknowone
Loading

Copy link
Copy Markdown
Contributor

It's not passed test case with errors below

AssertionError: '[]' != "['-P']"

  • []
  • ['-P']

#4541

Comment thread src/settings.rs
Comment thread vm/src/stdlib/sys.rs
utf8_mode: 1,
int_max_str_digits: -1,
safe_path: false,
safe_path: settings.safe_path,

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Modified safe_path to be set from parameter

Comment thread Lib/test/test_cmd_line.py Outdated
Comment on lines +887 to +1029
# TODO: RUSTPYTHON
@unittest.expectedFailure
def test_pythonsafepath_env(self):
# Test the PYTHONSAFEPATH environment variable
code = "import sys; print(sys.flags.safe_path)"
env = dict(os.environ)
env.pop('PYTHONSAFEPATH', None)
args = (sys.executable, '-P', code)

proc = subprocess.run(args, stdout=subprocess.PIPE,
universal_newlines=True, env=env)
self.assertEqual(proc.stdout.rstrip(), 'False')
self.assertEqual(proc.returncode, 0, proc)

env['PYTHONSAFEPATH'] = '1'
proc = subprocess.run(args, stdout=subprocess.PIPE,
universal_newlines=True, env=env)
self.assertEqual(proc.stdout.rstrip(), 'True')
self.assertEqual(proc.returncode, 0, proc)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Is this from CPython?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

No, I just added it. I'll check CPython.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

This test is not existed in CPython. Is it better deleting this code ?

youknowone Mar 2, 2023
edited
Loading

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

yes here, but moving to other place is good if the case is not yet covered by cpython unittest, .
Because Lib is copy of cpython repository, we usually put our own test under extra_tests/snippets.

Comment thread Lib/subprocess.py Outdated
'verbose': 'v',
'bytes_warning': 'b',
'quiet': 'q',
'safe_path': 'P'

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

if subprocess.py is too old, rather than editing it yourself, could you try to update it by following the library update guideline on #4564?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

done in #4981. We can now try and rebase after its merged and push this through too.

youknowone added the z-ls-2023 Tag to track Line OSS Sprint 2023 label Mar 2, 2023
Comment thread Lib/test/test_support.py Outdated

# TODO: RUSTPYTHON
@unittest.expectedFailure
# @unittest.expectedFailure

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

nit: remember to completely remove these comments

Copy link
Copy Markdown
Member

hey @naonus do you have time to follow along with this PR? If not, we can pick it up.

Comment thread Lib/test/test_cmd_line.py Outdated
code = "import sys; print(sys.flags.safe_path)"
env = dict(os.environ)
env.pop('PYTHONSAFEPATH', None)
args = (sys.executable, '-P', code)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality
Suggested change
args = (sys.executable, '-P', code)
args = (sys.executable, '-P', '-c', code)

Comment thread Lib/test/test_cmd_line.py Outdated

proc = subprocess.run(args, stdout=subprocess.PIPE,
universal_newlines=True, env=env)
self.assertEqual(proc.stdout.rstrip(), 'False')

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality
Suggested change
self.assertEqual(proc.stdout.rstrip(), 'False')
self.assertEqual(proc.stdout.rstrip(), 'True')

youknowone left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Thank you for contributing!

youknowone merged commit d4be55c into RustPython:main Aug 30, 2023
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

z-ls-2023 Tag to track Line OSS Sprint 2023

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants


Back | FazBrowse Home | New Git URL