Skip to content

Commit cfff2af

Browse files
committed
Fixed #27857 -- Dropped support for Python 3.4.
1 parent a80903b commit cfff2af

File tree

20 files changed

+37
-116
lines changed

20 files changed

+37
-116
lines changed

INSTALL

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Thanks for downloading Django.
22

3-
To install it, make sure you have Python 3.4 or greater installed. Then run
3+
To install it, make sure you have Python 3.5 or greater installed. Then run
44
this command from the command prompt:
55

66
python setup.py install

django/db/models/expressions.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -150,12 +150,6 @@ def __init__(self, output_field=None):
150150
if output_field is not None:
151151
self.output_field = output_field
152152

153-
def __getstate__(self):
154-
# This method required only for Python 3.4.
155-
state = self.__dict__.copy()
156-
state.pop('convert_value', None)
157-
return state
158-
159153
def get_db_converters(self, connection):
160154
return (
161155
[]

django/http/cookie.py

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,7 @@
1-
import sys
21
from http import cookies
32

4-
# Cookie pickling bug is fixed in Python 3.4.3+
5-
# http://bugs.python.org/issue22775
6-
if sys.version_info >= (3, 4, 3):
7-
SimpleCookie = cookies.SimpleCookie
8-
else:
9-
Morsel = cookies.Morsel
10-
11-
class SimpleCookie(cookies.SimpleCookie):
12-
def __setitem__(self, key, value):
13-
if isinstance(value, Morsel):
14-
# allow assignment of constructed Morsels (e.g. for pickling)
15-
dict.__setitem__(self, key, value)
16-
else:
17-
super().__setitem__(key, value)
3+
# For backwards compatibility in Django 2.1.
4+
SimpleCookie = cookies.SimpleCookie
185

196

207
def parse_cookie(cookie):

django/test/html.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
"""Compare two HTML documents."""
22

33
import re
4-
5-
from django.utils.html_parser import HTMLParseError, HTMLParser
4+
from html.parser import HTMLParser
65

76
WHITESPACE = re.compile(r'\s+')
87

@@ -138,14 +137,18 @@ def __str__(self):
138137
return ''.join(str(c) for c in self.children)
139138

140139

140+
class HTMLParseError(Exception):
141+
pass
142+
143+
141144
class Parser(HTMLParser):
142145
SELF_CLOSING_TAGS = (
143146
'br', 'hr', 'input', 'img', 'meta', 'spacer', 'link', 'frame', 'base',
144147
'col',
145148
)
146149

147150
def __init__(self):
148-
HTMLParser.__init__(self)
151+
HTMLParser.__init__(self, convert_charrefs=False)
149152
self.root = RootElement()
150153
self.open_tags = []
151154
self.element_positions = {}

django/urls/converters.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,7 @@ def register_converter(converter, type_name):
6060

6161
@lru_cache.lru_cache(maxsize=None)
6262
def get_converters():
63-
converters = {}
64-
converters.update(DEFAULT_CONVERTERS)
65-
converters.update(REGISTERED_CONVERTERS)
66-
return converters
63+
return {**DEFAULT_CONVERTERS, **REGISTERED_CONVERTERS}
6764

6865

6966
def get_converter(raw_converter):

django/urls/resolvers.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -343,9 +343,7 @@ def lookup_str(self):
343343
'path.to.ClassBasedView').
344344
"""
345345
callback = self.callback
346-
# Python 3.5 collapses nested partials, so can change "while" to "if"
347-
# when it's the minimum supported version.
348-
while isinstance(callback, functools.partial):
346+
if isinstance(callback, functools.partial):
349347
callback = callback.func
350348
if not hasattr(callback, '__name__'):
351349
return callback.__module__ + "." + callback.__class__.__name__

django/utils/html.py

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
"""HTML utilities suitable for global use."""
22

33
import re
4+
from html.parser import HTMLParser
45
from urllib.parse import (
56
parse_qsl, quote, unquote, urlencode, urlsplit, urlunsplit,
67
)
@@ -11,8 +12,6 @@
1112
from django.utils.safestring import SafeData, SafeText, mark_safe
1213
from django.utils.text import normalize_newlines
1314

14-
from .html_parser import HTMLParseError, HTMLParser
15-
1615
# Configuration for urlize() function.
1716
TRAILING_PUNCTUATION_RE = re.compile(
1817
'^' # Beginning of word
@@ -132,7 +131,7 @@ def linebreaks(value, autoescape=False):
132131

133132
class MLStripper(HTMLParser):
134133
def __init__(self):
135-
HTMLParser.__init__(self)
134+
HTMLParser.__init__(self, convert_charrefs=False)
136135
self.reset()
137136
self.fed = []
138137

@@ -154,16 +153,9 @@ def _strip_once(value):
154153
Internal tag stripping utility used by strip_tags.
155154
"""
156155
s = MLStripper()
157-
try:
158-
s.feed(value)
159-
except HTMLParseError:
160-
return value
161-
try:
162-
s.close()
163-
except HTMLParseError:
164-
return s.get_data() + s.rawdata
165-
else:
166-
return s.get_data()
156+
s.feed(value)
157+
s.close()
158+
return s.get_data()
167159

168160

169161
@keep_lazy_text

django/utils/html_parser.py

Lines changed: 0 additions & 17 deletions
This file was deleted.

docs/intro/contributing.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -288,9 +288,9 @@ Once the tests complete, you should be greeted with a message informing you
288288
whether the test suite passed or failed. Since you haven't yet made any changes
289289
to Django's code, the entire test suite **should** pass. If you get failures or
290290
errors make sure you've followed all of the previous steps properly. See
291-
:ref:`running-unit-tests` for more information. If you're using Python 3.5+,
292-
there will be a couple failures related to deprecation warnings that you can
293-
ignore. These failures have since been fixed in Django.
291+
:ref:`running-unit-tests` for more information. There will be a couple failures
292+
related to deprecation warnings that you can ignore. These failures have since
293+
been fixed in Django.
294294

295295
Note that the latest Django trunk may not always be stable. When developing
296296
against trunk, you can check `Django's continuous integration builds`__ to

docs/intro/install.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ your operating system's package manager.
2929
You can verify that Python is installed by typing ``python`` from your shell;
3030
you should see something like::
3131

32-
Python 3.4.x
32+
Python 3.x.y
3333
[GCC 4.x] on linux
3434
Type "help", "copyright", "credits" or "license" for more information.
3535
>>>

0 commit comments

Comments
 (0)