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

ignore any exception when loading 2to3 #2413

Merged
merged 2 commits into from Oct 14, 2020

Conversation

graingert
Copy link
Contributor

@graingert graingert commented Oct 4, 2020

Summary of changes

Related to #2086

lib2to3 appears to have a problem loading the pickled pgen files, when running in parallel on pypy: https://github.com/twisted/ldaptor/runs/1205572060#step:12:103 (raises EOFError)

Instead of catching the EOFError I catch any Exception, as that seems cleaner

I've not added tests yet, as I'd like a concept ACK first, eg, If you'd rather I just remove all use of lib2to3 from the codebase I could do that instead.

Pull Request Checklist

  • Changes have tests
  • News fragment added in changelog.d. See documentation for details

@graingert graingert marked this pull request as ready for review Oct 4, 2020
@@ -11,7 +11,7 @@

try:
from setuptools.lib2to3_ex import Mixin2to3
except ImportError:
except Exception:
Copy link
Member

@webknjaz webknjaz Oct 12, 2020

Choose a reason for hiding this comment

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

I think it's important to avoid catching broad exception classes because it may shadow future bugs that would be hard to debug. Besides, adding non-ImportError exceptions here would require a huge code comment explaining the motivation.

Copy link
Contributor Author

@graingert graingert Oct 12, 2020

Choose a reason for hiding this comment

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

@webknjaz what about just EOFError?

Copy link
Member

@webknjaz webknjaz Oct 12, 2020

Choose a reason for hiding this comment

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

Given that disutils is going to disappear from stdlib, it's probably reasonable to have ImportError too. Although I'm not entirely sure where the fix should be applied to so I'll leave that to @jaraco to decide.

Copy link
Contributor Author

@graingert graingert Oct 12, 2020

Choose a reason for hiding this comment

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

Sorry, I mean just ImportError, EOFError

Copy link
Member

@webknjaz webknjaz Oct 12, 2020

Choose a reason for hiding this comment

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

Yeah, I get what you mean. I just have a feeling that something is off but I can't tell what exactly.

Copy link
Contributor Author

@graingert graingert Oct 12, 2020

Choose a reason for hiding this comment

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

How about a PR that vendors fissix?

@jaraco
Copy link
Member

jaraco commented Oct 14, 2020

I'm happy to accept this change as a stop-gap measure (bugfix release), but I'd especially like to see a PR removing lib2to3 dependency.

@jaraco jaraco merged commit 2b52be2 into pypa:master Oct 14, 2020
0 of 2 checks passed
@graingert graingert deleted the ignore-any-exception-loading2to3 branch Jul 18, 2021
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.

None yet

3 participants