python sys.stderr.write 是原子的吗?如何确定内置函数的线程安全性?

Is python sys.stderr.write atomic? How to determine thread safety of builtin functions?

我正在尝试通过

理解此命令的原子性
import dis
import sys
dis.dis(sys.stderr.write)

但是,我得到 "TypeError: don't know how to disassemble builtin_function_or_method objects"

如何确定 python 内置函数的原子性?

不能反汇编sys.stderr.write - 它不是python函数,而是用C语言编写的函数,安装后只能以二进制形式使用。

作为 C 函数,it is implicitly thread-safe because of the Global Interpreter Lock (GIL)