]> git.ipfire.org Git - thirdparty/psycopg.git/commitdiff
Don't overwrite the module of the psycopg.pq.pq_ctypes objects
authorDaniele Varrazzo <daniele.varrazzo@gmail.com>
Fri, 7 Jan 2022 17:32:47 +0000 (18:32 +0100)
committerDaniele Varrazzo <daniele.varrazzo@gmail.com>
Fri, 7 Jan 2022 17:39:41 +0000 (18:39 +0100)
It might be useful to tell apart the C version from the python versions
for debugging. The C versions don't do it, so they repr as:

    <psycopg_binary.pq.PGconn [IDLE] (database=piro) at 0x7f8556deb040>

See #201.

psycopg/psycopg/pq/pq_ctypes.py

index 2d1d96e0c65175721bd34c1626b855e624353d37..eb15f9b9961b5030d2977f1e4233cb066c75d6da 100644 (file)
@@ -66,7 +66,6 @@ class PGconn:
     Python representation of a libpq connection.
     """
 
-    __module__ = "psycopg.pq"
     __slots__ = (
         "_pgconn_ptr",
         "notice_handler",
@@ -716,7 +715,6 @@ class PGresult:
     Python representation of a libpq result.
     """
 
-    __module__ = "psycopg.pq"
     __slots__ = ("_pgresult_ptr",)
 
     def __init__(self, pgresult_ptr: impl.PGresult_struct):
@@ -847,7 +845,6 @@ class PGcancel:
     Created by `PGconn.get_cancel()`.
     """
 
-    __module__ = "psycopg.pq"
     __slots__ = ("pgcancel_ptr",)
 
     def __init__(self, pgcancel_ptr: impl.PGcancel_struct):
@@ -888,8 +885,6 @@ class Conninfo:
     Utility object to manipulate connection strings.
     """
 
-    __module__ = "psycopg.pq"
-
     @classmethod
     def get_defaults(cls) -> List[ConninfoOption]:
         opts = impl.PQconndefaults()
@@ -943,8 +938,6 @@ class Escaping:
     Utility object to escape strings for SQL interpolation.
     """
 
-    __module__ = "psycopg.pq"
-
     def __init__(self, conn: Optional[PGconn] = None):
         self.conn = conn