-
-
Notifications
You must be signed in to change notification settings - Fork 421
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
There is a problem with python 3.8 and escape sequence: #473
Comments
Cannot reproduce locally: $ tox -e py38
GLOB sdist-make: /private/tmp/requests-oauthlib/setup.py
py38 inst-nodeps: /private/tmp/requests-oauthlib/.tox/.tmp/package/1/requests-oauthlib-1.3.0.zip
py38 installed: certifi==2021.10.8,cffi==1.15.0,charset-normalizer==2.0.9,coverage==5.5,coveralls==3.2.0,cryptography==3.4.8,docopt==0.6.2,idna==3.3,mock==4.0.3,oauthlib==3.1.1,pycparser==2.21,PyJWT==2.3.0,requests==2.26.0,requests-mock==1.9.3,requests-oauthlib @ file:///private/tmp/requests-oauthlib/.tox/.tmp/package/1/requests-oauthlib-1.3.0.zip,six==1.16.0,urllib3==1.26.7
py38 run-test-pre: PYTHONHASHSEED='1197210308'
py38 run-test: commands[0] | coverage run --source=requests_oauthlib -m unittest discover
....................................................................
----------------------------------------------------------------------
Ran 68 tests in 2.295s
OK
_________________________________________________________________ summary _________________________________________________________________
py38: commands succeeded
congratulations :) Or on CI: https://github.com/requests/requests-oauthlib/runs/4681605483?check_suite_focus=true Is something else needed? |
Unfortunately Python is very nondeterministic. In our case, this issue was triggered when collecting tests (some of tests importing requests-oauthlib) using pytest and PYTHONOPTIMIZE=1 with coverage enabled on our CI. When running application normally it didn't or locally on the machine this didn't happen. I really don't know how to better reproduce this. However patching requests-oauthlib did help ( |
Trying with sample test.py and current python that I use. It is not the same but similar behaviour. test.py
pytest test.py
|
What file and line of requests-oauthlib is the problematic |
requests_oauthlib/oauth1_session.py' line 258 (start of the docs lines) Actual line is: https://github.com/requests/requests-oauthlib/blob/master/requests_oauthlib/oauth1_session.py#L270 |
This doc string is flagged as a raw string, and that seems to be the fix for this warning. See stackoverflow link... def fetch_request_token(self, url, realm=None, **request_kwargs):
r"""Fetch a request token.
This is the first step in the OAuth 1 workflow. A request token is
obtained by making a signed post request to url. The token is then
parsed from the application/x-www-form-urlencoded response and ready
to be used to construct an authorization url.
:param url: The request token endpoint URL.
:param realm: A list of realms to request access to.
:param \*\*request_kwargs: Optional arguments passed to ''post''
...""" and more insight into this patch I think we are safe to say that this issue has been covered. |
Thanks! The If I delete the Similarly, if I edit -commands=coverage run --source=requests_oauthlib -m unittest discover
+commands=python -Wd -m coverage run --source=requests_oauthlib -m unittest discover So I agree, this looks fixed. @matejsp What version of requests-oauthlib are you using? I would also suggest enabling deprecation warnings in tests, to help find and fix the relevant code is removed. Shall I create a PR with the above diff? |
We are using 1.0.0. That's the reason why we are missing "r" and getting this error. Seems to be fixed in later version but we are not able to upgrade yet. Sry for the false alarm. Btw what should |
@matejsp It looks like it's a literal double asterisk to match the double asterisk in the signature, denoting an optional parameter, of course. Looks like this additional marking is breaking with the existing pattern, where the optional arguments are tagged with the double asterisk in the signature only. I think we can probably remove these, and the raw flag and close this issue. raised this PR #476 to level set this files documentation convention/pattern. |
There is a problem with python 3.8 and escape sequence:
'invalid escape sequence \*
Originally posted by @matejsp in #443 (comment)
The text was updated successfully, but these errors were encountered: