Skip to content

ldap-checker: fix for Python 3.12 compatibility#270

Merged
NeffIsBack merged 1 commit into
Pennyw0rth:mainfrom
exploide:ldap-checker-py3.12
Apr 21, 2024
Merged

ldap-checker: fix for Python 3.12 compatibility#270
NeffIsBack merged 1 commit into
Pennyw0rth:mainfrom
exploide:ldap-checker-py3.12

Conversation

@exploide

Copy link
Copy Markdown
Contributor

The ldap-checker module is currently not compatible with Python 3.12+ because ssl.wrap_socket() was deprecated and has been removed. Fixed this by using SSLContext.wrap_socket() instead.

While doing so, my code linter was complaining so I added a cleanup and code quality commit first. The commits are separate to make reviewing a cleanup commit and a compatibility fix commit easier.

@NeffIsBack

Copy link
Copy Markdown
Member

Thanks for the fix! I'll check it out soon. I would let the elif statements though, there is no reason to check the error multiple times if one matches.

@NeffIsBack NeffIsBack added the bug-fix This Pull Request fixes a bug label Apr 21, 2024
@exploide

Copy link
Copy Markdown
Contributor Author

I would let the elif statements though, there is no reason to check the error multiple times if one matches.

The thing is, there is always a return right before the next if, so it will stop anyway if it evaluates to True once. That's why the linter was complaining.

However, if any stylistic change is not at yours discretion, please let me know. I can change that of course. :)

@NeffIsBack

Copy link
Copy Markdown
Member

I would let the elif statements though, there is no reason to check the error multiple times if one matches.

The thing is, there is always a return right before the next if, so it will stop anyway if it evaluates to True once. That's why the linter was complaining.

However, if any stylistic change is not at yours discretion, please let me know. I can change that of course. :)

Makes sense, i would leave it anyway though, because it is clearer, that we can enter only one if statement.
Btw which linter do you use?

@exploide

Copy link
Copy Markdown
Contributor Author

Okay, just stripped the cleanup commit.

I'm currently using pylint. I know you are using ruff, and I use it on a project at work, too. But haven't switched to it entirely, yet.

@NeffIsBack NeffIsBack left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could reproduce on py3.12.3:
image

Patch LGTM for 3.12 and also 3.11:
image

@NeffIsBack

Copy link
Copy Markdown
Member

@exploide thanks for the report and fix!

@NeffIsBack NeffIsBack merged commit 1f8a0ef into Pennyw0rth:main Apr 21, 2024
@exploide exploide deleted the ldap-checker-py3.12 branch April 22, 2024 17:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug-fix This Pull Request fixes a bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants