Bug 995575

Summary: systemd journal python reader broken in 206
Product: [Fedora] Fedora Reporter: Orion Poplawski <orion>
Component: systemdAssignee: systemd-maint
Status: CLOSED CURRENTRELEASE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: high Docs Contact:
Priority: unspecified    
Version: 20CC: johannbg, lnykryn, msekleta, notting, plautrba, steven, systemd-maint, vpavlin, zbyszek
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-01-14 22:16:30 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Orion Poplawski 2013-08-09 18:38:32 UTC
Description of problem:

# python
Python 2.7.5 (default, Aug  4 2013, 08:19:47)
[GCC 4.8.1 20130717 (Red Hat 4.8.1-5)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from systemd import journal
>>> j = journal.Reader(converters={'__CURSOR': lambda x: x})
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib64/python2.7/site-packages/systemd/journal.py", line 153, in __init__
    super(Reader, self).__init__(flags, path, files)
TypeError: argument 3 must be (unspecified), not None

Version-Release number of selected component (if applicable):
systemd-python-206-2.fc20.x86_64


Expected results:

systemd-python-204-9.fc19.x86_64
# python
Python 2.7.5 (default, Jul  8 2013, 09:48:59)
[GCC 4.8.1 20130603 (Red Hat 4.8.1-1)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from systemd import journal
>>> j = journal.Reader(converters={'__CURSOR': lambda x: x})
>>>

Comment 1 Orion Poplawski 2013-08-09 18:42:07 UTC
Or even:

>>> from systemd import journal
>>> j = journal.Reader()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib64/python2.7/site-packages/systemd/journal.py", line 153, in __init__
    super(Reader, self).__init__(flags, path, files)
TypeError: argument 3 must be (unspecified), not None

Comment 2 Steven Hiscocks 2013-08-11 10:35:59 UTC
Patch along the lines of below resolves this; by making `None` an acceptable value.

---

diff --git a/src/python-systemd/_reader.c b/src/python-systemd/_reader.c
index a678f69..604630d 100644
--- a/src/python-systemd/_reader.c
+++ b/src/python-systemd/_reader.c
@@ -73,6 +73,11 @@ static int strv_converter(PyObject* obj, void *_result) {
         if (!obj)
             goto cleanup;
 
+        if (obj == Py_None) {
+            *result = NULL;
+            return 1;
+        }
+
         if (!PySequence_Check(obj))
             return 0;

Comment 3 Orion Poplawski 2013-08-15 19:44:23 UTC
This is also fixed in 206-3.fc20, though not noted in the changelog.

Comment 4 Fedora Update System 2013-09-15 02:11:50 UTC
systemd-204-13.fc19 has been submitted as an update for Fedora 19.
https://admin.fedoraproject.org/updates/systemd-204-13.fc19

Comment 5 Fedora End Of Life 2013-09-16 17:05:37 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 20 development cycle.
Changing version to '20'.

More information and reason for this action is here:
https://fedoraproject.org/wiki/BugZappers/HouseKeeping/Fedora20