|
93 | 93 | # test |
94 | 94 | # email |
95 | 95 |
|
96 | | -REPLACED_MODULES = set(['test', 'urllib', 'pickle']) # add email and dbm when we support it |
| 96 | +REPLACED_MODULES = set(['test', 'urllib', 'pickle', 'dbm']) # add email and dbm when we support it |
97 | 97 |
|
98 | 98 | # The following module names are not present in Python 2.x, so they cause no |
99 | | -# potential clashes: |
| 99 | +# potential clashes between the old and new names: |
100 | 100 | # http |
101 | 101 | # html |
102 | 102 | # tkinter |
103 | 103 | # xmlrpc |
104 | | - |
105 | | -# These modules need names from elsewhere being added to them: |
106 | | -# subprocess: should provide getoutput and other fns from commands |
107 | | -# module but these fns are missing: getstatus, mk2arg, |
108 | | -# mkarg |
109 | | -# re: needs an ASCII constant that works compatibly with Py3 |
110 | | - |
111 | | - |
112 | | -# Old to new |
113 | | -# etc: see lib2to3/fixes/fix_imports.py |
| 104 | +# Keys: Py2 / real module names |
| 105 | +# Values: Py3 / simulated module names |
114 | 106 | RENAMES = { |
115 | 107 | # 'cStringIO': 'io', # there's a new io module in Python 2.6 |
116 | 108 | # that provides StringIO and BytesIO |
|
182 | 174 |
|
183 | 175 |
|
184 | 176 | # Harmless renames that we can insert. |
| 177 | +# These modules need names from elsewhere being added to them: |
| 178 | +# subprocess: should provide getoutput and other fns from commands |
| 179 | +# module but these fns are missing: getstatus, mk2arg, |
| 180 | +# mkarg |
| 181 | +# re: needs an ASCII constant that works compatibly with Py3 |
| 182 | + |
| 183 | +# etc: see lib2to3/fixes/fix_imports.py |
| 184 | + |
185 | 185 | # (New module name, new object name, old module name, old object name) |
186 | 186 | MOVES = [('collections', 'UserList', 'UserList', 'UserList'), |
187 | 187 | ('collections', 'UserDict', 'UserDict', 'UserDict'), |
@@ -323,16 +323,16 @@ def __enter__(self): |
323 | 323 | # flog.debug('Entering hooks context manager') |
324 | 324 | self.old_sys_modules = copy.copy(sys.modules) |
325 | 325 | self.hooks_were_installed = detect_hooks() |
326 | | - self.scrubbed = scrub_py2_sys_modules() |
| 326 | + # self.scrubbed = scrub_py2_sys_modules() |
327 | 327 | install_hooks() |
328 | 328 | return self |
329 | 329 |
|
330 | 330 | def __exit__(self, *args): |
331 | 331 | # flog.debug('Exiting hooks context manager') |
332 | | - restore_sys_modules(self.scrubbed) |
| 332 | + # restore_sys_modules(self.scrubbed) |
333 | 333 | if not self.hooks_were_installed: |
334 | 334 | remove_hooks() |
335 | | - scrub_future_sys_modules() |
| 335 | + # scrub_future_sys_modules() |
336 | 336 |
|
337 | 337 | # Sanity check for is_py2_stdlib_module(): We aren't replacing any |
338 | 338 | # builtin modules names: |
@@ -418,14 +418,13 @@ class suspend_hooks(object): |
418 | 418 | def __enter__(self): |
419 | 419 | self.hooks_were_installed = detect_hooks() |
420 | 420 | remove_hooks() |
421 | | - self.scrubbed = scrub_future_sys_modules() |
| 421 | + # self.scrubbed = scrub_future_sys_modules() |
422 | 422 | return self |
423 | 423 |
|
424 | 424 | def __exit__(self, *args): |
425 | 425 | if self.hooks_were_installed: |
426 | | - # scrub_py2_sys_modules() # in case they interfere ... e.g. urllib |
427 | 426 | install_hooks() |
428 | | - restore_sys_modules(self.scrubbed) |
| 427 | + # restore_sys_modules(self.scrubbed) |
429 | 428 |
|
430 | 429 |
|
431 | 430 | def restore_sys_modules(scrubbed): |
@@ -547,7 +546,7 @@ def enable_hooks(): |
547 | 546 | install_hooks() |
548 | 547 |
|
549 | 548 |
|
550 | | -def remove_hooks(scrub_sys_modules=True): |
| 549 | +def remove_hooks(scrub_sys_modules=False): |
551 | 550 | """ |
552 | 551 | This function removes the import hook from sys.meta_path. |
553 | 552 | """ |
|
0 commit comments