#36646: oracledb 3.4.0 TypeError: isinstance() arg 2 must be a type, a tuple of
types, or a union
-------------------------------------+-------------------------------------
     Reporter:  John Wagenleitner    |                    Owner:  (none)
         Type:  New feature          |                   Status:  new
    Component:  Database layer       |                  Version:  5.2
  (models, ORM)                      |
     Severity:  Normal               |               Resolution:
     Keywords:  Oracle               |             Triage Stage:  Accepted
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------
Changes (by Natalia Bidart):

 * cc: Mariusz Felisiak, Simon Charette (added)
 * stage:  Unreviewed => Accepted
 * type:  Uncategorized => New feature

Comment:

 Thank you John Wagenleitner, do you have availability to work on the fix?
 It seems that our `Database.Date` and `Database.Timestamp` may also be
 affected?

 Setting as "New Feature" since oracledb 3.4.0 was released October 2025.

 For reference, [https://github.com/oracle/python-
 oracledb/commit/869a887819cdac7fcd610f9d9d463ade49ea7de6 commit
 869a887819cdac7fcd610f9d9d463ade49ea7de6] contains:
 {{{#!diff
 --- a/src/oracledb/constructors.py
 +++ b/src/oracledb/constructors.py
 @@ -29,22 +29,23 @@
  #
 -----------------------------------------------------------------------------

  import datetime
 +from typing import Any

  from . import errors

 -# synonyms for the types mandated by the database API
 -Binary = bytes
 -Date = datetime.date
 -Timestamp = datetime.datetime

 +def Binary(value: Any) -> bytes:
 +    """
 +    Constructs an object holding a binary (long) string value.
 +    """
 +    return bytes(value)

 -def Time(hour: int, minute: int, second: int) -> None:
 +
 +def Date(year: int, month: int, day: int) -> datetime.date:
      """
 -    Constructor mandated by the database API for creating a time value.
 Since
 -    Oracle doesn't support time only values, an exception is raised when
 this
 -    method is called.
 +    Constructs an object holding a date value.
      """
 -    errors._raise_err(errors.ERR_TIME_NOT_SUPPORTED)
 +    return datetime.date(year, month, day)


  def DateFromTicks(ticks: float) -> datetime.date:
 @@ -56,6 +57,15 @@ def DateFromTicks(ticks: float) -> datetime.date:
      return datetime.date.fromtimestamp(ticks)


 +def Time(hour: int, minute: int, second: int) -> None:
 +    """
 +    Constructor mandated by the database API for creating a time value.
 Since
 +    Oracle doesn't support time only values, an exception is raised when
 this
 +    method is called.
 +    """
 +    errors._raise_err(errors.ERR_TIME_NOT_SUPPORTED)
 +
 +
  def TimeFromTicks(ticks: float) -> None:
      """
      Constructor mandated by the database API for creating a time value
 given
 @@ -66,6 +76,20 @@ def TimeFromTicks(ticks: float) -> None:
      errors._raise_err(errors.ERR_TIME_NOT_SUPPORTED)


 +def Timestamp(
 +    year: int,
 +    month: int,
 +    day: int,
 +    hour: int = 0,
 +    minute: int = 0,
 +    second: int = 0,
 +) -> datetime.datetime:
 +    """
 +    Constructs an object holding a time stamp value.
 +    """
 +    return datetime.datetime(year, month, day, hour, minute, second)
 +
 +
  def TimestampFromTicks(ticks: float) -> datetime.datetime:
      """
      Constructor mandated by the database API for creating a timestamp
 value
 }}}
-- 
Ticket URL: <https://code.djangoproject.com/ticket/36646#comment:1>
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/01070199c18db6ae-e13d965d-33eb-42c2-a1e0-3fd6b8c51b4e-000000%40eu-central-1.amazonses.com.

Reply via email to