diff --git a/pprofile.py b/pprofile.py
index <HASH>..<HASH> 100755
--- a/pprofile.py
+++ b/pprofile.py
@@ -174,8 +174,12 @@ class ProfileBase(object):
         # Ignore profiling code. __file__ does not always provide consistent
         # results with f_code.co_filename (ex: easy_install with zipped egg),
         # so inspect current frame instead.
-        # XXX: assumes all of pprofile code resides in a single file.
-        result.discard(inspect.currentframe().f_code.co_filename)
+        # Get current file from one of pprofile methods. Compatible with
+        # implementations that do not have the inspect.currentframe() method
+        # (e.g. IronPython).
+        # XXX: Assumes that all of pprofile code is in a single file.
+        # XXX: Assumes that _initStack exists in pprofile module.
+        result.discard(inspect.getsourcefile(_initStack))
         return result
 
     def _getFileNameList(self, filename):
Make pprofile compatible with IronPython.

IronPython does not implement the inspect.currentframe() method completely, I replaced it with another way to find the path to the current file.

Vincent Pelletier: Word-wrapped at <I>.