summaryrefslogtreecommitdiffstats
path: root/Lib/modulefinder.py
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@redhat.com>2019-05-24 21:57:23 (GMT)
committerGitHub <noreply@github.com>2019-05-24 21:57:23 (GMT)
commita9f05d69ccbf3c75cdd604c25094282697789a62 (patch)
treeb26677a8437f12e011b3adb574f32aa0bbff8739 /Lib/modulefinder.py
parent561612d8456cfab5672c9b445521113b847bd6b3 (diff)
downloadcpython-a9f05d69ccbf3c75cdd604c25094282697789a62.zip
cpython-a9f05d69ccbf3c75cdd604c25094282697789a62.tar.gz
cpython-a9f05d69ccbf3c75cdd604c25094282697789a62.tar.bz2
bpo-37032: Add CodeType.replace() method (GH-13542)
Diffstat (limited to 'Lib/modulefinder.py')
-rw-r--r--Lib/modulefinder.py8
1 files changed, 1 insertions, 7 deletions
diff --git a/Lib/modulefinder.py b/Lib/modulefinder.py
index a36f1b6..e0d2998 100644
--- a/Lib/modulefinder.py
+++ b/Lib/modulefinder.py
@@ -619,13 +619,7 @@ class ModuleFinder:
if isinstance(consts[i], type(co)):
consts[i] = self.replace_paths_in_code(consts[i])
- return types.CodeType(co.co_argcount, co.co_posonlyargcount,
- co.co_kwonlyargcount, co.co_nlocals,
- co.co_stacksize, co.co_flags,
- co.co_code, tuple(consts), co.co_names,
- co.co_varnames, new_filename, co.co_name,
- co.co_firstlineno, co.co_lnotab, co.co_freevars,
- co.co_cellvars)
+ return co.replace(co_consts=tuple(consts), co_filename=new_filename)
def test():