(self, libpath: str, *, import_site: bool)
| 708 | return sys_path |
| 709 | |
| 710 | def _get_pth_lines(self, libpath: str, *, import_site: bool): |
| 711 | pth_lines = ['fake-path-name'] |
| 712 | # include 200 lines of `libpath` in _pth lines (or fewer |
| 713 | # if the `libpath` is long enough to get close to 32KB |
| 714 | # see https://github.com/python/cpython/issues/113628) |
| 715 | encoded_libpath_length = len(libpath.encode("utf-8")) |
| 716 | repetitions = min(200, 30000 // encoded_libpath_length) |
| 717 | if repetitions <= 2: |
| 718 | self.skipTest( |
| 719 | f"Python stdlib path is too long ({encoded_libpath_length:,} bytes)") |
| 720 | pth_lines.extend(libpath for _ in range(repetitions)) |
| 721 | pth_lines.extend(['', '# comment']) |
| 722 | if import_site: |
| 723 | pth_lines.append('import site') |
| 724 | return pth_lines |
| 725 | |
| 726 | @unittest.expectedFailure # TODO: RUSTPYTHON |
| 727 | @support.requires_subprocess() |
no test coverage detected