#23919: Cleanups for when we drop Python 2 compatibility
--------------------------------------+------------------------------------
     Reporter:  Tim Graham            |                    Owner:  nobody
         Type:  Cleanup/optimization  |                   Status:  new
    Component:  Core (Other)          |                  Version:
     Severity:  Normal                |               Resolution:
     Keywords:                        |             Triage Stage:  Accepted
    Has patch:  0                     |      Needs documentation:  0
  Needs tests:  0                     |  Patch needs improvement:  0
Easy pickings:  0                     |                    UI/UX:  0
--------------------------------------+------------------------------------

Old description:

> This is a tracking ticket of things that we can remove when we drop
> Python 2 compatibility in Django 2.0. Please edit the description of the
> ticket as you come across new items.
>
> * ~~`django.core.mail.message.make_msgid()`~~ #23905
> * ~~`django.dispatch.weakref_backports`~~
> * ~~`django.http.cookie` workarounds~~ (remains for Python 3.4)
> * ~~`django.utils.2to3_fixes`~~
> * ~~`django.utils.decorators.ContextDecorator` ~~
> * `django.utils.encoding`
>  * ~~`@python_2_unicode_compatible`~~
>  * ~~force/smart _unicode~~
>  * either force/smart _text or force/smart _str
> [https://github.com/django/django/pull/7913 PR]
> * ~~`django.utils.html_parser.use_workaround`~~
> * ~~`django.utils.http` functions like `urlquote_plus` -- I think the
> versions of these functions on Python 3 don't have the unicode characters
> bug we are working around [https://github.com/django/django/pull/7953 PR]
> * ~~Stop using `django.utils.lru_cache`~~
> * ~~Figure the deprecation plan for `django.utils.lru_cache`~~ (staying
> for now)
> * ~~`django.utils.six`~~
> * ~~`from __future__ import unicode_literals`~~
> * ~~`str()` stuff for environment variables, e.g.
> 0bfb53866199f366ed140d49938fd185e5898156~~
> * ~~`str()` stuff for `type(name)` and `__name__`~~
> * ~~Inheriting from `object` in `django.core.servers.basehttp` (and
> perhaps other places) ala 4ee06ec3fc8e94d164afbd2f9c880c60c658a9ac~~
> * ~~`git grep 'long int'` (mostly docs)~~
> * ~~`django.utils._os [npath,upath]`~~
> * ~~In tests: `contextlib.closing(self.urlopen` (`contextlib.closing` no
> longer needed)~~
> * ~~Support for pysqlite (doesn't support Python 3)~~
> * ~~Replace `super(ClassName, self)` with `super()`~~
> [https://github.com/django/django/pull/7905 PR]
> * ~~Remove `# -*- coding: utf-8 -*-` source file encoding~~ (that's the
> default on Python 3)
> * Evaluate replacement of custom `__del__` methods by
> [https://docs.python.org/3/library/weakref.html#weakref.finalize
> weakref.finalize]
> * ~~Remove `__ne__` from objects already defining a `__eq__`~~
> * ~~Remove note about PYTHONHASHSEED (see #26243)~~
> * Remove Field.creation_counter (replace by metaclass `__prepare__`
> returning `OrderedDict()`,
> https://docs.python.org/3/reference/datamodel.html#preparing-the-class-
> namespace)
> * ~~`django.test.utils.reset_warning_registry()`~~
> * ~~Replace `errno` checks by `IOError` subclasses defined by
> [https://www.python.org/dev/peps/pep-3151/ PEP 3151]~~
> [https://github.com/django/django/pull/7915 PR]
> * ~~`django.utils.glob`~~
> * ~~`django.utils.cookies.SimpleCookie`~~ (remains for Python 3.4
> compatibility)
> * ~~`django.test.mock`~~
> * ~~Replace `tempfile.mkdtemp` + remove with
> `tempfile.TemporaryDirectory` context manager~~
> * ~~Replace `io.open()` by a plain `open()`~~
> * ~~Evaluate need for `assertRegex`, `assertRaisesRegex` in tests. Some
> usage is merely to account for differences in messages between Python 2
> and 3.~~
> * ~~`re.U`, `re.UNICODE` (default behavior of Python 3)~~ -
> [https://github.com/django/django/pull/7879 PR 7879]

New description:

 This is a tracking ticket of things that we can remove when we drop Python
 2 compatibility in Django 2.0. Please edit the description of the ticket
 as you come across new items.

 * ~~`django.core.mail.message.make_msgid()`~~ #23905
 * ~~`django.dispatch.weakref_backports`~~
 * ~~`django.http.cookie` workarounds~~ (remains for Python 3.4)
 * ~~`django.utils.2to3_fixes`~~
 * ~~`django.utils.decorators.ContextDecorator` ~~
 * `django.utils.encoding`
  * ~~`@python_2_unicode_compatible`~~
  * ~~force/smart _unicode~~
  * either force/smart _text or force/smart _str
 [https://github.com/django/django/pull/7913 PR]
 * ~~`django.utils.html_parser.use_workaround`~~
 * ~~`django.utils.http` functions like `urlquote_plus` -- I think the
 versions of these functions on Python 3 don't have the unicode characters
 bug we are working around [https://github.com/django/django/pull/7953 PR]
 * ~~Stop using `django.utils.lru_cache`~~
 * ~~Figure the deprecation plan for `django.utils.lru_cache`~~ (staying
 for now)
 * ~~`django.utils.six`~~
 * ~~`from __future__ import unicode_literals`~~
 * ~~`str()` stuff for environment variables, e.g.
 0bfb53866199f366ed140d49938fd185e5898156~~
 * ~~`str()` stuff for `type(name)` and `__name__`~~
 * ~~Inheriting from `object` in `django.core.servers.basehttp` (and
 perhaps other places) ala 4ee06ec3fc8e94d164afbd2f9c880c60c658a9ac~~
 * ~~`git grep 'long int'` (mostly docs)~~
 * ~~`django.utils._os [npath,upath]`~~
 * ~~In tests: `contextlib.closing(self.urlopen` (`contextlib.closing` no
 longer needed)~~
 * ~~Support for pysqlite (doesn't support Python 3)~~
 * ~~Replace `super(ClassName, self)` with `super()`~~
 [https://github.com/django/django/pull/7905 PR]
 * ~~Remove `# -*- coding: utf-8 -*-` source file encoding~~ (that's the
 default on Python 3)
 * Evaluate replacement of custom `__del__` methods by
 [https://docs.python.org/3/library/weakref.html#weakref.finalize
 weakref.finalize]
 * ~~Remove `__ne__` from objects already defining a `__eq__`~~
 * ~~Remove note about PYTHONHASHSEED (see #26243)~~
 * ~~Remove Field.creation_counter (replace by metaclass `__prepare__`
 returning `OrderedDict()`,
 https://docs.python.org/3/reference/datamodel.html#preparing-the-class-
 namespace)~~ (see comment:95)
 * ~~`django.test.utils.reset_warning_registry()`~~
 * ~~Replace `errno` checks by `IOError` subclasses defined by
 [https://www.python.org/dev/peps/pep-3151/ PEP 3151]~~
 [https://github.com/django/django/pull/7915 PR]
 * ~~`django.utils.glob`~~
 * ~~`django.utils.cookies.SimpleCookie`~~ (remains for Python 3.4
 compatibility)
 * ~~`django.test.mock`~~
 * ~~Replace `tempfile.mkdtemp` + remove with `tempfile.TemporaryDirectory`
 context manager~~
 * ~~Replace `io.open()` by a plain `open()`~~
 * ~~Evaluate need for `assertRegex`, `assertRaisesRegex` in tests. Some
 usage is merely to account for differences in messages between Python 2
 and 3.~~
 * ~~`re.U`, `re.UNICODE` (default behavior of Python 3)~~ -
 [https://github.com/django/django/pull/7879 PR 7879]

--

Comment (by Tim Graham):

 I also looked briefly at models field and manager usage of
 `creation_counter` but it wasn't obvious if the `__prepare__()` approach
 was feasible or if it would be simpler. I think we can defer that task for
 now.

--
Ticket URL: <https://code.djangoproject.com/ticket/23919#comment:96>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/067.524c766707f6d2113b2f34f45e07a394%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to