8000 Voice response devx5021 and Python testing, compatibility by ilanbiala · Pull Request #346 · twilio/twilio-python · GitHub
[go: up one dir, main page]

Skip to content

Voice response devx5021 and Python testing, compatibility #346

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 5 commits into from
Jun 15, 2017
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Fix deprecated decorator function that didn't work in Python 3
  • Loading branch information
ilanbiala committed Jun 5, 2017
commit 3519817fabb52aa84bad2f0bfbab40ab98da9df2
10 changes: 4 additions & 6 deletions twilio/jwt/access_token/grants.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,11 @@ def deprecated(func):

@functools.wraps(func)
def new_func(*args, **kwargs):
warnings.warn_explicit(
"Call to deprecated function {}.".format(func.__name__),
category=DeprecationWarning,
filename=func.func_code.co_filename,
lineno=func.func_code.co_firstlineno + 1
)
warnings.simplefilter('always', DeprecationWarning)
warnings.warn("Call to deprecated function {}.".format(func.__name__), category=DeprecationWarning, stacklevel=2)
Copy link
Contributor

Choose a reason for hiding this comment

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

why did this need to change?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

func.func_code is no longer an attribute in Python 3, and the decorator is only used on grants.py:108.

Copy link
Contributor

Choose a reason for hiding this comment

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

ok

warnings.simplefilter('default', DeprecationWarning)
return func(*args, **kwargs)

return new_func


Expand Down
0