GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Fix loading page sources that contain 8-bit characters under python3 · grisha/mod_python@04d331a

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • lib/python/mod_python
    • cache.py
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎lib/python/mod_python/cache.py‎

Copy file name to clipboardExpand all lines: lib/python/mod_python/cache.py
+3-2Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -369,15 +369,16 @@ class ModuleCache(FileCache):
369369
This module is not inserted into sys.modules.
370370
"""
371371
def __init__(self, max_size=0):
372-
FileCache.__init__(self, max_size, 'r')
372+
FileCache.__init__(self, max_size, 'rb')
373373

374374
def build(self, key, name, opened, entry):
375375
try:
376376
if hasattr(opened, "read"):
377377
opened_as_str = opened.read()
378378
module = types.ModuleType(re_not_word.sub('_',key))
379379
module.__file__ = key
380-
exec(opened_as_str, module.__dict__)
380+
code = compile(opened_as_str, key, 'exec')
381+
exec(code, module.__dict__)
381382
return module
382383
finally:
383384
opened.close()

0 commit comments

Comments
0 (0)
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.