Skip to content

Commit be7ef60

Browse files
committed
special case test for windows, remove two compile warnings on 64bit windows (cpython 3.5)
1 parent 6f014c1 commit be7ef60

3 files changed

Lines changed: 8 additions & 3 deletions

File tree

src/vmp_stack.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ static PY_STACK_FRAME_T * _write_python_stack_entry(PY_STACK_FRAME_T * frame, vo
5959
int len;
6060
int addr;
6161
int j;
62-
long line;
62+
uint64_t line;
6363
char *lnotab;
6464

6565
#ifndef RPYTHON_VMPROF // pypy does not support line profiling
@@ -76,7 +76,7 @@ static PY_STACK_FRAME_T * _write_python_stack_entry(PY_STACK_FRAME_T * frame, vo
7676
lnotab = PyStr_AS_STRING(frame->f_code->co_lnotab);
7777

7878
if (lnotab != NULL) {
79-
line = (long)frame->f_lineno;
79+
line = (uint64_t)frame->f_lineno;
8080
addr = 0;
8181

8282
len = (int)PyStr_GET_SIZE(frame->f_code->co_lnotab);

src/vmprof_main_win32.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ int vmprof_snapshot_thread(DWORD thread_id, PyThreadState *tstate, prof_stacktra
5050
depth = vmp_walk_and_record_stack(tstate->frame, stack->stack,
5151
MAX_STACK_DEPTH, 0, 0);
5252
stack->depth = depth;
53-
stack->stack[depth++] = (void*)thread_id;
53+
stack->stack[depth++] = (void*)((ULONG_PTR)thread_id);
5454
stack->count = 1;
5555
stack->marker = MARKER_STACKTRACE;
5656
ResumeThread(hThread);

vmprof/test/test_run.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,11 @@ def test_enable_disable():
113113
def test_start_end_time():
114114
prof = vmprof.Profiler()
115115
before_profile = datetime.now(pytz.utc)
116+
if sys.platform == 'win32':
117+
# it seems that the windows implementation of vmp_write_time_now
118+
# is borken, and cuts of some micro second precision.
119+
import time
120+
time.sleep(1)
116121
with prof.measure():
117122
function_foo()
118123
after_profile = datetime.now(pytz.utc)

0 commit comments

Comments
 (0)