397 */
398 PyObject* pyewf_file_seek_offset(
399 pyewf_file_t *pyewf_file,
400 PyObject *arguments,
401 PyObject *keywords )
402 {
403 static char *keyword_list[] = { "offset", "whence", NULL };
404 off64_t offset = 0;
405 int whence = 0;
406
407 if( PyArg_ParseTupleAndKeywords(
when PyArg_ParseTupleAndKeywords() succeeds
taking False path
408 arguments, keywords,
409 "L|i",
410 keyword_list,
411 &offset,
412 &whence) == 0 )
413 {
414 return( NULL );
415 }
416 switch( whence )
when following case 0
417 {
418 case 0:
419 pyewf_file->read_offset = offset;
420
421 break;
422
423 case 1:
424 pyewf_file->read_offset += offset;
425
426 break;
427
428 case 2:
429 pyewf_file->read_offset = pyewf_file->media_size + offset;
430
431 break;
432
433 default:
434 return( PyErr_Format(
435 PyExc_ValueError,
436 "Invalid argument (whence): %d",
437 whence ) );
438 }
439 #if defined( HAVE_V2_API )
440 if( libewf_handle_seek_offset(
441 pyewf_file->handle,
442 offset,
443 whence,
444 NULL ) < 0 )
445 {
446 return( PyErr_Format(
447 PyExc_IOError,
448 "libewf_handle_seek_offset failed (tried to seek to %" PRIu64 " - %" PRIu64 ")",
449 pyewf_file->read_offset,
450 pyewf_file->media_size ) );
451 }
452 #else
453 if( libewf_seek_offset(
when considering range: 0 <= value <= 0x7fffffffffffffff
taking False path
ob_refcnt is now refs: 0 + N where N >= 1
454 pyewf_file->handle,
455 pyewf_file->read_offset ) < 0 )
456 {
457 return( PyErr_Format(
458 PyExc_IOError,
459 "libewf_seek_offset failed (tried to seek to %" PRIu64 " - %" PRIu64 ")",
460 pyewf_file->read_offset,
461 pyewf_file->media_size ) );
462 }
463 #endif
464 return( Py_None );
465 }
ob_refcnt of return value is 1 too low
was expecting final ob_refcnt to be N + 1 (for some unknown N)
due to object being referenced by: return value
but final ob_refcnt is N + 0
consider using "Py_RETURN_NONE;"
found 2 similar trace(s) to this