-
-
Notifications
You must be signed in to change notification settings - Fork 25
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
Wrap indexData #149
Wrap indexData #149
Conversation
Codecov ReportBase: 96.88% // Head: 92.87% // Decreases project coverage by
Additional details and impacted files@@ Coverage Diff @@
## master #149 +/- ##
==========================================
- Coverage 96.88% 92.87% -4.01%
==========================================
Files 1 1
Lines 417 463 +46
==========================================
+ Hits 404 430 +26
- Misses 13 33 +20
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
BTW, I'm not sure of the best casing. |
Ah I was wondering also what would be the most self-explanatory. I'd suggest: |
de9e334
to
1e2f56b
Compare
It is what I've used. So we are good. I let you merge if you are ok with the PR |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good but any exception in the IndexData methods ends up crashing the process. All the _cy_call_fct
functions do enter the except
block and set the trackeback in error[0]
but for some reason it crashes instead of forwarding it up
tests/test_libzim_creator.py::test_exc_in_indexdata
[DEBUG] inside has_indexdata()
[DEBUG] captured exception: Some User Exception
[DEBUG] error[0]= b'Traceback (most recent call last):\n File "libzim/libzim.pyx", line 148, in libzim.bool_cy_call_fct\n return call_method(obj, method)\n File "libzim/libzim.pyx", line 84, in libzim.call_method\n return func()\n File "/Users/reg/src/pylibzim/tests/test_libzim_creator.py", line 698, in has_indexdata\n raise IOError("Some User Exception")\nOSError: Some User Exception\n'
libc++abi: terminating with uncaught exception of type std::runtime_error: Traceback (most recent call last):
File "libzim/libzim.pyx", line 148, in libzim.bool_cy_call_fct
return call_method(obj, method)
File "libzim/libzim.pyx", line 84, in libzim.call_method
return func()
File "/Users/reg/src/pylibzim/tests/test_libzim_creator.py", line 698, in has_indexdata
raise IOError("Some User Exception")
OSError: Some User Exception
Fatal Python error: Aborted
libzim/libzim.pyx
Outdated
@@ -87,6 +87,13 @@ cdef object call_method(object obj, string method): | |||
# object to the correct cpp type. | |||
# Will be used by cpp side to call python method. | |||
cdef public api: | |||
bool obj_has_attribute(object obj, string attribute) with gil: | |||
"""Check if a object has a given attribute""" | |||
attr = getattr(obj, attribute.decode('UTF-8'), None) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a reason for not using hasattr
?
Code coverage has dropped significantly. A bit of automated testing might be welcome. |
This pull request has been automatically marked as stale because it has not had recent activity. It will be now be reviewed manually. Thank you for your contributions. |
@mgautierfr Please finish this Pr. |
This is more related to #42 than wrapping IndexData. I have a working version which need changes in python-libzim and libzim itself. I will create PRs soon. |
As discussed, merging this despite the error handling issue and coverage. |
Fixes #92