[2.7] bpo-31285: fix an assertion failure and a SystemError in warnings.warn_explicit (GH-3219) #3805
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is a backport of #3219 , but actually also a backport of #3803 , which is a cleanup after #3219 .
Also, i removed the test that verifies that the assertion failure is no more, because in 2.7, the code assumes that the value returned by
splitlines()
is a string, and uses it without asserting it is a string, in such a way that causing some error (for testing purposes) is not simple (at least i didn't find a simple way).ISTM that the first test is good enough to verify that the
splitlines()
attribute is ignored, andPyUnicode_Splitlines()
is used directly.https://bugs.python.org/issue31285