-
-
Notifications
You must be signed in to change notification settings - Fork 51
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
Don't inject unicodedata2 into sys.modules #57
Conversation
Hi @akx Thanks for your report and your PR proposal. Why do you say that PR "fixes" when this behavior is well documented and is expected? I have some further questions regarding this patch. Removing the It would be nicer to propose something that both keeps the backward compatibility AND "fix" your concern. Thanks. |
Hi @Ousret. As far as I can see, it's certainly not documented that simply importing Sure, it's documented that My proposal is exactly the same mechanism that patches in |
I really do not understand why having more up-to-date |
It's a matter of principle. If I do It's maybe slightly far-fetched, but without this patch, you can't easily write a program that compares the differences between
Well, I'm pretty sure the CI suite for |
I need another person's opinion on that. @sethmlarson What do you think of that? How is that the right thing for us?
What I am concern about is methods like |
As mentioned in #57 (comment) , I don't believe having |
@Ousret Don't know much about the If you chase down the implementation of If this is the case we shouldn't be injecting |
That's the non-Unicode table. See #57 (comment) for the Unicode |
Codecov Report
@@ Coverage Diff @@
## master #57 +/- ##
==========================================
+ Coverage 84.46% 84.49% +0.03%
==========================================
Files 12 11 -1
Lines 1062 1058 -4
==========================================
- Hits 897 894 -3
+ Misses 165 164 -1
Continue to review full report at Codecov.
|
Thanks, @akx @sethmlarson for your inputs. Do you have any more concerns @akx ? |
@Ousret I don't have any further concerns regarding this PR :) Thank you for your consideration! |
You are welcome, thanks for your contribution as well. |
Now available under https://github.com/Ousret/charset_normalizer/releases/tag/2.0.2 |
I just found this while trying to debug a problem, and I just wanted to make absolutely clear that the old way causes problems. With charset_normalizer 2.0.0 (and 2.0.1), I saw this behavior: No import:
With
With the fix merged here in 2.0.2 (and the latest 2.0.7), the problem disappears. (I have an entirely different issue to solve where conda-forge is still giving me 2.0.0 🤷♂️ ) |
Thanks for the report. Indeed I saw this weird behavior at conda-forge giving by default 2.0.0 instead of latest. I do not know why and who to reach to explain that. https://anaconda.org/conda-forge/charset-normalizer/files The download tendency is revealing that something seems wrong. Could it be that the |
Incorrect dependencies for requests was exactly the reason: conda-forge/requests-feedstock#48 |
I noticed charset_normalizer meddles with
sys.modules
, causing this:This PR fixes that by using a fairly standard
try: except ImportError:
guard instead of thesys.modules
hook.