gh-143201: Remove unused truncated variable from warnings - #157043
gh-143201: Remove unused truncated variable from warnings#157043AZero13 wants to merge 1 commit into
Conversation
It is not used and hasn't been, so we can remove it. Remove i, len, and data too.
|
@AZero13 please do not force push to CPython PR branches: https://devguide.python.org/getting-started/pull-request-lifecycle/#don-t-force-push |
|
The change is not correct: the function must skip the indentation. I introduced a bug in a4c704b (in 2013, 13 years ago!): Example: import sys
import warnings
# Force the usage of the C implementation
del warnings._showwarnmsg
def current_lineno():
return sys._getframe(1).f_lineno
def func():
# looooong indentation
lineno = current_lineno() + 1
warnings.warn_explicit('text', Warning,
__file__, lineno,
module_globals=globals())
func()The output is: The long indentation is not replaced with 2 spaces. If I comment Well, IMO the first problem here is that the C implementation (C |
|
@AZero13 could you update this PR for vstinner's requested changes? He's a lot more authoratative on this code than I am. Sorry for leading you back and forth. |
It is not used and hasn't been, so we can remove it.