Debian Bug report logs - #628484
python-xpcom: 'print' method from nsIWebBrowserPrint doesn't work because it triggers a syntax error

version graph

Package: python-xpcom; Maintainer for python-xpcom is (unknown);

Reported by: Sascha Silbe <sascha-debian-bugs-foo@silbe.org>

Date: Sun, 29 May 2011 12:57:02 UTC

Severity: normal

Found in version 1:0.0~hg20100212-5+1

Fixed in version 1:9.0~hg20111212-2+rm

Done: Debian FTP Masters <ftpmaster@ftp-master.debian.org>

Bug is archived. No further changes may be made.

Toggle useless messages

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to debian-bugs-dist@lists.debian.org, Maintainers of Mozilla-related packages <pkg-mozilla-maintainers@lists.alioth.debian.org>:
Bug#628484; Package python-xpcom. (Sun, 29 May 2011 12:57:05 GMT) (full text, mbox, link).


Acknowledgement sent to Sascha Silbe <sascha-debian-bugs-foo@silbe.org>:
New Bug report received and forwarded. Copy sent to Maintainers of Mozilla-related packages <pkg-mozilla-maintainers@lists.alioth.debian.org>. (Sun, 29 May 2011 12:57:05 GMT) (full text, mbox, link).


Message #5 received at submit@bugs.debian.org (full text, mbox, reply):

From: Sascha Silbe <sascha-debian-bugs-foo@silbe.org>
To: Debian Bug Tracking System <submit@bugs.debian.org>
Subject: python-xpcom: 'print' method from nsIWebBrowserPrint doesn't work because it triggers a syntax error
Date: Sun, 29 May 2011 12:55:12 +0000
[Message part 1 (text/plain, inline)]
Package: python-xpcom
Version: 1:0.0~hg20100212-5+1
Severity: normal


When trying to access the 'print' method of the nsIWebBrowserPrint
interface, python-xpcom generates Python code on the fly and fails to
evaluate it because 'print' is a reserved keyword in Python:

(sugar-jhbuild1)sascha.silbe@twin:~$ ./print-bug.py
returning /tmp/prefs.js for key NS_APP_PREFS_50_FILE
GConf Error: Failed to contact configuration server; the most common cause is a missing or misconfigured D-Bus session bus daemon. See http://projects.gnome.org/gconf/ for information. (Details -  1: Server ping error: IDL:omg.org/CORBA/COMM_FAILURE:1.0)
Traceback (most recent call last):
  File "./print-bug.py", line 20, in _save_pdf
    getattr(print_iface, 'print')
  File "/usr/lib/pymodules/python2.6/xpcom/client/__init__.py", line 374, in __getattr__
    return getattr(interface, attr)
  File "/usr/lib/pymodules/python2.6/xpcom/client/__init__.py", line 466, in __getattr__
    unbound_method = BuildMethod(method_info, self._iid_)
  File "/usr/lib/pymodules/python2.6/xpcom/client/__init__.py", line 125, in BuildMethod
    codeObject = compile(method_code, "<XPCOMObject method '%s'>" % (name,), "exec")
  File "<XPCOMObject method 'print'>", line 2
    def print(self, Param1, Param2):
            ^
SyntaxError: invalid syntax


print-bug.py is attached.

In case anyone else gets stuck on the issue, here is how I worked around it:

        try:
            print_method = getattr(print_iface, 'print')
        except SyntaxError:
            # HACK: Run-time patch python-xpcom to work around a bug.
            # 'print' is a reserved keyword, so it must not occur in generated
            # code.
            iid = interfaces.nsIWebBrowserPrint
            internal_interface = print_iface.__dict__['_interfaces_'][iid]
            info = internal_interface.__dict__['_method_infos_']['print']
            info.name = 'print_'
            print_method = getattr(print_iface, 'print')


-- System Information:
Debian Release: 6.0.1
  APT prefers stable
  APT policy: (500, 'stable'), (1, 'experimental')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.32-5-amd64 (SMP w/2 CPU cores)
Locale: LANG=en_US, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages python-xpcom depends on:
ii  libc6                   2.11.2-10        Embedded GNU C Library: Shared lib
ii  libnspr4-0d             4.8.6-1          NetScape Portable Runtime Library
ii  libpython2.6            2.6.6-8+b1       Shared Python runtime library (ver
ii  libstdc++6              4.4.5-8          The GNU Standard C++ Library v3
ii  python                  2.6.6-3+squeeze6 interactive high-level object-orie
ii  python-support          1.0.10           automated rebuilding support for P
ii  xulrunner-1.9.2         1.9.2.13-2       XUL + XPCOM application runner

python-xpcom recommends no packages.

python-xpcom suggests no packages.

-- no debconf information
[print-bug.py (text/x-python, attachment)]

Reply sent to Debian FTP Masters <ftpmaster@ftp-master.debian.org>:
You have taken responsibility. (Sat, 26 Apr 2014 10:00:30 GMT) (full text, mbox, link).


Notification sent to Sascha Silbe <sascha-debian-bugs-foo@silbe.org>:
Bug acknowledged by developer. (Sat, 26 Apr 2014 10:00:30 GMT) (full text, mbox, link).


Message #10 received at 628484-done@bugs.debian.org (full text, mbox, reply):

From: Debian FTP Masters <ftpmaster@ftp-master.debian.org>
To: 416114-done@bugs.debian.org,628484-done@bugs.debian.org,636622-done@bugs.debian.org,713221-done@bugs.debian.org,
Cc: pyxpcom@packages.debian.org, pyxpcom@packages.qa.debian.org
Subject: Bug#745867: Removed package(s) from unstable
Date: Sat, 26 Apr 2014 09:57:09 +0000
Version: 1:9.0~hg20111212-2+rm

Dear submitter,

as the package pyxpcom has just been removed from the Debian archive
unstable we hereby close the associated bug reports.  We are sorry
that we couldn't deal with your issue properly.

For details on the removal, please see https://bugs.debian.org/745867

The version of this package that was in Debian prior to this removal
can still be found using http://snapshot.debian.org/.

This message was generated automatically; if you believe that there is
a problem with it please contact the archive administrators by mailing
ftpmaster@ftp-master.debian.org.

Debian distribution maintenance software
pp.
Ansgar Burchardt (the ftpmaster behind the curtain)



Bug archived. Request was from Debbugs Internal Request <owner@bugs.debian.org> to internal_control@bugs.debian.org. (Sun, 25 May 2014 07:43:02 GMT) (full text, mbox, link).


Send a report that this bug log contains spam.


Debian bug tracking system administrator <owner@bugs.debian.org>. Last modified: Sat Apr 15 10:25:43 2023; Machine Name: buxtehude

Debian Bug tracking system

Debbugs is free software and licensed under the terms of the GNU Public License version 2. The current version can be obtained from https://bugs.debian.org/debbugs-source/.

Copyright © 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson, 2005-2017 Don Armstrong, and many other contributors.