Skip to content

Commit ecd533b

Browse files
committed
Lib/ldap: Provide _trace_level and _trace_file in non-debug mode
All use of these attributes *should* be guarded by `if __debug__`. However, that's not always the case. Providing different API based on __debug__ is unnecessarily fragile. This is intended as a quick fix for a maintenance release. Fixes: #226
1 parent 363e417 commit ecd533b

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

Lib/ldap/__init__.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,13 @@
2323
_trace_file = open(_trace_file, 'a')
2424
atexit.register(_trace_file.close)
2525
_trace_stack_limit = None
26+
else:
27+
# Any use of the _trace attributes should be guarded by `if __debug__`,
28+
# so they should not be needed here.
29+
# But, providing different API for debug mode is unnecessarily fragile.
30+
_trace_level = 0
31+
_trace_file = sys.stderr
32+
_trace_stack_limit = None
2633

2734
import _ldap
2835
assert _ldap.__version__==__version__, \

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy