-
-
Notifications
You must be signed in to change notification settings - Fork 30.9k
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
bpo-29553: Fixed ArgumentParses format_usage for mutually exclusive groups #117
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just did a quick review and the PR looks good in general, thank you. We also need an entry in Misc/NEWS
(should be in "Library" section)
Lib/test/test_argparse.py
Outdated
@@ -2725,6 +2725,35 @@ def get_parser(self, required): | |||
-c c help | |||
''' | |||
|
|||
class TestMutuallyExclusiveNested(TestCase): | |||
def test_format_usage(self): | |||
parser = ErrorRaisingArgumentParser(prog='PROG') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a reason you can't use the existing test infrastructure? I think it's possible to convert these tests to follow the style of TestMutuallyExclusiveOptionalAndPositional
: https://github.com/python/cpython/blob/82e38bd80113ecfc7aff2fb3edaf2802fe21c1fb/Lib/test/test_argparse.py#L2560
We can define a get_parser()
method and use usage_when_required
and usage_when_not_required
to check output of parser.format_help()
.
@berkerpeksag thanks! just updated my PR. |
Fix the first of several leaks. This one affects generator objects, which get finalised without being exhausted. https://bitbucket.org/stackless-dev/stackless/issues/117 (grafted from 7e86b49712ae5228edcdd822cb4b7e633d7c4363)
…heduling.c to stacklesseval.c This change makes a few functions "static". This improves the readability of the code. (grafted from b04162d33bed4125633dbaca6c2f9a8ec13edb4f)
… in slp_eval_frame_*() This change simplifies the code, that prevents the link optimiser to optimise away the identical functions slp_eval_frame_*(). The new code is simpler, faster and makes the overall reference counting less hard to understand. (grafted from 72d9447daf24f9441289784714c307f4e1d5e79f)
Fix two reference leaks in the C-implementation of stackless.threads. https://bitbucket.org/stackless-dev/stackless/issues/117 (grafted from 0ed22581e9fc255195d9116446ab9b20bcf99ac8)
Fix two reference leaks in the C-implementation of tasklet.__setstate__(). This fix depends on the previous commit. Without the new frame reference counting logic, it could lead to a negative reference count. Probably issue python#117 is now completely fixed. https://bitbucket.org/stackless-dev/stackless/issues/117 (grafted from a89093b495d7d9a7c2420001f674077fb6c586d1)
…h C-Python Exception handling now follows suit the code of sys.exc_clear() and ceval.c set_exc_info(). This change helps to rule out reference leaks caused by inappropriate handling of traceback objects. https://bitbucket.org/stackless-dev/stackless/issues/117 (grafted from 36fc9e84a48999378a73173c179ba6beeabcf821)
…n code This feature makes it possible to write tests for leaks caused by the watchdog list. The feature is intentionally undocumented, because it depends on implementation details. https://bitbucket.org/stackless-dev/stackless/issues/117 (grafted from 926f8eb7666730436799f19923852a7d16ae83ed)
This commit adds tests to detect resources leaks and changes of global state. Additionally it adds utility functions for debugging and tests, which inevitably leak references. - StacklessTestCase now tests for watchdog list leaks. The setUp() and tearDown() method now assert that the watchdog list of all threads is empty. Fortunately, this new test didn't reveal unknown problems. - StacklessTestCase tearDown now kills blocked tasklets with C-state. Such tasklets may be kept alive by a reference to a transient bound-method object, which referenced by a C-function. - StacklessTestCase tearDown now checks that the switch-trap level is 0 and resets the level, if it was different. - StacklessTestCase now checks that no error-handler is registered at the end of a test and eventually removes the error handler. - Add a decorator for tests, which leak references. A test case, which creates a C-stack without a thread, inevitably leak all references hold by local C-variables in this stack slice. The decorator skips decorated test-cases during "huntrleaks"-runs (option "-R:"). Debugging additions: - StacklessTestCase got two (experimental) methods to trace tasklet switching. https://bitbucket.org/stackless-dev/stackless/issues/117 (grafted from b2fc5542b34542abb275f8d1bc33691b0113bcaf)
- channelobject.c: Fix two reference leaks in the C-implementations of channel.send_throw() and channel.send_exception(). - stacklessmodule.c: Fix a reference leak in PyStackless_CallErrorHandler(), if Stackless runs a user defined error-handler. - ceval.c: Fix a reference leak in PyEval_EvalFrameEx_slp(), if a profile or trace function fails. - prickelpit.c and test_pickle.py: Fix reference leaks, if stackless._wrap.frame.__setstate__() fails, due to an invalid state. Add a test case. https://bitbucket.org/stackless-dev/stackless/issues/117 (grafted from f5d4ba8df893949daa6938b7161786783fb0c149)
This commit fixes problems in the Stackless test suite at Python level. It does not fix failures caused by reference leaks. - Fix failures, which occurred during a second or further run of the test. - Mark test-cases, which inevitably leak references. These tests leave a C-stack without thread. No chance to clean the references. https://bitbucket.org/stackless-dev/stackless/issues/117 (grafted from 7ae818842aa4783eb33be6a6085535ba18db97bc)
Stackless used to leak references to frames / C-frames, if a tasklet didn't run to its end, or various other conditions. This part of the fix changes the Stackless reference counting for frames to follow the general rules for Python objects. The concept of an "execute reference" no longer exists. Frames no longer eat their reference. See Stackless/core/stackless_impl.h for a detailed explanation. This patch adds a special frame reference counting debug mode, which can be enabled in stackless_tstate.h. https://bitbucket.org/stackless-dev/stackless/issues/117 (grafted from 9e9a2cea45059e87d025a1867beb8b0e3369262d)
To try and help move older pull requests forward, we are going through and backfilling 'awaiting' labels on pull requests that are lacking the label. Based on the current reviews, the best we can tell in an automated fashion is that a core developer requested changes to be made to this pull request. If/when the requested changes have been made, please leave a comment that says, |
…ute() I missed the C-fame case, when I changed the frame-function ref counting in Stackless issue python#117.
Recreated at #14976 |
Since this PR has not received a response from the author since the |
Fix for https://bugs.python.org/issue29553