◐ Shell
clean mode source ↗

bpo-38693: Use f-strings instead of str.format() within importlib by gpshead · Pull Request #17058 · python/cpython

added 2 commits

November 4, 2019 22:15
This is a small performance improvement, especially for one or two hot
places such as _handle_fromlist() that are called a lot and the
.format() method was being used just to join two strings with a dot.

Otherwise it is merely a readability improvement.

This could be backported to 3.8 as it changes no functionality.

I kept `_ERR_MSG` as an attribute in `importlib._bootstrap` and `imp`
as I wasn't sure if there were other things in the world that might
refer to those.  They're private and could go away in 3.9 but should
not within 3.8 just in case.
It belongs with a later _ERR_MSG cleanup.

ericvsmith

brettcannon

ericvsmith

@gpshead

ericvsmith

@gpshead

@gpshead gpshead deleted the minor-importlib-opts branch

October 6, 2022 23:43

carljm added a commit to carljm/cpython that referenced this pull request

Oct 8, 2022

mpage pushed a commit to mpage/cpython that referenced this pull request

Oct 11, 2022
…thon#17058)

This is a small performance improvement, especially for one or two hot
places such as _handle_fromlist() that are called a lot and the
.format() method was being used just to join two strings with a dot.

Otherwise it is merely a readability improvement.

We keep `_ERR_MSG` and `_ERR_MSG_PREFIX` as those may be used elsewhere for canonical looking error messages.