Skip to content
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

Fix PermissionError when loading .netrc (#7237) (#7378) #7395

Conversation

jgosmann
Copy link
Contributor

What do these changes do?

If no NETRC environment variable is provided and the .netrc path cannot be accessed due to missing permission, a PermissionError was raised instead of returning None. See issue #7237. This PR fixes the issue.

If the changes look good, I can also prepare backports.

Are there changes in behavior for the user?

If the .netrc cannot be accessed due to a permission problem (and the NETRC environment variable is unset), no PermissionError will be raised. Instead it will be silently ignored.

Related issue number

Fixes #7237

Backport of #7378

(cherry picked from commit 0d2e43b)

Checklist

  • I think the code is well written
  • Unit tests for the changes exist
  • Documentation reflects the changes
  • If you provide code modification, please add yourself to CONTRIBUTORS.txt
    • The format is <Name> <Surname>.
    • Please keep alphabetical order, the file is sorted by names.
  • Add a new news fragment into the CHANGES folder
    • name it <issue_id>.<type> for example (588.bugfix)
    • if you don't have an issue_id change it to the pr id after creating the pr
    • ensure type is one of the following:
      • .feature: Signifying a new feature.
      • .bugfix: Signifying a bug fix.
      • .doc: Signifying a documentation improvement.
      • .removal: Signifying a deprecation or removal of public API.
      • .misc: A ticket has been closed, but it is not of interest to users.
    • Make sure to use full sentences with correct case and punctuation, for example: "Fix issue with non-ascii contents in doctest text files."

@psf-chronographer psf-chronographer bot added the bot:chronographer:provided There is a change note present in this PR label Jul 20, 2023
## What do these changes do?

If no NETRC environment variable is provided and the .netrc path cannot
be accessed due to missing permission, a PermissionError was raised
instead of returning None. See issue aio-libs#7237. This PR fixes the issue.

If the changes look good, I can also prepare backports.

## Are there changes in behavior for the user?

If the .netrc cannot be accessed due to a permission problem (and the
`NETRC` environment variable is unset), no `PermissionError` will be
raised. Instead it will be silently ignored.

## Related issue number

Fixes aio-libs#7237

(cherry picked from commit 0d2e43b)

# Conflicts:
#	CONTRIBUTORS.txt
#	aiohttp/helpers.py
#	tests/test_helpers.py
@jgosmann jgosmann force-pushed the patchback/backports/3.8/0d2e43bf2a920975a5da4d9295e0ba887080bf5b/pr-7378 branch from 4e559e8 to 1046a34 Compare July 20, 2023 18:25
@jgosmann
Copy link
Contributor Author

I think the failure of "CI / Test (macos, 3.11.0-alpha - 3.11.0, true, Y) (pull_request)" is unrelated to the changes. The log says: pytest: command not found

@codecov
Copy link

codecov bot commented Jul 20, 2023

Codecov Report

Merging #7395 (1046a34) into 3.8 (7c02129) will increase coverage by 0.09%.
The diff coverage is 94.44%.

@@            Coverage Diff             @@
##              3.8    #7395      +/-   ##
==========================================
+ Coverage   97.29%   97.38%   +0.09%     
==========================================
  Files         107      107              
  Lines       31012    31029      +17     
  Branches     3245     3931     +686     
==========================================
+ Hits        30173    30218      +45     
+ Misses        629      606      -23     
+ Partials      210      205       -5     
Flag Coverage Δ
CI-GHA 97.25% <94.44%> (+0.07%) ⬆️
OS-Linux 96.89% <94.44%> (+0.06%) ⬆️
OS-Windows 95.22% <94.44%> (+0.26%) ⬆️
OS-macOS 96.63% <94.44%> (+0.06%) ⬆️
Py-3.10.11 94.83% <94.44%> (+<0.01%) ⬆️
Py-3.10.12 96.54% <94.44%> (+<0.01%) ⬆️
Py-3.11.0 96.19% <94.44%> (?)
Py-3.6.15 96.36% <94.44%> (-0.01%) ⬇️
Py-3.6.8 94.74% <94.44%> (?)
Py-3.7.17 96.53% <94.44%> (+0.12%) ⬆️
Py-3.7.9 94.88% <94.44%> (+<0.01%) ⬆️
Py-3.8.10 94.81% <94.44%> (?)
Py-3.8.17 96.43% <94.44%> (+0.12%) ⬆️
Py-3.9.13 94.80% <94.44%> (?)
Py-3.9.17 96.50% <94.44%> (?)
Py-pypy7.3.11 93.92% <88.88%> (?)
VM-macos-latest 96.63% <94.44%> (+0.06%) ⬆️
VM-ubuntu-20.04 96.89% <94.44%> (+0.05%) ⬆️
VM-ubuntu-latest 96.41% <94.44%> (?)
VM-windows-latest 95.22% <94.44%> (+0.26%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
aiohttp/helpers.py 95.86% <80.00%> (+0.03%) ⬆️
tests/test_helpers.py 98.69% <100.00%> (+0.58%) ⬆️

... and 10 files with indirect coverage changes

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@Dreamsorcerer Dreamsorcerer merged commit 8d701c3 into aio-libs:3.8 Jul 22, 2023
33 of 36 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bot:chronographer:provided There is a change note present in this PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants