Skip to content

What would cause a Python interpreter to crash? A good interview question

sef.kloninger.com
5 pointssefk5 comments
On HN

Comments

I clicked the link expecting a discussion of what would cause a Python interpreter to crash, but found only a generic list of low level problems for any piece of software, and the statement that the headline was an interview question at YouTube ten years ago.

I remember this leading to a fun, rambling, back-and-forth discussion of the ways computers can fail. There are so many! Every level of the stack can fail in interesting ways: storage, RAM, memory management, networking. How would a bit flip in a TLB manifest? How does TCP/IP detect and handle ordering? collisions?

Sure, but the simplest ways (at least with CPython) are to invoke C code that crashes via the FFI, or to manually explicitly create a code object from invalid bytecode data (or hex-edit a .pyc file so that the usual machinery does it for you).

Also, as usual I'm tired of the implication that networking is a necessary component of "the stack".

I liked the interview question that I got when interviewing at YouTube in 2015.

Discuss what would cause a Python interpreter to crash. Not a program written in Python, but the interpreter itself.

Would this count?

  import ctypes
  ctypes.string_at(0)

This seems like an orthogonal question to architecture doesn't it?

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.