python: Remove python/embedded.cc's dependence on the rest of gem5.

If embedded python modules are going to be built into other binaries,
then they can't depend on other parts of gem5.

Change-Id: I4e12f1962cb6330e70866a40388689102c23693a
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/49420
Maintainer: Gabe Black <gabe.black@gmail.com>
Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com>
Tested-by: kokoro <noreply+kokoro@google.com>
This commit is contained in:
Gabe Black
2021-08-17 20:53:11 -07:00
parent e9c833a959
commit dc4daa010a

View File

@@ -45,10 +45,10 @@
#include <zlib.h>
#include <cstdlib>
#include <iostream>
#include <list>
#include "base/logging.hh"
namespace py = pybind11;
namespace gem5
@@ -78,8 +78,10 @@ EmbeddedPython::getCode() const
Bytef marshalled[len];
uLongf unzlen = len;
int ret = uncompress(marshalled, &unzlen, (const Bytef *)code, zlen);
if (ret != Z_OK)
panic("Could not uncompress code: %s\n", zError(ret));
if (ret != Z_OK) {
std::cerr << "Could not uncompress code: " << zError(ret) << std::endl;
std::abort();
}
assert(unzlen == (uLongf)len);
auto marshal = py::module_::import("marshal");