-
Notifications
You must be signed in to change notification settings - Fork 861
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
Monkeypatching html.parser fails when importing with zipimporter #1132
Comments
This puts us in a weird jam. We need to monkeypatch the html parser. However, we should never be changing the behavior of the default parser. For example, a user of Python-Markdown could import and run |
I'm not familiar enough with the importing internals. My guess is that there should be way to support that with the |
I just did some digging on this issue and it appears that this has been fixed upstream (in Python's We could close this as an upstream issue. However, that does not address the issue for Python < 3.10. If someone was to provide a patch for that it would be considered. Therefore, I will leave this open for the time being. |
i suggest this workaround. @veksha FYI |
@Alexey-T we have certainly done that in the past. However, we don't call the By way of explanation, we use the new standard API defined in PEP 451 as found in the I'm sure there is still some workaround that would address the issue, but it is not immediately clear what that would be and it would likely require extensive testing on a system we don't use (and are not familiar with). Therefore, it is not a high priority issue for us. However, if someone who is familiar with and uses a relevant system were to work up and submit a fix with tests, then we would be willing to review it. |
When trying to monkeypatch a copy of
html.parser
, markdown fails whenhtml.parser
comes from a zip file and an instance ofzipimporter
is used as the loader.To reproduce
The main issue is that the
zipimporter
loader does not have anexec_module
method.The text was updated successfully, but these errors were encountered: