Skip to content

Instantly share code, notes, and snippets.

@infirit
Last active May 20, 2017 12:17
Show Gist options
  • Select an option

  • Save infirit/e979ce23f98b5612170cd652fc735f8d to your computer and use it in GitHub Desktop.

Select an option

Save infirit/e979ce23f98b5612170cd652fc735f8d to your computer and use it in GitHub Desktop.
drop_python2.diff
diff --git a/apps/blueman-assistant.in b/apps/blueman-assistant.in
index fa02f6ea..dd460bb1 100755
--- a/apps/blueman-assistant.in
+++ b/apps/blueman-assistant.in
@@ -265,7 +265,7 @@ class Assistant:
self.assistant.set_page_header_image(pages[PAGE_FINISH], get_icon("dialog-warning", 32))
self.assistant.set_current_page(PAGE_FINISH)
- self.applet.connect_service(str("(os)"), self.service.device.get_object_path(), self.service.uuid,
+ self.applet.connect_service("(os)", self.service.device.get_object_path(), self.service.uuid,
result_handler=success, error_handler=fail)
diff --git a/apps/blueman-mechanism.in b/apps/blueman-mechanism.in
index 9af3b96b..989b431e 100755
--- a/apps/blueman-mechanism.in
+++ b/apps/blueman-mechanism.in
@@ -170,7 +170,7 @@ class conf_service(DbusService):
"Blueman was built with PolicyKit-1 support, but it's not available on the system")
v_subject = GLib.Variant('s', subject)
- res = self.pk.CheckAuthorization(str('((sa{sv})sa{ss}us)'),("system-bus-name", {"name": v_subject}),
+ res = self.pk.CheckAuthorization('((sa{sv})sa{ss}us)',("system-bus-name", {"name": v_subject}),
action_id, {}, 1, "")
logging.debug(str(res))
diff --git a/blueman/Constants.py.in b/blueman/Constants.py.in
index b6b33e75..2f82e668 100644
--- a/blueman/Constants.py.in
+++ b/blueman/Constants.py.in
@@ -25,12 +25,8 @@ try: import __builtin__ as builtins
except ImportError: import builtins
translation = gettext.translation(GETTEXT_PACKAGE, LOCALEDIR, fallback=True)
-try:
- translation.install(unicode=True)
- builtins.ngettext = translation.ungettext
-except TypeError:
- translation.install()
- builtins.ngettext = translation.ngettext
+translation.install()
+builtins.ngettext = translation.ngettext
if 'BLUEMAN_SOURCE' in os.environ:
_dirname = os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))
diff --git a/blueman/Functions.py b/blueman/Functions.py
index b6642714..29f70409 100644
--- a/blueman/Functions.py
+++ b/blueman/Functions.py
@@ -22,7 +22,6 @@ from __future__ import print_function
from __future__ import division
from __future__ import absolute_import
from __future__ import unicode_literals
-from io import open
from time import sleep
from blueman.Constants import *
@@ -88,7 +87,7 @@ def check_bluetooth_status(message, exitfunc, *args, **kwargs):
if resp != Gtk.ResponseType.YES:
exitfunc()
else:
- applet.SetBluetoothStatus(str('(b)'), True, **kwargs)
+ applet.SetBluetoothStatus('(b)', True, **kwargs)
if not applet.GetBluetoothStatus():
print('Failed to enable bluetooth')
exitfunc()
diff --git a/blueman/bluez/Base.py b/blueman/bluez/Base.py
index b4e151c2..b7d2073c 100644
--- a/blueman/bluez/Base.py
+++ b/blueman/bluez/Base.py
@@ -18,8 +18,8 @@ class Base(Gio.DBusProxy):
__bus_type = Gio.BusType.SYSTEM
__gsignals__ = {
- str('property-changed'): (GObject.SignalFlags.NO_HOOKS, None,
- (GObject.TYPE_PYOBJECT, GObject.TYPE_PYOBJECT, GObject.TYPE_PYOBJECT))
+ 'property-changed': (GObject.SignalFlags.NO_HOOKS, None,
+ (GObject.TYPE_PYOBJECT, GObject.TYPE_PYOBJECT, GObject.TYPE_PYOBJECT))
}
def __new__(cls, *args, **kwargs):
diff --git a/blueman/bluez/Manager.py b/blueman/bluez/Manager.py
index ae510951..8cdf2f6b 100644
--- a/blueman/bluez/Manager.py
+++ b/blueman/bluez/Manager.py
@@ -12,10 +12,10 @@ from blueman.bluez.Device import Device
class Manager(GObject.GObject):
__gsignals__ = {
- str('adapter-added'): (GObject.SignalFlags.NO_HOOKS, None, (GObject.TYPE_PYOBJECT,)),
- str('adapter-removed'): (GObject.SignalFlags.NO_HOOKS, None, (GObject.TYPE_PYOBJECT,)),
- str('device-created'): (GObject.SignalFlags.NO_HOOKS, None, (GObject.TYPE_PYOBJECT,)),
- str('device-removed'): (GObject.SignalFlags.NO_HOOKS, None, (GObject.TYPE_PYOBJECT,)),
+ 'adapter-added': (GObject.SignalFlags.NO_HOOKS, None, (GObject.TYPE_PYOBJECT,)),
+ 'adapter-removed': (GObject.SignalFlags.NO_HOOKS, None, (GObject.TYPE_PYOBJECT,)),
+ 'device-created': (GObject.SignalFlags.NO_HOOKS, None, (GObject.TYPE_PYOBJECT,)),
+ 'device-removed': (GObject.SignalFlags.NO_HOOKS, None, (GObject.TYPE_PYOBJECT,)),
}
connect_signal = GObject.GObject.connect
diff --git a/blueman/bluez/obex/Client.py b/blueman/bluez/obex/Client.py
index 842f94a0..afb766c7 100644
--- a/blueman/bluez/obex/Client.py
+++ b/blueman/bluez/obex/Client.py
@@ -15,9 +15,9 @@ class ObexdNotFoundError(Exception):
class Client(Base):
__gsignals__ = {
- str('session-created'): (GObject.SignalFlags.NO_HOOKS, None, (GObject.TYPE_PYOBJECT,)),
- str('session-failed'): (GObject.SignalFlags.NO_HOOKS, None, (GObject.TYPE_PYOBJECT,)),
- str('session-removed'): (GObject.SignalFlags.NO_HOOKS, None, ()),
+ 'session-created': (GObject.SignalFlags.NO_HOOKS, None, (GObject.TYPE_PYOBJECT,)),
+ 'session-failed': (GObject.SignalFlags.NO_HOOKS, None, (GObject.TYPE_PYOBJECT,)),
+ 'session-removed': (GObject.SignalFlags.NO_HOOKS, None, ()),
}
_interface_name = 'org.bluez.obex.Client1'
diff --git a/blueman/bluez/obex/Manager.py b/blueman/bluez/obex/Manager.py
index 39651123..f4c956a1 100644
--- a/blueman/bluez/obex/Manager.py
+++ b/blueman/bluez/obex/Manager.py
@@ -11,9 +11,9 @@ from gi.repository import GObject, Gio
class Manager(GObject.GObject):
__gsignals__ = {
- str('session-removed'): (GObject.SignalFlags.NO_HOOKS, None, (GObject.TYPE_PYOBJECT,)),
- str('transfer-started'): (GObject.SignalFlags.NO_HOOKS, None, (GObject.TYPE_PYOBJECT,)),
- str('transfer-completed'): (GObject.SignalFlags.NO_HOOKS, None, (GObject.TYPE_PYOBJECT, GObject.TYPE_PYOBJECT)),
+ 'session-removed': (GObject.SignalFlags.NO_HOOKS, None, (GObject.TYPE_PYOBJECT,)),
+ 'transfer-started': (GObject.SignalFlags.NO_HOOKS, None, (GObject.TYPE_PYOBJECT,)),
+ 'transfer-completed': (GObject.SignalFlags.NO_HOOKS, None, (GObject.TYPE_PYOBJECT, GObject.TYPE_PYOBJECT)),
}
connect_signal = GObject.GObject.connect
diff --git a/blueman/bluez/obex/ObjectPush.py b/blueman/bluez/obex/ObjectPush.py
index 97bbe152..41e82759 100644
--- a/blueman/bluez/obex/ObjectPush.py
+++ b/blueman/bluez/obex/ObjectPush.py
@@ -11,8 +11,8 @@ from gi.repository import GObject, GLib
class ObjectPush(Base):
__gsignals__ = {
- str('transfer-started'): (GObject.SignalFlags.NO_HOOKS, None, (GObject.TYPE_PYOBJECT, GObject.TYPE_PYOBJECT,)),
- str('transfer-failed'): (GObject.SignalFlags.NO_HOOKS, None, (GObject.TYPE_PYOBJECT,)),
+ 'transfer-started': (GObject.SignalFlags.NO_HOOKS, None, (GObject.TYPE_PYOBJECT, GObject.TYPE_PYOBJECT,)),
+ 'transfer-failed': (GObject.SignalFlags.NO_HOOKS, None, (GObject.TYPE_PYOBJECT,)),
}
_interface_name = 'org.bluez.obex.ObjectPush1'
diff --git a/blueman/bluez/obex/Transfer.py b/blueman/bluez/obex/Transfer.py
index a8675442..d05789ac 100644
--- a/blueman/bluez/obex/Transfer.py
+++ b/blueman/bluez/obex/Transfer.py
@@ -11,9 +11,9 @@ from gi.repository import GObject, GLib
class Transfer(Base):
__gsignals__ = {
- str('progress'): (GObject.SignalFlags.NO_HOOKS, None, (GObject.TYPE_PYOBJECT,)),
- str('completed'): (GObject.SignalFlags.NO_HOOKS, None, ()),
- str('error'): (GObject.SignalFlags.NO_HOOKS, None, ())
+ 'progress': (GObject.SignalFlags.NO_HOOKS, None, (GObject.TYPE_PYOBJECT,)),
+ 'completed': (GObject.SignalFlags.NO_HOOKS, None, ()),
+ 'error': (GObject.SignalFlags.NO_HOOKS, None, ())
}
_interface_name = 'org.bluez.obex.Transfer1'
diff --git a/blueman/gui/Notification.py b/blueman/gui/Notification.py
index b28e5468..42941699 100644
--- a/blueman/gui/Notification.py
+++ b/blueman/gui/Notification.py
@@ -260,7 +260,7 @@ class _NotificationBubble(Gio.DBusProxy):
def show(self):
replace_id = self._return_id if self._return_id else 0
- return_id = self.Notify(str('(susssasa{sv}i)'), self._app_name, replace_id, self._app_icon,
+ return_id = self.Notify('(susssasa{sv}i)', self._app_name, replace_id, self._app_icon,
self._summary, self._body, self._actions, self._hints,
self._timeout)
self._return_id = return_id
diff --git a/blueman/gui/manager/ManagerDeviceMenu.py b/blueman/gui/manager/ManagerDeviceMenu.py
index 0269b6df..285279d7 100644
--- a/blueman/gui/manager/ManagerDeviceMenu.py
+++ b/blueman/gui/manager/ManagerDeviceMenu.py
@@ -156,11 +156,11 @@ class ManagerDeviceMenu(Gtk.Menu):
return
try:
- self._appl.SetTimeHint(str('(u)'), Gtk.get_current_event_time())
+ self._appl.SetTimeHint('(u)', Gtk.get_current_event_time())
except Exception as e:
logging.exception(e)
- self._appl.connect_service(str('(os)'), device.get_object_path(), service.uuid,
+ self._appl.connect_service('(os)', device.get_object_path(), service.uuid,
result_handler=success, error_handler=fail,
timeout=GLib.MAXINT)
@@ -181,7 +181,7 @@ class ManagerDeviceMenu(Gtk.Menu):
err(None, GLib.Error('Applet DBus Service not available'), None)
return
- self._appl.disconnect_service(str('(osd)'), service.device.get_object_path(), service.uuid, port,
+ self._appl.disconnect_service('(osd)', service.device.get_object_path(), service.uuid, port,
result_handler=ok, error_handler=err)
def on_device_property_changed(self, List, device, tree_iter, key_value):
@@ -207,14 +207,14 @@ class ManagerDeviceMenu(Gtk.Menu):
if connect:
self.set_op(self.SelectedDevice, _("Connecting..."))
- self._appl.connect_service(str("(os)"),
+ self._appl.connect_service("(os)",
device.get_object_path(),
'00000000-0000-0000-0000-000000000000',
result_handler=success, error_handler=fail,
timeout=GLib.MAXINT)
else:
self.set_op(self.SelectedDevice, _("Disconnecting..."))
- self._appl.disconnect_service(str("(osd)"),
+ self._appl.disconnect_service("(osd)",
device.get_object_path(),
'00000000-0000-0000-0000-000000000000',
0,
diff --git a/blueman/main/Manager.py b/blueman/main/Manager.py
index e496b214..8890dfe8 100644
--- a/blueman/main/Manager.py
+++ b/blueman/main/Manager.py
@@ -216,4 +216,4 @@ class Blueman(Gtk.Window):
def disconnect(self, device, **kwargs):
applet = AppletService()
- applet.DisconnectDevice(str('(s)'), device.get_object_path(), **kwargs)
+ applet.DisconnectDevice('(s)', device.get_object_path(), **kwargs)
diff --git a/blueman/main/NetConf.py b/blueman/main/NetConf.py
index 75dc51b0..a73250ec 100644
--- a/blueman/main/NetConf.py
+++ b/blueman/main/NetConf.py
@@ -3,7 +3,6 @@ from __future__ import print_function
from __future__ import division
from __future__ import absolute_import
from __future__ import unicode_literals
-from io import open
import pickle
import os
diff --git a/blueman/main/PulseAudioUtils.py b/blueman/main/PulseAudioUtils.py
index f278b6f1..b9f30e72 100644
--- a/blueman/main/PulseAudioUtils.py
+++ b/blueman/main/PulseAudioUtils.py
@@ -559,7 +559,7 @@ class PulseAudioUtils(GObject.GObject):
callback(self.__card_info(entry_info))
- if hasattr(card, "format") and hasattr(card, "upper"):
+ if type(card) is str:
fn = pa_context_get_card_info_by_name
else:
fn = pa_context_get_card_info_by_index
@@ -569,7 +569,7 @@ class PulseAudioUtils(GObject.GObject):
def SetCardProfile(self, card, profile, callback):
profile = profile.encode("UTF-8")
- if hasattr(card, "format") and hasattr(card, "upper"):
+ if type(card) is str:
card = card.encode("UTF-8")
fn = pa_context_set_card_profile_by_name
else:
diff --git a/blueman/plugins/ConfigurablePlugin.py b/blueman/plugins/ConfigurablePlugin.py
index d518d4b3..336a9c54 100644
--- a/blueman/plugins/ConfigurablePlugin.py
+++ b/blueman/plugins/ConfigurablePlugin.py
@@ -31,10 +31,7 @@ class ConfigurablePlugin(BasePlugin):
raise KeyError("No such option")
opt = self.__class__.__options__[key]
- # Workaround the unicode_literals in python2.
- is_string = hasattr(value, "format") and hasattr(value, "encode")
-
- if type(value) == opt["type"] or is_string:
+ if type(value) == opt["type"]:
self.__config[key] = value
self.option_changed(key, value)
else:
diff --git a/blueman/plugins/applet/DhcpClient.py b/blueman/plugins/applet/DhcpClient.py
index d6b3d5a9..b1e08c36 100644
--- a/blueman/plugins/applet/DhcpClient.py
+++ b/blueman/plugins/applet/DhcpClient.py
@@ -64,4 +64,4 @@ class DhcpClient(AppletPlugin):
icon_name="network-workgroup", pos_hint=self.Applet.Plugins.StatusIcon.geometry).show()
m = Mechanism()
- m.DhcpClient(str('(s)'), device, result_handler=reply, error_handler=err, timeout=120)
+ m.DhcpClient('(s)', device, result_handler=reply, error_handler=err, timeout=120)
diff --git a/blueman/plugins/applet/KillSwitch.py b/blueman/plugins/applet/KillSwitch.py
index 49fa594f..0c7005ce 100644
--- a/blueman/plugins/applet/KillSwitch.py
+++ b/blueman/plugins/applet/KillSwitch.py
@@ -148,11 +148,11 @@ class KillSwitch(AppletPlugin):
if self._connman_proxy:
logging.debug("Using connman to set state: %s" % state)
- self._connman_proxy.SetProperty(str('(sv)'), 'Powered', GLib.Variant.new_boolean(state),
+ self._connman_proxy.SetProperty('(sv)', 'Powered', GLib.Variant.new_boolean(state),
result_handler=reply, error_handler=error)
else:
logging.debug("Using mechanism to set state: %s" % state)
- Mechanism().SetRfkillState(str('(b)'), state, result_handler=reply, error_handler=error)
+ Mechanism().SetRfkillState('(b)', state, result_handler=reply, error_handler=error)
def on_query_status_icon_visibility(self):
# Force status icon to show if bluetooth is soft-blocked
diff --git a/blueman/plugins/applet/NMPANSupport.py b/blueman/plugins/applet/NMPANSupport.py
index 0b5113fc..92e73815 100644
--- a/blueman/plugins/applet/NMPANSupport.py
+++ b/blueman/plugins/applet/NMPANSupport.py
@@ -106,7 +106,7 @@ class NewConnectionBuilder:
self.signal_subs.append(sub)
args = [self.connection, self.device, self.connection]
- self.parent.nm_manager.ActivateConnection(str('(ooo)'), *args)
+ self.parent.nm_manager.ActivateConnection('(ooo)', *args)
def on_device_state(self, connection, sender_name, object_path, interface_name, signal_name, param):
state, oldstate, reason = param.unpack()
@@ -261,6 +261,6 @@ class NMPANSupport(AppletPlugin):
if not active_conn_path:
return
- self.nm_manager.DeactivateConnection(str('(o)'), active_conn_path)
+ self.nm_manager.DeactivateConnection('(o)', active_conn_path)
ok()
return True
diff --git a/blueman/plugins/applet/PPPSupport.py b/blueman/plugins/applet/PPPSupport.py
index 328de7bd..00f83de5 100644
--- a/blueman/plugins/applet/PPPSupport.py
+++ b/blueman/plugins/applet/PPPSupport.py
@@ -36,7 +36,7 @@ class Connection:
c = Config("org.blueman.gsmsettings", "/org/blueman/gsmsettings/%s/" % self.service.device['Address'])
m = Mechanism()
- m.PPPConnect(str('(sss)'), self.port, c["number"], c["apn"], result_handler=self.on_connected,
+ m.PPPConnect('(sss)', self.port, c["number"], c["apn"], result_handler=self.on_connected,
error_handler=self.on_error, timeout=200)
def on_error(self, _obj, result, _user_data):
diff --git a/blueman/plugins/applet/TransferService.py b/blueman/plugins/applet/TransferService.py
index b375422e..180ee415 100644
--- a/blueman/plugins/applet/TransferService.py
+++ b/blueman/plugins/applet/TransferService.py
@@ -245,10 +245,6 @@ class TransferService(AppletPlugin):
dest_dir = self._config["shared-path"]
filename = os.path.basename(src)
- # We get bytes from pygobject under python 2.7
- if hasattr(dest_dir, "upper",) and hasattr(dest_dir, "decode"):
- dest_dir = dest_dir.decode("UTF-8")
-
dest = os.path.join(dest_dir, filename)
if os.path.exists(dest):
now = datetime.now()
diff --git a/blueman/plugins/manager/Services.py b/blueman/plugins/manager/Services.py
index 6ac4056c..a8b73798 100644
--- a/blueman/plugins/manager/Services.py
+++ b/blueman/plugins/manager/Services.py
@@ -69,7 +69,7 @@ class Services(ManagerPlugin):
if service.group == 'network' and service.connected:
if "DhcpClient" in appl.QueryPlugins():
def renew(x):
- appl.DhcpClient(str('(s)'), Network(device.get_object_path())["Interface"])
+ appl.DhcpClient('(s)', Network(device.get_object_path())["Interface"])
item = create_menuitem(_("Renew IP Address"), get_icon("view-refresh", 16))
item.connect("activate", renew)
diff --git a/blueman/plugins/services/Network.py b/blueman/plugins/services/Network.py
index da22b71d..2aa60ce9 100644
--- a/blueman/plugins/services/Network.py
+++ b/blueman/plugins/services/Network.py
@@ -76,7 +76,7 @@ class Network(ServicePlugin):
net_ip = self.Builder.get_object("net_ip")
try:
- m.EnableNetwork(str('(ayays)'), inet_aton(net_ip.props.text), inet_aton("255.255.255.0"), stype)
+ m.EnableNetwork('(ayays)', inet_aton(net_ip.props.text), inet_aton("255.255.255.0"), stype)
if not self.Config["nap-enable"]:
self.Config["nap-enable"] = True
@@ -221,20 +221,20 @@ class Network(ServicePlugin):
def dun_support_toggled(rb, x):
if rb.props.active and x == "nm":
- applet.SetPluginConfig(str('(sb)'), "PPPSupport", False)
- applet.SetPluginConfig(str('(sb)'), "NMDUNSupport", True)
+ applet.SetPluginConfig('(sb)', "PPPSupport", False)
+ applet.SetPluginConfig('(sb)', "NMDUNSupport", True)
elif rb.props.active and x == "blueman":
- applet.SetPluginConfig(str('(sb)'), "NMDUNSupport", False)
- applet.SetPluginConfig(str('(sb)'), "PPPSupport", True)
+ applet.SetPluginConfig('(sb)', "NMDUNSupport", False)
+ applet.SetPluginConfig('(sb)', "PPPSupport", True)
def pan_support_toggled(rb, x):
if rb.props.active and x == "nm":
- applet.SetPluginConfig(str('(sb)'), "DhcpClient", False)
- applet.SetPluginConfig(str('(sb)'), "NMPANSupport", True)
+ applet.SetPluginConfig('(sb)', "DhcpClient", False)
+ applet.SetPluginConfig('(sb)', "NMPANSupport", True)
elif rb.props.active and x == "blueman":
- applet.SetPluginConfig(str('(sb)'), "NMPANSupport", False)
- applet.SetPluginConfig(str('(sb)'), "DhcpClient", True)
+ applet.SetPluginConfig('(sb)', "NMPANSupport", False)
+ applet.SetPluginConfig('(sb)', "DhcpClient", True)
if "PPPSupport" in active_plugins:
rb_dun_blueman.props.active = True
diff --git a/blueman/services/meta/SerialService.py b/blueman/services/meta/SerialService.py
index 0e8f19e9..e22e40cd 100644
--- a/blueman/services/meta/SerialService.py
+++ b/blueman/services/meta/SerialService.py
@@ -45,7 +45,7 @@ class SerialService(Service):
logging.info('User was granted access to %s' % path)
logging.info('Replacing root watcher')
- Mechanism().close_rfcomm(str('(d)'), port)
+ Mechanism().close_rfcomm('(d)', port)
subprocess.Popen([RFCOMM_WATCHER_PATH, path])
monitor.disconnect(self.file_changed_handler)
@@ -55,7 +55,7 @@ class SerialService(Service):
port_id = create_rfcomm_device(Adapter(self.device["Adapter"])['Address'], self.device["Address"], 1)
filename = '/dev/rfcomm%d' % port_id
logging.info('Starting rfcomm watcher as root')
- Mechanism().open_rfcomm(str('(d)'), port_id)
+ Mechanism().open_rfcomm('(d)', port_id)
mon = Gio.File.new_for_path(filename).monitor_file(Gio.FileMonitorFlags.NONE)
self.file_changed_handler = mon.connect('changed', self.on_file_changed, port_id)
self.try_replace_root_watcher(mon, filename, port_id)
@@ -70,5 +70,5 @@ class SerialService(Service):
return True
def disconnect(self, *args):
- Mechanism().close_rfcomm(str('(d)'), args[0])
+ Mechanism().close_rfcomm('(d)', args[0])
release_rfcomm_device(args[0])
diff --git a/module/_blueman.pyx.in b/module/_blueman.pyx.in
index b10bfff0..db841d92 100644
--- a/module/_blueman.pyx.in
+++ b/module/_blueman.pyx.in
@@ -226,8 +226,6 @@ def release_rfcomm_device(id):
raise Exception(ERR[ret])
return ret
-try: from exceptions import Exception
-except ImportError: pass
class BridgeException(Exception):
def __init__(self, errno):
diff --git a/module/modem-prober.c b/module/modem-prober.c
index 972ec146..5657ef54 100644
--- a/module/modem-prober.c
+++ b/module/modem-prober.c
@@ -38,10 +38,6 @@
#define XCASE 0000004
#endif
-#if PY_MAJOR_VERSION >= 3
-#define PyString_FromString PyUnicode_FromString
-#endif
-
static gboolean verbose = FALSE;
void set_probe_debug(gboolean debug) {
@@ -414,31 +410,31 @@ static gboolean on_finished(gpointer data) {
PyObject* name;
PyObject* caps = PyList_New(0);
if (info->caps & MODEM_CAP_GSM) {
- name = PyString_FromString("GSM-07.07");
+ name = PyUnicode_FromString("GSM-07.07");
PyList_Append(caps, name);
Py_XDECREF(name);
- name = PyString_FromString("GSM-07.05");
+ name = PyUnicode_FromString("GSM-07.05");
PyList_Append(caps, name);
Py_XDECREF(name);
}
if (info->caps & MODEM_CAP_IS707_A) {
- name = PyString_FromString("IS-707-A");
+ name = PyUnicode_FromString("IS-707-A");
PyList_Append(caps, name);
Py_XDECREF(name);
}
if (info->caps & MODEM_CAP_IS707_P) {
- name = PyString_FromString("IS-707-P");
+ name = PyUnicode_FromString("IS-707-P");
PyList_Append(caps, name);
Py_XDECREF(name);
}
if (info->caps & MODEM_CAP_IS856) {
- name = PyString_FromString("IS-856");
+ name = PyUnicode_FromString("IS-856");
PyList_Append(caps, name);
Py_XDECREF(name);
}
if (info->caps & MODEM_CAP_IS856_A) {
- name = PyString_FromString("IS-856-A");
+ name = PyUnicode_FromString("IS-856-A");
PyList_Append(caps, name);
Py_XDECREF(name);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment