We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent f764000 commit 5c18be8Copy full SHA for 5c18be8
1 file changed
unpythonic/misc.py
@@ -502,8 +502,8 @@ def rename(f):
502
# https://stackoverflow.com/questions/40661758/name-of-a-python-function-in-a-stack-trace
503
# https://stackoverflow.com/questions/16064409/how-to-create-a-code-object-in-python
504
f.__name__ = name
505
- j = f.__qualname__.rfind('.')
506
- f.__qualname__ = "{}.{}".format(f.__qualname__[:j], name) if j != -1 else name
+ idx = f.__qualname__.rfind('.')
+ f.__qualname__ = "{}.{}".format(f.__qualname__[:idx], name) if idx != -1 else name
507
# __code__.co_name is read-only, but there's a types.CodeType constructor
508
# that we can use to re-create the code object with the new name.
509
# (This is no worse than what the stdlib's Lib/modulefinder.py already does.)
0 commit comments