Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions astropy/coordinates/builtin_frames/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,11 @@ def _get_doc_header(cls):
the first period or a fully empty line.
"""
out = []

# NOTE: cls.__doc__ is None for -OO flag
if not cls.__doc__:
return ""

for line in cls.__doc__.splitlines():
if line:
parts = line.split(".")
Expand Down
5 changes: 3 additions & 2 deletions astropy/io/ascii/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -1230,7 +1230,8 @@ def __init__(cls, name, bases, dct):
+ re.sub(".", "=", header)
+ "\n"
)
func.__doc__ += inspect.cleandoc(cls.__doc__).strip()
# NOTE: cls.__doc__ is None for -OO flag
func.__doc__ += inspect.cleandoc(cls.__doc__ or "").strip()
connect.io_registry.register_reader(io_format, Table, func)

if dct.get("_io_registry_can_write", True):
Expand All @@ -1243,7 +1244,7 @@ def __init__(cls, name, bases, dct):
+ re.sub(".", "=", header)
+ "\n"
)
func.__doc__ += inspect.cleandoc(cls.__doc__).strip()
func.__doc__ += inspect.cleandoc(cls.__doc__ or "").strip()
connect.io_registry.register_writer(io_format, Table, func)


Expand Down
1 change: 1 addition & 0 deletions docs/changes/coordinates/15037.bugfix.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fixed import when called with Python ``-OO`` flag.