Opened 3 months ago

Last modified 3 months ago

#35699 closed Bug

DatabaseOperations raise ValueError for valid GenericIPAddressField (inet) value with psycopg3 — at Initial Version

Reported by: florianvazelle Owned by:
Component: Database layer (models, ORM) Version:
Severity: Normal Keywords: psycopg3, GenericIPAddressField
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

I move recently to psycopg3, and it's seems that the Inet class change to be an alias of ipaddress.ip_address in https://github.com/django/django/blob/main/django/db/backends/postgresql/psycopg_any.py#L12.
But some valid inet value raise an ValueError, such as:

>>> import ipaddress
>>> ipaddress.ip_address("192.168.1/24")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/florian/.pyenv/versions/3.11.9/lib/python3.11/ipaddress.py", line 54, in ip_address
    raise ValueError(f'{address!r} does not appear to be an IPv4 or IPv6 address')
ValueError: '192.168.1/24' does not appear to be an IPv4 or IPv6 address

Change History (0)

Note: See TracTickets for help on using tickets.
Back to Top