Skip to content

Commit

Permalink
Merge pull request #26047 from davidlange6/py190302
Browse files Browse the repository at this point in the history
fix long-standing typo, python3 compatible syntax for running python files
  • Loading branch information
cmsbuild authored Mar 3, 2019
2 parents 537b9c1 + 43d21f7 commit b10e2e6
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 7 deletions.
2 changes: 1 addition & 1 deletion FWCore/ParameterSet/python/DictTypes.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def itervalues(self):
def keys(self):
return self.list
def values(self):
return [ dict.__getitems__(self, key) for key in self.list]
return [ dict.__getitem__(self, key) for key in self.list]


class SortedAndFixedKeysDict(SortedKeysDict):
Expand Down
5 changes: 2 additions & 3 deletions FWCore/PyDevParameterSet/src/MakePyBind11ParameterSets.cc
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,8 @@ static
void
makePSetsFromFile(std::string const& fileName) {
std::string initCommand("from FWCore.ParameterSet.Types import makeCppPSet\n"
"execfile('");
initCommand += fileName + "')";

"exec(open('");
initCommand += fileName + "').read())";
pybind11::exec(initCommand);
pybind11::exec("makeCppPSet(locals(), topPSet)");
}
Expand Down
6 changes: 3 additions & 3 deletions FWCore/PyDevParameterSet/src/PyBind11ProcessDesc.cc
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,9 @@ void PyBind11ProcessDesc::read(std::string const& config) {
}

void PyBind11ProcessDesc::readFile(std::string const& fileName) {
std::string initCommand("import FWCore.ParameterSet.Config as cms\n"
"execfile('");
initCommand += fileName + "')";
std::string initCommand("from FWCore.ParameterSet.Types import makeCppPSet\n"
"exec(open('");
initCommand += fileName + "').read())";

pybind11::exec(initCommand.c_str());
std::string command("process.fillProcessDesc(processPSet)");
Expand Down

0 comments on commit b10e2e6

Please sign in to comment.