Skip to content

Commit 1140996

Browse files
committed
added import error for python3.6 on dataclasses, since its not mandatory we just ignore it
1 parent 7576c47 commit 1140996

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

Lib/ldappool/__init__.py

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1-
import dataclasses
1+
try:
2+
import dataclasses
3+
except ImportError:
4+
# we are on python < 3.7 so ignore
5+
pass
26
import logging
37
import sys
48
import threading
@@ -28,8 +32,12 @@ class LDAPLockTimeout(Exception):
2832

2933

3034
def e2c(entry):
31-
cls = dataclasses.make_dataclass("", ["dn"] + list(entry[1].keys()), frozen=True)
32-
return cls(**dict(list([("dn", entry[0])] + list(entry[1].items()))))
35+
try:
36+
cls = dataclasses.make_dataclass("", ["dn"] + list(entry[1].keys()), frozen=True)
37+
return cls(**dict(list([("dn", entry[0])] + list(entry[1].items()))))
38+
except NameError as dcerror:
39+
print(f"dataclasses not supported")
40+
return entry
3341

3442

3543
class Connection(object):

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