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

Update blob.py #390

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions src/ZODB/blob.py
Original file line number Diff line number Diff line change
Expand Up @@ -942,8 +942,10 @@ def remove_committed_dir(path):
filename = os.path.join(dirpath, filename)
remove_committed(filename)
shutil.rmtree(path)

link_or_copy = shutil.copy
try:
link_or_copy = shutil.copy
except AttributeError: #pragma: no cover
link_or_copy = shutil.copy
Copy link
Member

Choose a reason for hiding this comment

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

First, this cannot be the correct spot for the try: .. except: ... bit: it is inside the if sys.platform == "win32": block. The correct location should be below (line 950).

Second, the two parts of the try: ... except: ... test must not have the same content. Line 950 below should be changed to:

    try:
        link_or_copy = os.link
    except AttributeError:  #pragma: no cover
        link_or_copy = shutil.copy

Copy link
Author

Choose a reason for hiding this comment

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

Ooops. You are correct. The changes were meant for line 950

Copy link
Member

Choose a reason for hiding this comment

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

This assignment must be at the same indentation level as the function definitions: it is not part of the function.

Suggested change
link_or_copy = shutil.copy
link_or_copy = shutil.copy

else:
remove_committed = os.remove
remove_committed_dir = shutil.rmtree
Expand Down