Comments (5)
It looks like it's because the except UnicodeError
on line 269 of core.py
is intended to be catching only exceptions from line 261 label = label.encode('ascii')
but is also catching the perfectly good error message idna.core.InvalidCodepoint: Codepoint U+0020 at position 4 of 'foo bar' not allowed
that is being thrown by ulabel
because InvalidCodepoint
is an indirect subclass of UnicodeError
.
This bug is therefore already fixed by ebefacd which made IDNAError
not be a subclass of UnicodeError
anymore.
from idna.
Thanks for taking a look @jribbens !
from idna.
Okay, so I tried the latest version.
$ python3 foo.py
Traceback (most recent call last):
File "/home/joern/idna/lib/python3.5/site-packages/idna-2.2-py3.5.egg/idna/core.py", line 263, in alabel
File "/home/joern/idna/lib/python3.5/site-packages/idna-2.2-py3.5.egg/idna/core.py", line 299, in ulabel
File "/home/joern/idna/lib/python3.5/site-packages/idna-2.2-py3.5.egg/idna/core.py", line 253, in check_label
idna.core.InvalidCodepoint: Codepoint U+0020 at position 4 of 'foo bar' not allowed
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "foo.py", line 2, in <module>
idna.encode(b'foo bar')
File "/home/joern/idna/lib/python3.5/site-packages/idna-2.2-py3.5.egg/idna/core.py", line 355, in encode
File "/home/joern/idna/lib/python3.5/site-packages/idna-2.2-py3.5.egg/idna/core.py", line 265, in alabel
idna.core.IDNAError: The label b'foo bar' is not a valid A-label
The "good" exception is now visible. But what's with the second? :)
from idna.
It's the appalling way Python 3 reports exceptions. ulabel
throws the first exception listed above, which is caught by line 264 in alabel
and the second exception is thrown. Both of them appear correct and I don't think this behaviour is a problem.
from idna.
In that case, everything appears to be in order now. Thank you!
from idna.
Related Issues (20)
- Suggest adoption of Scorecard GitHub Action HOT 1
- IDNA package source installation is broken in Poetry - Adhere to PEP-721 HOT 2
- Deprecate `setup.cfg` HOT 1
- Set a new minimum Python version HOT 2
- Use code formatter on source HOT 4
- PyPI Publish GitHub Action failing HOT 1
- `HISTORY.rst` no longer included in source distribution HOT 1
- RFE: is it possible to start making github releases?🤔 HOT 6
- License identifier is incorrect on released packages HOT 5
- Document exceptions HOT 2
- Exception ValueError: no such name
- Reproducer for CVE-2024-3651 HOT 7
- Patch for CVE-2024-3651, for v3.3 HOT 3
- Clarify that uts46=True is preprocessing only (and still enforces IDNA-2008 restrictions)
- Unable to pre-flight packages to TestPyPI
- Regression in import time HOT 2
- Multiple test failures when tests are run via unittest HOT 4
- uts46_remap() fails in idna 3.9 HOT 4
- Ensure Github Actions run complete tests
- Implement new UTS46 logic from Unicode 16
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from idna.