Skip to content

Commit 5c747a3

Browse files
committed
fix: catch YappsSyntaxError as StructureFormatErrro
1 parent 9379e80 commit 5c747a3

File tree

2 files changed

+25
-1
lines changed

2 files changed

+25
-1
lines changed

news/catch-YapsSyntaxError.rst

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
**Added:**
2+
3+
* <news item>
4+
5+
**Changed:**
6+
7+
* <news item>
8+
9+
**Deprecated:**
10+
11+
* <news item>
12+
13+
**Removed:**
14+
15+
* <news item>
16+
17+
**Fixed:**
18+
19+
* Let ``diffpy.structure`` pass the tests with ``pycifrw`` installed from ``PyPI``.
20+
21+
**Security:**
22+
23+
* <news item>

src/diffpy/structure/parsers/p_cif.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
from diffpy.structure import Atom, Lattice, Structure
3737
from diffpy.structure.parsers import StructureParser
3838
from diffpy.structure.structureerrors import StructureFormatError
39+
from CifFile.yapps3_compiled_rt import YappsSyntaxError
3940

4041
# ----------------------------------------------------------------------------
4142

@@ -408,7 +409,7 @@ def _parseCifDataSource(self, datasource):
408409
# stop after reading the first structure
409410
if self.stru is not None:
410411
break
411-
except (StarError, ValueError, IndexError) as err:
412+
except (YappsSyntaxError, StarError, ValueError, IndexError) as err:
412413
exc_type, exc_value, exc_traceback = sys.exc_info()
413414
emsg = str(err).strip()
414415
e = StructureFormatError(emsg)

0 commit comments

Comments
 (0)