]> 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:14 +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 83b2882123f93d9c2c14a90d1b3c9247a355702f..2639f758caacd6e84046b4eaba4a9db447b68fb1 100644 (file)
@@ -67,7 +67,6 @@ class PGconn:
     Python representation of a libpq connection.
     """
 
-    __module__ = "psycopg.pq"
     __slots__ = (
         "_pgconn_ptr",
         "notice_handler",
@@ -729,7 +728,6 @@ class PGresult:
     Python representation of a libpq result.
     """
 
-    __module__ = "psycopg.pq"
     __slots__ = ("_pgresult_ptr",)
 
     def __init__(self, pgresult_ptr: impl.PGresult_struct):
@@ -860,7 +858,6 @@ class PGcancel:
     Created by `PGconn.get_cancel()`.
     """
 
-    __module__ = "psycopg.pq"
     __slots__ = ("pgcancel_ptr",)
 
     def __init__(self, pgcancel_ptr: impl.PGcancel_struct):
@@ -901,8 +898,6 @@ class Conninfo:
     Utility object to manipulate connection strings.
     """
 
-    __module__ = "psycopg.pq"
-
     @classmethod
     def get_defaults(cls) -> List[ConninfoOption]:
         opts = impl.PQconndefaults()
@@ -956,8 +951,6 @@ class Escaping:
     Utility object to escape strings for SQL interpolation.
     """
 
-    __module__ = "psycopg.pq"
-
     def __init__(self, conn: Optional[PGconn] = None):
         self.conn = conn