Backport Revert "don't allow GeneralNames to be an empty list (#4128)" (#4161) (#4163)

* Revert "don't allow GeneralNames to be an empty list (#4128)" (#4161)

This breaks the urllib3 tests, as well as several in-the-wild certs

This reverts commit 388d1bd3e9.

* changelog

* Don't reference undocumented class
This commit is contained in:
Alex Gaynor 2018-03-20 17:22:23 -04:00 committed by Paul Kehrer
parent 3eacd87004
commit b17f0527a0
3 changed files with 8 additions and 7 deletions

View file

@ -1,6 +1,14 @@
Changelog
=========
.. _v2-2-1:
2.2.1 - 2018-03-20
~~~~~~~~~~~~~~~~~~
* Reverted a change to ``GeneralNames`` which prohibited having zero elements,
due to breakages.
.. _v2-2:
2.2 - 2018-03-19

View file

@ -1160,9 +1160,6 @@ class Extension(object):
class GeneralNames(object):
def __init__(self, general_names):
general_names = list(general_names)
if len(general_names) == 0:
raise ValueError("Must supply at least one general name")
if not all(isinstance(x, GeneralName) for x in general_names):
raise TypeError(
"Every item in the general_names list must be an "

View file

@ -2052,10 +2052,6 @@ class TestGeneralNames(object):
[x509.DNSName(u"cryptography.io"), "invalid"]
)
def test_does_not_allow_empty_list(self):
with pytest.raises(ValueError):
x509.GeneralNames([])
def test_repr(self):
gns = x509.GeneralNames(
[