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
7 changes: 7 additions & 0 deletions doc/source/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,13 @@ MontePy Changelog
1.1 releases
============

#Next Release#
--------------

**Bugs Fixed**

* Fixed bug where lines that were the allowed length was raising a ``LineOverRunWarning`` when read by MontePy (:issue:`517`).

1.1.2
--------------

Expand Down
6 changes: 4 additions & 2 deletions montepy/input_parser/input_syntax_reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,11 +215,13 @@ def flush_input():
old_line = line
line = line[:line_length]
if len(old_line) != len(line):
if len(line.split("$")[0]) >= line_length and not COMMENT_FINDER.match(
comment_free = old_line.split("$")[0]
if len(comment_free.rstrip()) > line_length and not COMMENT_FINDER.match(
line
):
warnings.warn(
f"The line: {old_line} exceeded the allowed line length of: {line_length} for MCNP {mcnp_version}",
f"The line number {fh.lineno} exceeded the allowed line length of: {line_length} for MCNP{mcnp_version} "
f'and "{comment_free[line_length -1:].rstrip()}" was removed.',
LineOverRunWarning,
)
# if extra length is a comment keep it long
Expand Down
4 changes: 2 additions & 2 deletions tests/inputs/test.imcnp
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ m2 26054.80c 5.85
26057 2.12 $ very very very very very very very very very very very very very very long line that exceeds line limit
26058.80c 0.28 $ trailing comment shouldn't move #458.
C water
C foo
m3 1001.80c 2
C foo valid input up to the line length limit
m3 1001.80c 2.00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
8016.80c 1
plib=84p
MT3 lwtr.23t h-zr.20t h/zr.28t
Expand Down