Skip to content

requests.utils. atomic_open does not respect umask #6738

Open
@austinzh

Description

@austinzh

Create a new file using requests.utils. atomic_open with umask set to 0o000

Expected Result

0o777

Actual Result

0o600

Reproduction Steps

import os
import requests.utils

os.umask(0o000)

with requests.utils.atomic_open('example.txt') as f:
    f.write(b'Hello, world!')

file_stat = os.stat('example.txt')
print(oct(file_stat.st_mode & 0o777))

System Information

$ python -m requests.help
{
  "chardet": {
    "version": null
  },
  "charset_normalizer": {
    "version": "3.3.2"
  },
  "cryptography": {
    "version": ""
  },
  "idna": {
    "version": "3.7"
  },
  "implementation": {
    "name": "CPython",
    "version": "3.10.6"
  },
  "platform": {
    "release": "6.2.0-1016-aws",
    "system": "Linux"
  },
  "pyOpenSSL": {
    "openssl_version": "",
    "version": null
  },
  "requests": {
    "version": "2.32.3"
  },
  "system_ssl": {
    "version": "30000020"
  },
  "urllib3": {
    "version": "2.2.1"
  },
  "using_charset_normalizer": true,
  "using_pyopenssl": false
}

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions