Skip to content

bpo-38731: Add --quiet option to py_compile CLI#17134

Merged
berkerpeksag merged 26 commits intopython:masterfrom
gvsheva:fix-issue-38731
Jul 25, 2020
Merged

bpo-38731: Add --quiet option to py_compile CLI#17134
berkerpeksag merged 26 commits intopython:masterfrom
gvsheva:fix-issue-38731

Conversation

@gvsheva
Copy link
Copy Markdown
Contributor

@gvsheva gvsheva commented Nov 12, 2019

Fixing missed quiet variable in py_compile.py module.

https://bugs.python.org/issue40456

@the-knights-who-say-ni
Copy link
Copy Markdown

Hello, and thanks for your contribution!

I'm a bot set up to make sure that the project can legally accept this contribution by verifying everyone involved has signed the PSF contributor agreement (CLA).

CLA Missing

Our records indicate the following people have not signed the CLA:

@gvsheva

For legal reasons we need all the people listed to sign the CLA before we can look at your contribution. Please follow the steps outlined in the CPython devguide to rectify this issue.

If you have recently signed the CLA, please wait at least one business day
before our records are updated.

You can check yourself to see if the CLA has been received.

Thanks again for the contribution, we look forward to reviewing it!

@brandtbucher brandtbucher added the type-bug An unexpected behavior, bug, or error label Nov 13, 2019
@brandtbucher
Copy link
Copy Markdown
Member

Thanks for your time @gvsheva, and welcome to CPython! 😎

I assume that you've seen the bot's message about the CLA?

Copy link
Copy Markdown
Member

@brandtbucher brandtbucher left a comment

Choose a reason for hiding this comment

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

I'm not sure about this solution.

I don't see that passing -q from the command line is actually documented anywhere, and it would be the only argument that we parse out like this.

It probably makes the most sense to just remove the branching below that references quiet and just always write the error messages.

@brandtbucher
Copy link
Copy Markdown
Member

This PR should also have a NEWS entry. Just something simple, like:

Fix a crash during error handling in :meth:`py_compile.main`.

@gvsheva gvsheva changed the title bpo-38731: add missing quiet variable in py_compile.main bpo-38731: fix missing quiet variable in py_compile.main Nov 13, 2019
@gvsheva
Copy link
Copy Markdown
Contributor Author

gvsheva commented Nov 13, 2019

All was done, but I can't understand why Travis CI build was failed.

@brandtbucher
Copy link
Copy Markdown
Member

@gvsheva It looks like an issue on Travis's end, unrelated to your changes. Pushing to your branch or closing-and-reopening this PR (not making a new one) should re-trigger the build.

Copy link
Copy Markdown
Member

@brandtbucher brandtbucher left a comment

Choose a reason for hiding this comment

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

Looks good now!

@gvsheva gvsheva closed this Nov 14, 2019
@gvsheva gvsheva reopened this Nov 14, 2019
Comment thread Misc/NEWS.d/next/Library/2019-11-13-07-37-11.bpo-38731.9qmcSx.rst Outdated
@merwok
Copy link
Copy Markdown
Member

merwok commented Nov 14, 2019

I think that the original intent was to support setting quiet mode on the command line. IMO this PR should be accepted to fix 3.8, but the original feature should be completed on master branch. Could you notify the original issue about this?

@gvsheva
Copy link
Copy Markdown
Contributor Author

gvsheva commented Nov 14, 2019

The original issue is https://bugs.python.org/issue22640

Comment thread Misc/NEWS.d/next/Library/2019-11-13-07-37-11.bpo-38731.9qmcSx.rst Outdated
@merwok
Copy link
Copy Markdown
Member

merwok commented Nov 15, 2019

Yes, can you add a comment there?

@merwok
Copy link
Copy Markdown
Member

merwok commented Nov 16, 2019

@berkerpeksag do you agree with me?

I think that the original intent was to support setting quiet mode on the command line. IMO this PR should be accepted to fix 3.8, but the original feature should be completed on master branch.

Copy link
Copy Markdown
Member

@pablogsal pablogsal left a comment

Choose a reason for hiding this comment

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

Hi @gvsheva and thanks for your contribution, could you add a test case for this in the test suite? Thanks!

@gvsheva gvsheva closed this Jul 15, 2020
@gvsheva gvsheva reopened this Jul 15, 2020
@gvsheva gvsheva closed this Jul 16, 2020
@gvsheva gvsheva reopened this Jul 16, 2020
@merwok merwok requested a review from nanjekyejoannah July 16, 2020 14:27
@gvsheva
Copy link
Copy Markdown
Contributor Author

