Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix python 3 compatibility #475

Merged
merged 3 commits into from Jun 17, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGES.rst
Expand Up @@ -59,6 +59,9 @@ Unreleased
- Added a parameter to :class:`~fields.SelectField` to skip choice validation
(`#434`_, `#493`_)
- Permitted underscores in ``HostnameValidation`` (`#463`_)
- Modified the changes made in `#286`_: instead of copying the list of
``choices``, :class:`~fields.SelectField` now uses ``list()`` to construct
a new list of choices. (`#475`_)

.. _#238: https://github.com/wtforms/wtforms/issues/238
.. _#239: https://github.com/wtforms/wtforms/issues/239
Expand Down Expand Up @@ -96,6 +99,7 @@ Unreleased
.. _#434: https://github.com/wtforms/wtforms/issues/434
.. _#463: https://github.com/wtforms/wtforms/pull/463
.. _#471: https://github.com/wtforms/wtforms/pull/471
.. _#475: https://github.com/wtforms/wtforms/pull/475/
.. _#482: https://github.com/wtforms/wtforms/issues/482
.. _#483: https://github.com/wtforms/wtforms/issues/483
.. _#484: https://github.com/wtforms/wtforms/pull/484
Expand Down
3 changes: 1 addition & 2 deletions src/wtforms/fields/core.py
@@ -1,6 +1,5 @@
from __future__ import unicode_literals

from copy import copy
import datetime
import decimal
import itertools
Expand Down Expand Up @@ -519,7 +518,7 @@ def __init__(
):
super(SelectField, self).__init__(label, validators, **kwargs)
self.coerce = coerce
self.choices = copy(choices)
self.choices = list(choices) if choices is not None else None
self.validate_choice = validate_choice

def iter_choices(self):
Expand Down