Skip to content

Lib: Avoid eval() for getting module-level variables #35

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 27, 2017

Conversation

encukou
Copy link
Member

@encukou encukou commented Nov 27, 2017

Alternate version of #25 that avoids eval() entirely.

Issue for a more proper fix filed here: #34

Fixes: #25

This is for compatibility with other libraries that inject
extra variables, like unit testing with pytest.

Based on a suggestion by AlanCoding:
python-ldap#25
@tiran
Copy link
Member

tiran commented Nov 27, 2017

LGTM

(The list() call is properly not necessary. It doesn't hurt either. Keep it)

@encukou encukou merged commit a06267f into python-ldap:master Nov 27, 2017
@encukou
Copy link
Member Author

encukou commented Nov 27, 2017

Actually, it is necessary: the vars() dict changes when o is added to the namespace :)
(Not that I would figure that out without tests...)

@encukou encukou deleted the fix-25 branch November 27, 2017 16:11
@AlanCoding
Copy link

Confirmed that this fixes the traceback in our environment, which was described in https://mail.python.org/pipermail/python-ldap/2016q3/003789.html

Thank you. We will be able to update our dependencies when this goes out in a release.

@tiran
Copy link
Member

tiran commented Nov 27, 2017

Oh fun :/

@codecov
Copy link

codecov bot commented Nov 27, 2017

Codecov Report

Merging #35 into master will decrease coverage by <.01%.
The diff coverage is 100%.

@@            Coverage Diff             @@
##           master      #35      +/-   ##
==========================================
- Coverage   60.99%   60.98%   -0.01%     
==========================================
  Files          46       46              
  Lines        4369     4368       -1     
  Branches      749      749              
==========================================
- Hits         2665     2664       -1     
  Misses       1390     1390              
  Partials      314      314
Impacted Files Coverage Δ
Lib/ldap/schema/subentry.py 54.68% <100%> (-0.17%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 4431a30...a06267f. Read the comment docs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants