mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
gh-121604: Make sure all deprecated items in importlib raise DeprecationWarning (#128007)
Co-authored-by: rashansmith <smith.rashan@gmail.com> Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com> Co-authored-by: Brett Cannon <brett@python.org>
This commit is contained in:
parent
b52de22ac3
commit
bd3baa8b1a
8 changed files with 96 additions and 5 deletions
|
@ -858,8 +858,7 @@ def getsourcefile(object):
|
|||
Return None if no way can be identified to get the source.
|
||||
"""
|
||||
filename = getfile(object)
|
||||
all_bytecode_suffixes = importlib.machinery.DEBUG_BYTECODE_SUFFIXES[:]
|
||||
all_bytecode_suffixes += importlib.machinery.OPTIMIZED_BYTECODE_SUFFIXES[:]
|
||||
all_bytecode_suffixes = importlib.machinery.BYTECODE_SUFFIXES[:]
|
||||
if any(filename.endswith(s) for s in all_bytecode_suffixes):
|
||||
filename = (os.path.splitext(filename)[0] +
|
||||
importlib.machinery.SOURCE_SUFFIXES[0])
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue