KEMBAR78
gh-115961: Add name and mode attributes for compressed file-like objects by serhiy-storchaka · Pull Request #116036 · python/cpython · GitHub
Skip to content

Conversation

@serhiy-storchaka
Copy link
Member

@serhiy-storchaka serhiy-storchaka commented Feb 28, 2024

  • Add name and mode attributes for compressed and archived file-like objects in modules bz2, lzma, tarfile and zipfile.
  • Change the value of the mode attribute of GzipFile from integer (1 or 2) to string ('rb' or 'wb').
  • Change the value of the mode attribute of ZipExtFile from 'r' to 'rb'.

📚 Documentation preview 📚: https://cpython-previews--116036.org.readthedocs.build/

…e objects

* Add name and mode attributes for compressed and archived file-like objects
  in modules bz2, lzma, tarfile and zipfile.
* Change the value of the mode attribute of GzipFile from integer (1 or 2)
  to string ('rb' or 'wb').
* Change the value of the mode attribute of ZipExtFile from 'r' to 'rb'.
Copy link
Contributor

@eendebakpt eendebakpt left a comment

Choose a reason for hiding this comment

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

Looks good! Some changes are not backwards compatible, but every change is properly documented.

Copy link
Member

@gpshead gpshead left a comment

Choose a reason for hiding this comment

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

Nice. This is much more consistent across all our file like ducks.

I'm not worried about things like the old gzip 1 and 2 values as I don't expect anyone to ever have used them. Similar for the old 'r' that should've been a 'rb'.

If anything comes up depending on this during the betas we can revisit.

@serhiy-storchaka serhiy-storchaka merged commit 51ef89c into python:main Apr 21, 2024
@serhiy-storchaka serhiy-storchaka deleted the compress-file-name-mode branch April 21, 2024 08:46
@bedevere-bot
Copy link

⚠️⚠️⚠️ Buildbot failure ⚠️⚠️⚠️

Hi! The buildbot AMD64 RHEL7 LTO + PGO 3.x has failed when building commit 51ef89c.

What do you need to do:

  1. Don't panic.
  2. Check the buildbot page in the devguide if you don't know what the buildbots are or how they work.
  3. Go to the page of the buildbot that failed (https://buildbot.python.org/all/#builders/96/builds/7319) and take a look at the build logs.
  4. Check if the failure is related to this commit (51ef89c) or if it is a false positive.
  5. If the failure is related to this commit, please, reflect that on the issue and make a new Pull Request with a fix.

You can take a look at the buildbot page here:

https://buildbot.python.org/all/#builders/96/builds/7319

Failed tests:

  • test_capi

Summary of the results of the build (if available):

==

Click to see traceback logs
remote: Enumerating objects: 58, done.        
remote: Counting objects:   1% (1/58)        
remote: Counting objects:   3% (2/58)        
remote: Counting objects:   5% (3/58)        
remote: Counting objects:   6% (4/58)        
remote: Counting objects:   8% (5/58)        
remote: Counting objects:  10% (6/58)        
remote: Counting objects:  12% (7/58)        
remote: Counting objects:  13% (8/58)        
remote: Counting objects:  15% (9/58)        
remote: Counting objects:  17% (10/58)        
remote: Counting objects:  18% (11/58)        
remote: Counting objects:  20% (12/58)        
remote: Counting objects:  22% (13/58)        
remote: Counting objects:  24% (14/58)        
remote: Counting objects:  25% (15/58)        
remote: Counting objects:  27% (16/58)        
remote: Counting objects:  29% (17/58)        
remote: Counting objects:  31% (18/58)        
remote: Counting objects:  32% (19/58)        
remote: Counting objects:  34% (20/58)        
remote: Counting objects:  36% (21/58)        
remote: Counting objects:  37% (22/58)        
remote: Counting objects:  39% (23/58)        
remote: Counting objects:  41% (24/58)        
remote: Counting objects:  43% (25/58)        
remote: Counting objects:  44% (26/58)        
remote: Counting objects:  46% (27/58)        
remote: Counting objects:  48% (28/58)        
remote: Counting objects:  50% (29/58)        
remote: Counting objects:  51% (30/58)        
remote: Counting objects:  53% (31/58)        
remote: Counting objects:  55% (32/58)        
remote: Counting objects:  56% (33/58)        
remote: Counting objects:  58% (34/58)        
remote: Counting objects:  60% (35/58)        
remote: Counting objects:  62% (36/58)        
remote: Counting objects:  63% (37/58)        
remote: Counting objects:  65% (38/58)        
remote: Counting objects:  67% (39/58)        
remote: Counting objects:  68% (40/58)        
remote: Counting objects:  70% (41/58)        
remote: Counting objects:  72% (42/58)        
remote: Counting objects:  74% (43/58)        
remote: Counting objects:  75% (44/58)        
remote: Counting objects:  77% (45/58)        
remote: Counting objects:  79% (46/58)        
remote: Counting objects:  81% (47/58)        
remote: Counting objects:  82% (48/58)        
remote: Counting objects:  84% (49/58)        
remote: Counting objects:  86% (50/58)        
remote: Counting objects:  87% (51/58)        
remote: Counting objects:  89% (52/58)        
remote: Counting objects:  91% (53/58)        
remote: Counting objects:  93% (54/58)        
remote: Counting objects:  94% (55/58)        
remote: Counting objects:  96% (56/58)        
remote: Counting objects:  98% (57/58)        
remote: Counting objects: 100% (58/58)        
remote: Counting objects: 100% (58/58), done.        
remote: Compressing objects:   3% (1/27)        
remote: Compressing objects:   7% (2/27)        
remote: Compressing objects:  11% (3/27)        
remote: Compressing objects:  14% (4/27)        
remote: Compressing objects:  18% (5/27)        
remote: Compressing objects:  22% (6/27)        
remote: Compressing objects:  25% (7/27)        
remote: Compressing objects:  29% (8/27)        
remote: Compressing objects:  33% (9/27)        
remote: Compressing objects:  37% (10/27)        
remote: Compressing objects:  40% (11/27)        
remote: Compressing objects:  44% (12/27)        
remote: Compressing objects:  48% (13/27)        
remote: Compressing objects:  51% (14/27)        
remote: Compressing objects:  55% (15/27)        
remote: Compressing objects:  59% (16/27)        
remote: Compressing objects:  62% (17/27)        
remote: Compressing objects:  66% (18/27)        
remote: Compressing objects:  70% (19/27)        
remote: Compressing objects:  74% (20/27)        
remote: Compressing objects:  77% (21/27)        
remote: Compressing objects:  81% (22/27)        
remote: Compressing objects:  85% (23/27)        
remote: Compressing objects:  88% (24/27)        
remote: Compressing objects:  92% (25/27)        
remote: Compressing objects:  96% (26/27)        
remote: Compressing objects: 100% (27/27)        
remote: Compressing objects: 100% (27/27), done.        
remote: Total 30 (delta 27), reused 5 (delta 3), pack-reused 0        
From https://github.com/python/cpython
 * branch            main       -> FETCH_HEAD
Note: checking out '51ef89cd9acbfbfa7fd8d82f0c6baa388bb650c9'.

You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by performing another checkout.

If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -b with the checkout command again. Example:

  git checkout -b new_branch_name

HEAD is now at 51ef89c... gh-115961: Add name and mode attributes for compressed file-like objects (GH-116036)
Switched to and reset branch 'main'

find: ‘build’: No such file or directory
find: ‘build’: No such file or directory
find: ‘build’: No such file or directory
find: ‘build’: No such file or directory
make[2]: [Makefile:3082: clean-retain-profile] Error 1 (ignored)

make: *** [Makefile:2229: buildbottest] Error 2

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.

4 participants