Skip to content

Commit a06267f

Browse files
committed
Lib: Avoid eval() for getting module-level variables
This is for compatibility with other libraries that inject extra variables, like unit testing with pytest. Based on a suggestion by AlanCoding: #25
1 parent 4431a30 commit a06267f

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

Lib/ldap/schema/subentry.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,7 @@
1111
SCHEMA_CLASS_MAPPING = ldap.cidict.cidict()
1212
SCHEMA_ATTR_MAPPING = {}
1313

14-
for _name in dir():
15-
o = eval(_name)
14+
for o in list(vars().values()):
1615
if hasattr(o,'schema_attribute'):
1716
SCHEMA_CLASS_MAPPING[o.schema_attribute] = o
1817
SCHEMA_ATTR_MAPPING[o] = o.schema_attribute

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