Issue 36130: Pdb(skip=[...]) + module without name => TypeError (original) (raw)

Here's the simplest example I could come up with -- hit this while debugging pytest (which uses attrs which uses similar code to this to make classes)

import pdb; pdb.Pdb(skip=['django.*']).set_trace() eval(compile("1", "", "exec"), {}) print('ok!')

When running this:

$ python3.8 t.py

/home/asottile/workspace/setup-cfg-fmt/t.py(2)() -> eval(compile("1", "", "exec"), {}) (Pdb) n Traceback (most recent call last): File "t.py", line 2, in eval(compile("1", "", "exec"), {}) File "", line 1, in File "/usr/lib/python3.8/bdb.py", line 90, in trace_dispatch return self.dispatch_call(frame, arg) File "/usr/lib/python3.8/bdb.py", line 128, in dispatch_call if not (self.stop_here(frame) or self.break_anywhere(frame)): File "/usr/lib/python3.8/bdb.py", line 203, in stop_here self.is_skipped_module(frame.f_globals.get('name')): File "/usr/lib/python3.8/bdb.py", line 194, in is_skipped_module if fnmatch.fnmatch(module_name, pattern): File "/usr/lib/python3.8/fnmatch.py", line 34, in fnmatch name = os.path.normcase(name) File "/usr/lib/python3.8/posixpath.py", line 54, in normcase s = os.fspath(s) TypeError: expected str, bytes or os.PathLike object, not NoneType

$ python3.8 --version --version Python 3.8.0a2 (default, Feb 25 2019, 23:11:49) [GCC 7.3.0]