Skip to content

Commit

Permalink
Merge pull request #1990 from takluyver/deprecate-read-default-mode
Browse files Browse the repository at this point in the history
Deprecation warning on getting config.default_file_mode
  • Loading branch information
aragilar committed Nov 3, 2021
2 parents c825b0f + 2bbe3b5 commit dfb29a0
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions h5py/h5.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ cdef class H5PYConfig:
self._t_name = b'TRUE'
self._bytestrings = ByteStringContext()
self._track_order = False
self._default_file_mode = 'r'

property complex_names:
""" Settable 2-tuple controlling how complex numbers are saved.
Expand Down Expand Up @@ -166,7 +165,12 @@ cdef class H5PYConfig:
property default_file_mode:
"""Default mode for h5py.File()"""
def __get__(self):
return self._default_file_mode
warn(
"h5py.get_config().default_file_mode is deprecated. "
"The default mode is now always 'r' (read-only).",
category=H5pyDeprecationWarning,
)
return 'r'

def __set__(self, val):
if val == 'r':
Expand Down

0 comments on commit dfb29a0

Please sign in to comment.