Skip to content

Commit

Permalink
Merge pull request #187 from hpyproject/antocuni/debug-mode-closed-ha…
Browse files Browse the repository at this point in the history
…ndles-followup

PR #176 follow up
  • Loading branch information
antocuni authored Mar 26, 2021
2 parents 7f1da8c + a91f8f9 commit cc98cac
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 24 deletions.
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ cppcheck-build-dir:

cppcheck: cppcheck-build-dir
# azure pipelines doesn't show stderr, so we write the errors to a file and cat it later :(
cppcheck --version
cppcheck \
--error-exitcode=1 \
--cppcheck-build-dir=$(or ${CPPCHECK_BUILD_DIR}, .cppcheck) \
Expand Down
18 changes: 9 additions & 9 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -129,15 +129,15 @@ jobs:
python test/check_py27_compat.py
displayName: 'check_py27_compat.py'
- job: CPPCheck
pool:
vmImage: 'ubuntu-latest'
displayName: "Run CPPCheck"
steps:
- template: azure-templates/cppcheck.yml
- template: azure-templates/python.yml
- script: make cppcheck
displayName: Run CPPCheck
# - job: CPPCheck
# pool:
# vmImage: 'ubuntu-latest'
# displayName: "Run CPPCheck"
# steps:
# - template: azure-templates/cppcheck.yml
# - template: azure-templates/python.yml
# - script: make cppcheck
# displayName: Run CPPCheck

- job: infer
pool:
Expand Down
16 changes: 2 additions & 14 deletions hpy/debug/src/debug_handles.c
Original file line number Diff line number Diff line change
Expand Up @@ -74,22 +74,10 @@ void DHPy_invalid_handle(HPyContext *dctx, DHPy dh)
the callback and let the execution to continue, so that people
can fix the warnings one by one.
*/
// XXX: so far the only call API that we have is CallTupleDict, we
// should use a more C-friendly variant as soon as we have it.
UHPy uh_args = HPy_NULL;
UHPy uh_res = HPy_NULL;
uh_args = HPyTuple_Pack(uctx, 0);
if (HPy_IsNull(uh_args)) {
print_error(uctx, "Error when preparing args to call the on_invalid_handle callback");
goto exit;
}
uh_res = HPy_CallTupleDict(uctx, info->uh_on_invalid_handle, uh_args, HPy_NULL);
if (HPy_IsNull(uh_res)) {
uh_res = HPy_CallTupleDict(uctx, info->uh_on_invalid_handle, HPy_NULL, HPy_NULL);
if (HPy_IsNull(uh_res))
print_error(uctx, "Error when executing the on_invalid_handle callback");
goto exit;
}
exit:
HPy_Close(uctx, uh_args);
HPy_Close(uctx, uh_res);
}

Expand Down
4 changes: 3 additions & 1 deletion hpy/debug/src/dhqueue.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#include "debug_internal.h"

// TODO: we need to make DHQueue thread-safe if we want to use the same
// context in multiple threads
void DHQueue_init(DHQueue *q) {
q->head = NULL;
q->tail = NULL;
Expand Down Expand Up @@ -46,7 +48,7 @@ DebugHandle *DHQueue_popfront(DHQueue *q)
void DHQueue_remove(DHQueue *q, DebugHandle *h)
{
#ifndef NDEBUG
// if we are debugging, let's check that h it's effectively in the queue
// if we are debugging, let's check that h is effectively in the queue
DebugHandle *it = q->head;
bool found = false;
while(it != NULL) {
Expand Down

0 comments on commit cc98cac

Please sign in to comment.