Issue #12718: Set importer on instance if Python function, to avoid bad interaction with winpdb.
fix variable reference to fix --enable-profiling (closes #17550)
merge 2.7.4 release branch (#17550)