aboutsummaryrefslogtreecommitdiff
path: root/youtube_dl/utils.py
diff options
context:
space:
mode:
Diffstat (limited to 'youtube_dl/utils.py')
-rw-r--r--youtube_dl/utils.py20
1 files changed, 1 insertions, 19 deletions
diff --git a/youtube_dl/utils.py b/youtube_dl/utils.py
index 6e4573784..fa16a42ad 100644
--- a/youtube_dl/utils.py
+++ b/youtube_dl/utils.py
@@ -26,7 +26,6 @@ import platform
import re
import socket
import ssl
-import struct
import subprocess
import sys
import tempfile
@@ -53,6 +52,7 @@ from .compat import (
compat_urlparse,
compat_xpath,
shlex_quote,
+ struct_pack,
)
@@ -1761,24 +1761,6 @@ def escape_url(url):
fragment=escape_rfc3986(url_parsed.fragment)
).geturl()
-try:
- struct.pack('!I', 0)
-except TypeError:
- # In Python 2.6 and 2.7.x < 2.7.7, struct requires a bytes argument
- # See https://bugs.python.org/issue19099
- def struct_pack(spec, *args):
- if isinstance(spec, compat_str):
- spec = spec.encode('ascii')
- return struct.pack(spec, *args)
-
- def struct_unpack(spec, *args):
- if isinstance(spec, compat_str):
- spec = spec.encode('ascii')
- return struct.unpack(spec, *args)
-else:
- struct_pack = struct.pack
- struct_unpack = struct.unpack
-
def read_batch_urls(batch_fd):
def fixup(url):