-
Notifications
You must be signed in to change notification settings - Fork 20
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
Fix extension for stricter unicode validation #38
Conversation
This adds a top-level `pyproject.toml` and moves the minimally required settings there from `setup.py`.
We have some btests for pysubnettree in the repo. Could you add one for this? |
This was actually flagged by one of the existing tests, see the failed CI run https://github.com/zeek/pysubnettree/actions/runs/8996870968/job/24714020545?pr=38. The issue there was that in binary test mode (which constructs addresses as Do you still want me to add a dedicated test for this? EDIT: I modified that test slightly so it now checks the exception message. |
On lookup failure we would previously assume that binary addresses are valid unicode when constructing exception messages. With python/cpython#105375 which appeared e.g., in python-3.11.9 this starts to cause failures as invalid unicode is now more consistently rejected; e.g., in the test `pysubnettree.lookup` we construct a binary address `1.3.3.255` which corresponds to `b'\x01\x03\x03\xff'` which is not valid unicode. With this patch we set messages for `KeyError` from a `bytes` object instead of a `str`, so that user's see e.g., KeyError: b'1:3:3::3' instead of the previous KeyError: '1:3:3::3' This should still provide all the information necessary while working with our interface which allows both `str` and `bytes` inputs. The changes to `SubnetTree_wrap.cc` are generated automatically with swig-3.0.12.
7fad27d
to
d61edb0
Compare
Also fix trace-summary python backtrace. Intermittent crash: zeek/zeek@8c337bd threading/MsgThread: Decouple IO source and thread A MsgThread acting as an IO source itself can result in the scenario where the threading manager's heartbeat timer deletes a terminated MsgThread instance, but at the same time this instance is in the list of ready IO sources as determined by the IO loop in the current iteration. trace-summary backtrace: zeek/pysubnettree#38 Fix extension for stricter unicode validation This fixes our extension module for python/cpython#105375 which made unicode validation stricter. Reported by: Arne Welzel (crash), ogogon (backtrace)
This fixes our extension module for python/cpython#105375 which made unicode validation stricter (appeared e.g., in python-3.11.9).