This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python3 | |
import http.server, ssl, argparse, re | |
from tempfile import mkdtemp | |
from shutil import rmtree | |
from contextlib import contextmanager | |
from os.path import exists, join, abspath | |
@contextmanager | |
def TemporaryDirectory(): | |
name = mkdtemp() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# found this from Armin R. on Twitter, what a beautiful gem ;) | |
import ctypes | |
from types import MappingProxyType, MethodType | |
# figure out side of _Py_ssize_t | |
if hasattr(ctypes.pythonapi, 'Py_InitModule4_64'): | |
_Py_ssize_t = ctypes.c_int64 | |
else: | |
_Py_ssize_t = ctypes.c_int |