From 68f23f2b9ec34207949ba4a9f62fee6125aa3f15 Mon Sep 17 00:00:00 2001 From: Andre Anjos Date: Fri, 23 Apr 2021 09:30:45 +0200 Subject: [PATCH] [main] Carefully test if `pyproject.toml` contains a `tool` section (fixes #227) --- HISTORY.txt | 3 +++ ipdb/__main__.py | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/HISTORY.txt b/HISTORY.txt index 7bd94f2..20f3063 100644 --- a/HISTORY.txt +++ b/HISTORY.txt @@ -4,6 +4,9 @@ Changelog 0.13.8 (unreleased) ------------------- +- Fix when `pyproject.toml` does not contain `tool` section. + [anjos] + - Add the convenience function ``iex()``. [alanbernstein] diff --git a/ipdb/__main__.py b/ipdb/__main__.py index beee6c9..def87b1 100644 --- a/ipdb/__main__.py +++ b/ipdb/__main__.py @@ -178,7 +178,7 @@ def get_config(): elif filepath.endswith('pyproject.toml'): import toml toml_file = toml.load(filepath) - if "ipdb" in toml_file["tool"]: + if "ipdb" in toml_file.get("tool"): if not parser.has_section("ipdb"): parser.add_section("ipdb") for key, value in toml_file["tool"]["ipdb"].items():