gvsheva commented Jul 16, 2020

I have made the requested changes; please review again.

@bedevere-bot
Copy link
Copy Markdown

Thanks for making the requested changes!

@merwok, @nanjekyejoannah, @pablogsal, @berkerpeksag: please review the changes made to this pull request.

@berkerpeksag
Copy link
Copy Markdown
Member

I'll make some trivial changes (such as replacing 3.9 with 3.10) to avoid keeping this unmerged any longer and then merge, thanks!

@berkerpeksag berkerpeksag changed the title bpo-40456: add quiet mode for py_compile main bpo-38731: Add --quiet option to py_compile CLI Jul 25, 2020
Copy link
Copy Markdown
Member

@berkerpeksag berkerpeksag left a comment

Choose a reason for hiding this comment

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

This is now ready to go. I've made some adjustments to tests (no need to run them twice) and other random tweaks. I've also made sure that tests are passed without porting CLI to argparse (minus tests related to the --quiet option, of course) I'll submit another PR to fix the regression in 3.8 and 3.9.

@berkerpeksag
Copy link
Copy Markdown
Member

Thank you!

@bedevere-bot
Copy link
Copy Markdown

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

Hi! The buildbot s390x RHEL7 LTO + PGO 3.x has failed when building commit daff390.

What do you need to do:

  1. Don't panic.
  2. Check the 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/483/builds/857) and take a look at the build logs.
  4. Check if the failure is related to this commit (daff390) 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/483/builds/857

Failed tests:

  • test_nntplib

Failed subtests:

  • test_with_statement - test.test_nntplib.NetworkedNNTP_SSLTests

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

== Tests result: FAILURE then FAILURE ==

408 tests OK.

10 slowest tests:

  • test_peg_generator: 3 min 23 sec
  • test_concurrent_futures: 3 min 16 sec
  • test_tokenize: 1 min 32 sec
  • test_multiprocessing_spawn: 1 min 27 sec
  • test_unparse: 1 min 17 sec
  • test_multiprocessing_forkserver: 1 min 10 sec
  • test_lib2to3: 1 min 10 sec
  • test_asyncio: 1 min 3 sec
  • test_multiprocessing_fork: 58.3 sec
  • test_signal: 48.6 sec

1 test failed:
test_nntplib

14 tests skipped:
test_devpoll test_gdb test_ioctl test_kqueue test_msilib
test_ossaudiodev test_startfile test_tix test_tk test_ttk_guionly
test_winconsoleio test_winreg test_winsound test_zipfile64

1 re-run test:
test_nntplib

Total duration: 6 min 47 sec

