diff --git a/pep_sphinx_extensions/pep_processor/transforms/pep_headers.py b/pep_sphinx_extensions/pep_processor/transforms/pep_headers.py index 2b4cc5d0766f..323d7413e40b 100644 --- a/pep_sphinx_extensions/pep_processor/transforms/pep_headers.py +++ b/pep_sphinx_extensions/pep_processor/transforms/pep_headers.py @@ -171,12 +171,7 @@ def _process_discourse_url(parts: list[str]) -> tuple[str, str]: f"{'/'.join(parts)} not a link to a Discourse thread or category") first_subpart = parts[4] - try: - int(first_subpart) - except ValueError: - has_title = True - else: - has_title = False + has_title = not first_subpart.isnumeric() if "t" in parts: item_type = "post" if len(parts) > (5 + has_title) else "thread"