Skip to content

Commit

Permalink
Merge pull request #64 from mosquito/fix-63
Browse files Browse the repository at this point in the history
fixed #63
  • Loading branch information
mosquito committed May 29, 2024
2 parents 122e6d9 + 1d66841 commit 36e24ce
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
2 changes: 1 addition & 1 deletion cysystemd/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
package_info = "systemd wrapper in Cython"
version_info = (1, 6, 0)
version_info = (1, 6, 1)


author_info = (("Dmitry Orlov", "me@mosquito.su"),)
Expand Down
16 changes: 14 additions & 2 deletions cysystemd/reader.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ from .sd_id128 cimport sd_id128_t

import os
import logging
import warnings
from datetime import datetime, timezone
from uuid import UUID
from contextlib import contextmanager
Expand Down Expand Up @@ -140,7 +141,18 @@ class JournalOpenMode(IntFlag):
RUNTIME_ONLY = SD_JOURNAL_RUNTIME_ONLY
SYSTEM = SD_JOURNAL_SYSTEM
CURRENT_USER = SD_JOURNAL_CURRENT_USER
SYSTEM_ONLY = SD_JOURNAL_SYSTEM_ONLY

@classmethod
def _missing_(cls, value):
if value == SD_JOURNAL_SYSTEM_ONLY:
warnings.warn(
"The JournalOpenMode.SYSTEM_ONLY is deprecated and the alias of "
"JournalOpenMode.SYSTEM in the systemd library.",
DeprecationWarning,
stacklevel=2
)
return cls.SYSTEM
raise ValueError(f"{value} is not a valid open mode")


cdef enum READER_STATE:
Expand Down Expand Up @@ -313,7 +325,7 @@ cdef class JournalReader:
file_names = tuple(map(_check_file_path, file_names))

cdef size_t n = len(file_names)
cdef char **paths = <char **>PyMem_Malloc((n + 1) * sizeof(char*))
cdef const char **paths = <const char **>PyMem_Malloc((n + 1) * sizeof(char*))

for i, s in enumerate(file_names):
cstr = s.encode()
Expand Down

0 comments on commit 36e24ce

Please sign in to comment.