public
Created

  • Download Gist
gistfile1.c
C
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
// Prerequisite: python2.7-dev
// Compile with: gcc -shared -fPIC -o liboverride.so override_pydict.c -ldl
// Run as: LD_PRELOAD=./liboverride.so python
 
#define _GNU_SOURCE 1
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/types.h>
#include <dlfcn.h>
#include "python2.7/Python.h"
 
PyObject* PyDict_New(void)
{
PyObject* (*orig_PyDict_New)(void) = dlsym(RTLD_NEXT, "PyDict_New");
printf("Calling PyDict_New\n");
 
return orig_PyDict_New();
}

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.