-
Notifications
You must be signed in to change notification settings - Fork 449
Open
Labels
Description
Tracer Version(s)
2.18.1
Python Version(s)
Python 3.11.1
Pip Version(s)
pip 25.1.1
Bug Report
Hello !
I got a issubclass
TypeError when using Datadog APM with ddtrace.patch_all
.
The stacktrace of the below reproduction code:
Traceback (most recent call last):
File "/Users/paulmilesi/Repos/api/ddtrace_issue.py", line 17, in <module>
issubclass(psycopg.AsyncCursor, SomeClass)
File "<frozen abc>", line 123, in __subclasscheck__
TypeError: issubclass() arg 1 must be a class
In my app, patch_all
patches psycopg.AsyncCursor
and my app then crashes when running issubclass
on psycopg.AsyncCursor
against a class subclassing abc.ABC
. patch_all
uses wrapt.FunctionWrapper
to patch psycopg.AsyncCursor
and there a wrapt/stdlib issue when checking against ABC
classes.
I am not sure you can do anything about it...
Please find the related issues in wrapt
and python stdlib
too:
- Cannot use issubclass on decorated class derived from abc.ABC GrahamDumpleton/wrapt#130
- ABCMeta.__subclasscheck__() doesn't support duck typing. python/cpython#89010
Reproduction Code
import abc
from ddtrace import patch_all
patch_all()
import psycopg
class SomeClass(abc.ABC):
@abc.abstractmethod
def some_method(self):
pass
issubclass(psycopg.AsyncCursor, SomeClass)
Error Logs
No response
Libraries in Use
psycopg==3.2.9
Operating System
Darwin Mac.lan 24.1.0 Darwin Kernel Version 24.1.0