Python3 扩展模块命名
如果使用过 Visual Studio 的话,应该对项目配置中的选择运行时库类型有印象,根据不同的选项,对应链接底层不同名字的运行时库。 Python 根据版本
使用 gdb 调试 Python 解释器
直接使用 gdb 调试 Python 解释器 (CPython) 是一件很痛苦的事情,因为里面的变量类型基本上全部是 Python 封装的结构体,很少能看到原生的 C 内置类型,不
CMake 基础使用
CMAKE_PREFIX_PATH CMAKE_PREFIX_PATH 用于定义额外的 bin/lib(64)/include 搜索路径(默认为空)。 如果 CMAKE_PREFIX_PATH 指定的路径中没有 /bin, /lib(64), /include 后缀,cmake 的 find_xxx 命令会为每个路径自动加上 /bin, /lib(64), /include
从源码构建 Python
最近在定位一个 Python 模块内存异常释放导致段错误的问题,发现 Ubuntu 18.04 的 Python dbg 包竟然没有包含源码(可能必须用 python-dbg/python3-dbg ?),gdb 调试非常不方
指定 Python 版本进行 CMake 工程构建
当系统上存在多个 Python 解释器时,CMake 的 FindPythonInterp 模块需要指定额外的参数才能找到正确的(或者说想要的) Python 解释器。 搜索路径 如果要使
Boost.Pool free vs ordered free
Boost.Pool 默认实现了两种 allocator,即 pool_allocator 和 fast_pool_allocator,在测试时发现前者在容器 clear 性能巨差无比,
C++ function template partial specialization
pybind11 repr 最近在使用 pybind11 做 C++ 接口导出 Python 绑定的工作,发现一个比较诡异的问题,当使用 pybind11/stl_bind.h 对 std::vector 或 std::map 这两种容器进行绑定时,如果容器的成员类
libvirt Python 绑定
libvirt 是一个 C 动态库,其 Python API 由 libvirt-python 项目下的 generator.py 生成。 一部分 Python API 通过 libvirt 的 C API 定义自动生成 $ ls /usr/share/libvirt/api/ libvirt-admin-api.xml libvirt-api.xml libvirt-lxc-api.xml libvirt-qemu-api.xml 一部分 Python API 通过 override API 定义(即对
Nova 到 Qemu 的调用
Nova 侧 # nova/virt/libvirt/driver.py class LibvirtDriver(driver.ComputeDriver): def power_on self._hard_reboot self._get_guest_xml self._create_domain_and_network self._create_domain guest = libvirt_guest.Guest.create guest.launch # nova/virt/libvirt/guest.py class Guest(object): def create guest = host.write_instance_config(xml) return guest def launch self._domain.createWithFlags def attach_device(self, conf, persistent=False, live=False): device_xml = conf.to_xml() self._domain.attachDeviceFlags(device_xml, flags=flags) # nova/virt/libvirt/host.py class Host(object): def write_instance_config(self, xml): domain = self.get_connection().defineXML(xml) conn = self._get_connection() self._get_new_connection() self._connect libvirt.openAuth return libvirt_guest.Guest(domain) libvirt Python
git clone ssh repo 时使用 http 代理
方法一 $ sudo vi /etc/ssh/ssh_config Host gerrit.example.com # ProxyCommand nc --proxy 192.168.5.2:3334 %h %p proxycommand socat - PROXY:192.168.5.2:%h:%p,proxyport=3334 方法二 $ vi git-ssh.sh # ssh -o "proxycommand socat - PROXY:192.168.5.2:%h:%p,proxyport=3334" $* # ssh -o StrictHostKeyChecking=no -o "proxycommand socat - PROXY:192.168.5.2:%h:%p,proxyport=3334" $* ssh -o StrictHostKeyChecking=no -F /dev/null -i /path/to/private_key -o "proxycommand socat - PROXY:192.168.5.2:%h:%p,proxyport=3334" $* git-ssh.sh 脚本