Click to see traceback logs
Traceback (most recent call last):
  File "/home/dje/cpython-buildarea/3.x.edelsohn-rhel-z.lto-pgo/build/Lib/test/test_nntplib.py", line 277, in test_with_statement
    server = self.NNTP_CLASS(self.NNTP_HOST,
  File "/home/dje/cpython-buildarea/3.x.edelsohn-rhel-z.lto-pgo/build/Lib/nntplib.py", line 1025, in __init__
    super().__init__(host, port, user, password, readermode,
  File "/home/dje/cpython-buildarea/3.x.edelsohn-rhel-z.lto-pgo/build/Lib/nntplib.py", line 334, in __init__
    self.sock = self._create_socket(timeout)
  File "/home/dje/cpython-buildarea/3.x.edelsohn-rhel-z.lto-pgo/build/Lib/nntplib.py", line 1031, in _create_socket
    sock = _encrypt_on(sock, self.ssl_context, self.host)
  File "/home/dje/cpython-buildarea/3.x.edelsohn-rhel-z.lto-pgo/build/Lib/nntplib.py", line 292, in _encrypt_on
    return context.wrap_socket(sock, server_hostname=hostname)
  File "/home/dje/cpython-buildarea/3.x.edelsohn-rhel-z.lto-pgo/build/Lib/ssl.py", line 500, in wrap_socket
    return self.sslsocket_class._create(
  File "/home/dje/cpython-buildarea/3.x.edelsohn-rhel-z.lto-pgo/build/Lib/ssl.py", line 1040, in _create
    self.do_handshake()
  File "/home/dje/cpython-buildarea/3.x.edelsohn-rhel-z.lto-pgo/build/Lib/ssl.py", line 1309, in do_handshake
    self._sslobj.do_handshake()
ssl.SSLEOFError: EOF occurred in violation of protocol (_ssl.c:1121)


Traceback (most recent call last):
  File "/home/dje/cpython-buildarea/3.x.edelsohn-rhel-z.lto-pgo/build/Lib/test/test_nntplib.py", line 250, in wrapped
    meth(self)
  File "/home/dje/cpython-buildarea/3.x.edelsohn-rhel-z.lto-pgo/build/Lib/test/test_nntplib.py", line 293, in test_with_statement
    if re.search(r'(?i)KEY.TOO.SMALL', ssl_err.reason):
  File "/home/dje/cpython-buildarea/3.x.edelsohn-rhel-z.lto-pgo/build/Lib/re.py", line 201, in search
    return _compile(pattern, flags).search(string)
TypeError: expected string or bytes-like object

@bedevere-bot
Copy link
Copy Markdown

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

Hi! The buildbot s390x RHEL7 LTO 3.x has failed when building commit daff390.

What do you need to do:

  1. Don't panic.
  2. Check the 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/527/builds/856) and take a look at the build logs.
  4. Check if the failure is related to this commit (daff390) 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/527/builds/856

Failed tests:

  • test_nntplib

Failed subtests:

  • test_with_statement - test.test_nntplib.NetworkedNNTP_SSLTests

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

== Tests result: FAILURE then FAILURE ==

409 tests OK.

10 slowest tests:

  • test_concurrent_futures: 3 min 12 sec
  • test_peg_generator: 2 min 47 sec
  • test_multiprocessing_spawn: 1 min 39 sec
  • test_tokenize: 1 min 36 sec
  • test_unparse: 1 min 26 sec
  • test_asyncio: 1 min 15 sec
  • test_lib2to3: 1 min 8 sec
  • test_multiprocessing_forkserver: 1 min 7 sec
  • test_multiprocessing_fork: 57.5 sec
  • test_signal: 47.9 sec

1 test failed:
test_nntplib

13 tests skipped:
test_devpoll test_ioctl test_kqueue test_msilib test_ossaudiodev
test_startfile test_tix test_tk test_ttk_guionly test_winconsoleio
test_winreg test_winsound test_zipfile64

1 re-run test:
test_nntplib

Total duration: 7 min 6 sec

Click to see traceback logs
Traceback (most recent call last):
  File "/home/dje/cpython-buildarea/3.x.edelsohn-rhel-z.lto/build/Lib/test/test_nntplib.py", line 250, in wrapped
    meth(self)
  File "/home/dje/cpython-buildarea/3.x.edelsohn-rhel-z.lto/build/Lib/test/test_nntplib.py", line 293, in test_with_statement
    if re.search(r'(?i)KEY.TOO.SMALL', ssl_err.reason):
  File "/home/dje/cpython-buildarea/3.x.edelsohn-rhel-z.lto/build/Lib/re.py", line 201, in search
    return _compile(pattern, flags).search(string)
TypeError: expected string or bytes-like object


Traceback (most recent call last):
  File "/home/dje/cpython-buildarea/3.x.edelsohn-rhel-z.lto/build/Lib/test/test_nntplib.py", line 277, in test_with_statement
    server = self.NNTP_CLASS(self.NNTP_HOST,
  File "/home/dje/cpython-buildarea/3.x.edelsohn-rhel-z.lto/build/Lib/nntplib.py", line 1025, in __init__
    super().__init__(host, port, user, password, readermode,
  File "/home/dje/cpython-buildarea/3.x.edelsohn-rhel-z.lto/build/Lib/nntplib.py", line 334, in __init__
    self.sock = self._create_socket(timeout)
  File "/home/dje/cpython-buildarea/3.x.edelsohn-rhel-z.lto/build/Lib/nntplib.py", line 1031, in _create_socket
    sock = _encrypt_on(sock, self.ssl_context, self.host)
  File "/home/dje/cpython-buildarea/3.x.edelsohn-rhel-z.lto/build/Lib/nntplib.py", line 292, in _encrypt_on
    return context.wrap_socket(sock, server_hostname=hostname)
  File "/home/dje/cpython-buildarea/3.x.edelsohn-rhel-z.lto/build/Lib/ssl.py", line 500, in wrap_socket
    return self.sslsocket_class._create(
  File "/home/dje/cpython-buildarea/3.x.edelsohn-rhel-z.lto/build/Lib/ssl.py", line 1040, in _create
    self.do_handshake()
  File "/home/dje/cpython-buildarea/3.x.edelsohn-rhel-z.lto/build/Lib/ssl.py", line 1309, in do_handshake
    self._sslobj.do_handshake()
ssl.SSLEOFError: EOF occurred in violation of protocol (_ssl.c:1121)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type-bug An unexpected behavior, bug, or error

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants