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

Ensure name attribute in ftp.py #843

Closed
wants to merge 5 commits into from
Closed

Conversation

ddelange
Copy link
Contributor

@ddelange ddelange commented Oct 17, 2024

Alternative to #842

Title

Please pick a concise, informative and complete title for your PR.
The title is important because it will appear in our change log.

Motivation

Please explain the motivation behind this PR in the description.

If you're fixing a bug, link to the issue number like so:

Fixes #841

If you're adding a new feature, then consider opening a ticket and discussing it with the maintainers before you actually do the hard work.

Tests

If you're fixing a bug, consider test-driven development:

  1. Create a unit test that demonstrates the bug. The test should fail.
  2. Implement your bug fix.
  3. The test you created should now pass.

If you're implementing a new feature, include unit tests for it.

Make sure all existing unit tests pass.
You can run them locally using:

pytest smart_open

If there are any failures, please fix them before creating the PR (or mark it as WIP, see below).

Work in progress

If you're still working on your PR, include "WIP" in the title.
We'll skip reviewing it for the time being.
Once you're ready to review, remove the "WIP" from the title, and ping one of the maintainers (e.g. mpenkov).

Checklist

Before you create the PR, please make sure you have:

  • Picked a concise, informative and complete title
  • Clearly explained the motivation behind the PR
  • Linked to any existing issues that your PR will be solving
  • Included tests for any new functionality
  • Checked that all unit tests pass

Workflow

Please avoid rebasing and force-pushing to the branch of the PR once a review is in progress.
Rebasing can make your commits look a bit cleaner, but it also makes life more difficult from the reviewer, because they are no longer able to distinguish between code that has already been reviewed, and unreviewed code.

@@ -169,4 +169,5 @@ def full_close(self):
fobj.socket = socket
fobj.conn = conn
fobj.close = types.MethodType(full_close, fobj)
# fobj.name = path
Copy link
Collaborator

Choose a reason for hiding this comment

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

If we don't need it, then let's remove it instead of commenting

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yep, the call was hanging because name is a property of a socket file: https://github.com/python/cpython/blob/v3.11.1/Lib/socket.py#L758

so this PR is now adding tests and an assertion, meaning the tests are not able to reproduce the issue in question.

Copy link
Contributor Author

@ddelange ddelange Oct 17, 2024

Choose a reason for hiding this comment

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

from the issue:
unable to transparently decompress <_io.BufferedReader name=580> because it seems to lack a string-like .name

name=580, returned by fileno() in the link above, is not reproduced in integration tests (we get the .gz apparently, otherwise the tests would fail)

@ddelange
Copy link
Contributor Author

can't set an attribute where the class has a property defined, so it's back to #842

@ddelange ddelange closed this Oct 17, 2024
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.

FTP stream decompression - unable to transparently decompress
2 participants