| OLD | NEW |
| 1 """Imposter encodings module that installs a coverage-style tracer. | 1 """Imposter encodings module that installs a coverage-style tracer. |
| 2 | 2 |
| 3 This is NOT the encodings module; it is an imposter that sets up tracing | 3 This is NOT the encodings module; it is an imposter that sets up tracing |
| 4 instrumentation and then replaces itself with the real encodings module. | 4 instrumentation and then replaces itself with the real encodings module. |
| 5 | 5 |
| 6 If the directory that holds this file is placed first in the PYTHONPATH when | 6 If the directory that holds this file is placed first in the PYTHONPATH when |
| 7 using "coverage" to run Python's tests, then this file will become the very | 7 using "coverage" to run Python's tests, then this file will become the very |
| 8 first module imported by the internals of Python 3. It installs a | 8 first module imported by the internals of Python 3. It installs a |
| 9 coverage-compatible trace function that can watch Standard Library modules | 9 coverage-compatible trace function that can watch Standard Library modules |
| 10 execute from the very earliest stages of Python's own boot process. This fixes | 10 execute from the very earliest stages of Python's own boot process. This fixes |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 # Finally, remove our own directory from sys.path; remove ourselves from | 48 # Finally, remove our own directory from sys.path; remove ourselves from |
| 49 # sys.modules; and re-import "encodings", which will be the real package | 49 # sys.modules; and re-import "encodings", which will be the real package |
| 50 # this time. Note that the delete from sys.modules dictionary has to | 50 # this time. Note that the delete from sys.modules dictionary has to |
| 51 # happen last, since all of the symbols in this module will become None | 51 # happen last, since all of the symbols in this module will become None |
| 52 # at that exact moment, including "sys". | 52 # at that exact moment, including "sys". |
| 53 | 53 |
| 54 parentdir = max(filter(__file__.startswith, sys.path), key=len) | 54 parentdir = max(filter(__file__.startswith, sys.path), key=len) |
| 55 sys.path.remove(parentdir) | 55 sys.path.remove(parentdir) |
| 56 del sys.modules['encodings'] | 56 del sys.modules['encodings'] |
| 57 import encodings | 57 import encodings |
| OLD | NEW |