Skip to content

Commit e9db983

Browse files
Ensured the name of wrapped functions are the same as the function being
wrapped in order to improve error messages that reference them.
1 parent ffa99bd commit e9db983

File tree

5 files changed

+18
-7
lines changed

5 files changed

+18
-7
lines changed

doc/src/release_notes.rst

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,15 @@ python-oracledb Release Notes
88
For deprecations, see :ref:`Deprecations <deprecations>`.
99

1010

11-
oracledb 1.0 (May 2022)
12-
-----------------------
11+
oracledb 1.0.1 (TBD)
12+
--------------------
13+
14+
#) Ensured the name of wrapped functions are the same as the function being
15+
wrapped in order to improve error messages that reference them.
16+
17+
18+
oracledb 1.0.0 (May 2022)
19+
-------------------------
1320

1421
#) Renamed cx_Oracle to python-oracledb. See :ref:`upgradecomparison`.
1522
#) Python-oracledb is a 'Thin' driver by default that connects directly

src/oracledb/connect_params.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -261,25 +261,27 @@ def _address_attr(f):
261261
"""
262262
Helper function used to get address level attributes.
263263
"""
264-
def wrapped_func(self):
264+
def wrapped(self):
265265
output = []
266266
for description in self._impl.description_list.descriptions:
267267
for address_list in description.address_lists:
268268
for address in address_list.addresses:
269269
output.append(getattr(address, f.__name__))
270270
return output if len(output) > 1 else output[0]
271-
return wrapped_func
271+
wrapped.__qualname__ = f.__qualname__
272+
return wrapped
272273

273274
def _description_attr(f):
274275
"""
275276
Helper function used to get description level attributes.
276277
"""
277-
def wrapped_func(self):
278+
def wrapped(self):
278279
output = []
279280
for description in self._impl.description_list.descriptions:
280281
output.append(getattr(description, f.__name__))
281282
return output if len(output) > 1 else output[0]
282-
return wrapped_func
283+
wrapped.__qualname__ = f.__qualname__
284+
return wrapped
283285

284286
@property
285287
def appcontext(self) -> list:

src/oracledb/connection.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -993,6 +993,7 @@ def wrapped(dsn: str=None, *,
993993
if not issubclass(conn_class, Connection):
994994
errors._raise_err(errors.INVALID_CONN_CLASS)
995995
return conn_class(dsn=dsn, pool=pool, params=params, **kwargs)
996+
wrapped.__qualname__ = f.__qualname__
996997
return wrapped
997998

998999

src/oracledb/pool.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -527,6 +527,7 @@ def wrapped(dsn: str=None, *,
527527
if not issubclass(pool_class, ConnectionPool):
528528
errors._raise_err(errors.INVALID_POOL_CLASS)
529529
return pool_class(dsn, params=params, **kwargs)
530+
wrapped.__qualname__ = f.__qualname__
530531
return wrapped
531532

532533

src/oracledb/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,4 @@
2929
# found. The setup.cfg configuration file references this file directly.
3030
#------------------------------------------------------------------------------
3131

32-
__version__ = "1.0.0"
32+
__version__ = "1.0.1"

0 commit comments

Comments
 (0)