#36098: TypeError: object of type 'IPv6Address' has no len() when running tests
with GeoDjango
-------------------------------------+-------------------------------------
     Reporter:  Natalia Bidart       |                    Owner:  Mariusz
                                     |  Felisiak
         Type:  Bug                  |                   Status:  assigned
    Component:  GIS                  |                  Version:  5.1
     Severity:  Release blocker      |               Resolution:
     Keywords:                       |             Triage Stage:  Accepted
    Has patch:  1                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------
Changes (by Natalia Bidart):

 * has_patch:  0 => 1
 * owner:  Natalia Bidart => Mariusz Felisiak


Old description:

> Following the security release for 5.1.5, 5.0.11 and 4.2.18, there seems
> to be an issue with the GeoDjango tests:
> {{{
> Traceback (most recent call last):
>   File "/home/jenkins/workspace/pull-requests-
> focal/database/mysql_gis/label/focal-
> pr/python/python3.10/django/core/validators.py", line 305, in
> validate_ipv4_address
>     ipaddress.IPv4Address(value)
>   File "/usr/lib/python3.10/ipaddress.py", line 1305, in __init__
>     self._ip = self._ip_int_from_string(addr_str)
>   File "/usr/lib/python3.10/ipaddress.py", line 1192, in
> _ip_int_from_string
>     raise AddressValueError("Expected 4 octets in %r" % ip_str)
> ipaddress.AddressValueError: Expected 4 octets in '::ffff:27d:a0d8'
>
> During handling of the above exception, another exception occurred:
>
> Traceback (most recent call last):
>   File "/home/jenkins/workspace/pull-requests-
> focal/database/mysql_gis/label/focal-
> pr/python/python3.10/django/core/validators.py", line 325, in
> validate_ipv46_address
>     validate_ipv4_address(value)
>   File "/home/jenkins/workspace/pull-requests-
> focal/database/mysql_gis/label/focal-
> pr/python/python3.10/django/core/validators.py", line 307, in
> validate_ipv4_address
>     raise ValidationError(
> django.core.exceptions.ValidationError: ['Enter a valid IPv4 address.']
>
> During handling of the above exception, another exception occurred:
>
> Traceback (most recent call last):
>   File "/home/jenkins/workspace/pull-requests-
> focal/database/mysql_gis/label/focal-
> pr/python/python3.10/tests/gis_tests/test_geoip2.py", line 131, in
> test_country
>     self.assertEqual(g.country(query), self.expected_country)
>   File "/home/jenkins/workspace/pull-requests-
> focal/database/mysql_gis/label/focal-
> pr/python/python3.10/django/contrib/gis/geoip2.py", line 207, in country
>     response = self._query(query, require_city=False)
>   File "/home/jenkins/workspace/pull-requests-
> focal/database/mysql_gis/label/focal-
> pr/python/python3.10/django/contrib/gis/geoip2.py", line 157, in _query
>     validate_ipv46_address(query)
>   File "/home/jenkins/workspace/pull-requests-
> focal/database/mysql_gis/label/focal-
> pr/python/python3.10/django/core/validators.py", line 328, in
> validate_ipv46_address
>     validate_ipv6_address(value)
>   File "/home/jenkins/workspace/pull-requests-
> focal/database/mysql_gis/label/focal-
> pr/python/python3.10/django/core/validators.py", line 315, in
> validate_ipv6_address
>     if not is_valid_ipv6_address(value):
>   File "/home/jenkins/workspace/pull-requests-
> focal/database/mysql_gis/label/focal-
> pr/python/python3.10/django/utils/ipv6.py", line 59, in
> is_valid_ipv6_address
>     _ipv6_address_from_str(ip_str)
>   File "/home/jenkins/workspace/pull-requests-
> focal/database/mysql_gis/label/focal-
> pr/python/python3.10/django/utils/ipv6.py", line 10, in
> _ipv6_address_from_str
>     if len(ip_str) > max_length:
> TypeError: object of type 'IPv6Address' has no len()
>
> ======================================================================
> ERROR [0.003s]: test_country_using_city_database
> (gis_tests.test_geoip2.GeoIP2Test) (query=IPv6Address('::ffff:27d:a0d8'))
> ----------------------------------------------------------------------
> Traceback (most recent call last):
>   File "/home/jenkins/workspace/pull-requests-
> focal/database/mysql_gis/label/focal-
> pr/python/python3.10/django/core/validators.py", line 305, in
> validate_ipv4_address
>     ipaddress.IPv4Address(value)
>   File "/usr/lib/python3.10/ipaddress.py", line 1305, in __init__
>     self._ip = self._ip_int_from_string(addr_str)
>   File "/usr/lib/python3.10/ipaddress.py", line 1192, in
> _ip_int_from_string
>     raise AddressValueError("Expected 4 octets in %r" % ip_str)
> ipaddress.AddressValueError: Expected 4 octets in '::ffff:27d:a0d8'
>
> During handling of the above exception, another exception occurred:
>
> Traceback (most recent call last):
>   File "/home/jenkins/workspace/pull-requests-
> focal/database/mysql_gis/label/focal-
> pr/python/python3.10/django/core/validators.py", line 325, in
> validate_ipv46_address
>     validate_ipv4_address(value)
>   File "/home/jenkins/workspace/pull-requests-
> focal/database/mysql_gis/label/focal-
> pr/python/python3.10/django/core/validators.py", line 307, in
> validate_ipv4_address
>     raise ValidationError(
> django.core.exceptions.ValidationError: ['Enter a valid IPv4 address.']
>
> During handling of the above exception, another exception occurred:
>
> Traceback (most recent call last):
>   File "/home/jenkins/workspace/pull-requests-
> focal/database/mysql_gis/label/focal-
> pr/python/python3.10/tests/gis_tests/test_geoip2.py", line 145, in
> test_country_using_city_database
>     self.assertEqual(g.country(query), self.expected_country)
>   File "/home/jenkins/workspace/pull-requests-
> focal/database/mysql_gis/label/focal-
> pr/python/python3.10/django/contrib/gis/geoip2.py", line 207, in country
>     response = self._query(query, require_city=False)
>   File "/home/jenkins/workspace/pull-requests-
> focal/database/mysql_gis/label/focal-
> pr/python/python3.10/django/contrib/gis/geoip2.py", line 157, in _query
>     validate_ipv46_address(query)
>   File "/home/jenkins/workspace/pull-requests-
> focal/database/mysql_gis/label/focal-
> pr/python/python3.10/django/core/validators.py", line 328, in
> validate_ipv46_address
>     validate_ipv6_address(value)
>   File "/home/jenkins/workspace/pull-requests-
> focal/database/mysql_gis/label/focal-
> pr/python/python3.10/django/core/validators.py", line 315, in
> validate_ipv6_address
>     if not is_valid_ipv6_address(value):
>   File "/home/jenkins/workspace/pull-requests-
> focal/database/mysql_gis/label/focal-
> pr/python/python3.10/django/utils/ipv6.py", line 59, in
> is_valid_ipv6_address
>     _ipv6_address_from_str(ip_str)
>   File "/home/jenkins/workspace/pull-requests-
> focal/database/mysql_gis/label/focal-
> pr/python/python3.10/django/utils/ipv6.py", line 10, in
> _ipv6_address_from_str
>     if len(ip_str) > max_length:
> TypeError: object of type 'IPv6Address' has no len()
> }}}

New description:

 Following the security release for 5.1.5, 5.0.11 and 4.2.18, there seems
 to be an issue with the GeoDjango tests:
 {{{
 Traceback (most recent call last):
   File "/home/jenkins/workspace/pull-requests-
 focal/database/mysql_gis/label/focal-
 pr/python/python3.10/django/core/validators.py", line 305, in
 validate_ipv4_address
     ipaddress.IPv4Address(value)
   File "/usr/lib/python3.10/ipaddress.py", line 1305, in __init__
     self._ip = self._ip_int_from_string(addr_str)
   File "/usr/lib/python3.10/ipaddress.py", line 1192, in
 _ip_int_from_string
     raise AddressValueError("Expected 4 octets in %r" % ip_str)
 ipaddress.AddressValueError: Expected 4 octets in '::ffff:27d:a0d8'

 During handling of the above exception, another exception occurred:

 Traceback (most recent call last):
   File "/home/jenkins/workspace/pull-requests-
 focal/database/mysql_gis/label/focal-
 pr/python/python3.10/django/core/validators.py", line 325, in
 validate_ipv46_address
     validate_ipv4_address(value)
   File "/home/jenkins/workspace/pull-requests-
 focal/database/mysql_gis/label/focal-
 pr/python/python3.10/django/core/validators.py", line 307, in
 validate_ipv4_address
     raise ValidationError(
 django.core.exceptions.ValidationError: ['Enter a valid IPv4 address.']

 During handling of the above exception, another exception occurred:

 Traceback (most recent call last):
   File "/home/jenkins/workspace/pull-requests-
 focal/database/mysql_gis/label/focal-
 pr/python/python3.10/tests/gis_tests/test_geoip2.py", line 131, in
 test_country
     self.assertEqual(g.country(query), self.expected_country)
   File "/home/jenkins/workspace/pull-requests-
 focal/database/mysql_gis/label/focal-
 pr/python/python3.10/django/contrib/gis/geoip2.py", line 207, in country
     response = self._query(query, require_city=False)
   File "/home/jenkins/workspace/pull-requests-
 focal/database/mysql_gis/label/focal-
 pr/python/python3.10/django/contrib/gis/geoip2.py", line 157, in _query
     validate_ipv46_address(query)
   File "/home/jenkins/workspace/pull-requests-
 focal/database/mysql_gis/label/focal-
 pr/python/python3.10/django/core/validators.py", line 328, in
 validate_ipv46_address
     validate_ipv6_address(value)
   File "/home/jenkins/workspace/pull-requests-
 focal/database/mysql_gis/label/focal-
 pr/python/python3.10/django/core/validators.py", line 315, in
 validate_ipv6_address
     if not is_valid_ipv6_address(value):
   File "/home/jenkins/workspace/pull-requests-
 focal/database/mysql_gis/label/focal-
 pr/python/python3.10/django/utils/ipv6.py", line 59, in
 is_valid_ipv6_address
     _ipv6_address_from_str(ip_str)
   File "/home/jenkins/workspace/pull-requests-
 focal/database/mysql_gis/label/focal-
 pr/python/python3.10/django/utils/ipv6.py", line 10, in
 _ipv6_address_from_str
     if len(ip_str) > max_length:
 TypeError: object of type 'IPv6Address' has no len()
 }}}

--
-- 
Ticket URL: <https://code.djangoproject.com/ticket/36098#comment:3>
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 [email protected].
To view this discussion visit 
https://groups.google.com/d/msgid/django-updates/0107019466edfc07-35a07a2d-e2a3-48f5-a4f6-c8036509d423-000000%40eu-central-1.amazonses.com.

Reply via email to