PySide Bugzilla Closed for New Bugs

PySide is now a Qt Add-on and uses the Qt Project's JIRA Bug Tracker instead of this Bugzilla instance. This Bugzilla is left for reference purposes.

Bug 1108 - tests/QtGui/pyside_reload_test.py fails when bytecode writing is disabled
: tests/QtGui/pyside_reload_test.py fails when bytecode writing is disabled
Status: RESOLVED FIXED
Product: PySide
Classification: Unclassified
Component: QtGui
: HEAD
: PC Linux
: P3 normal
Assigned To: Hugo Parente Lima
:
:
:
  Show dependency treegraph
 
Reported: 2012-01-02 17:29 EET by David Leverton
Modified: 2012-01-06 00:55 EET (History)
8 users (show)

See Also:


Attachments
0001-Fix-tests-QtGui-pyside_reload_test.py-when-PYTHONDON.patch (1.43 KB, patch)
2012-01-02 17:29 EET, David Leverton
Details

Note You need to log in before you can comment on or make changes to this bug.
Description David Leverton 2012-01-02 17:29:46 EET
Created attachment 473 [details]
0001-Fix-tests-QtGui-pyside_reload_test.py-when-PYTHONDON.patch

Some package build setups, for example Gentoo's, disable Python bytecode
writing to avoid violating the build sandbox when importing a module that's
already installed on the system, as Python would then try to write the bytecode
outside the build directory.  This breaks tests/QtGui/pyside_reload_test.py as
it tries to remove the bytecode file, but in this case it was never created in
the first place.

The attached patch avoids this by checking sys.dont_write_bytecode first
(http://docs.python.org/library/sys.html#sys.dont_write_bytecode).  This
attribute is only available in Python 2.6 or later, but as far as I can see
PySide requires 2.6 anyway.  I also considered catching and ignoring the
exception, but this might hide problems in other situations.
Comment 1 Hugo Parente Lima 2012-01-06 00:55:03 EET
Patch applied in commit:

pyside/2ae8e750f77fe68bef2041019f3493487f8c3afc

Thanks!