* [gentoo-commits] portage r12363 - main/trunk/pym
@ 2008-12-29 2:44 Zac Medico (zmedico)
0 siblings, 0 replies; only message in thread
From: Zac Medico (zmedico) @ 2008-12-29 2:44 UTC (permalink / raw
To: gentoo-commits
Author: zmedico
Date: 2008-12-29 02:44:38 +0000 (Mon, 29 Dec 2008)
New Revision: 12363
Modified:
main/trunk/pym/portage_compat_namespace.py
Log:
Bug #252840 - Fix TypeError which is triggered by a broken override of
varnings.formatwarning(). Override warnings.showwarning() instead since
the api docs say it may be overriden while they do not say this about
formatwarning().
Modified: main/trunk/pym/portage_compat_namespace.py
===================================================================
--- main/trunk/pym/portage_compat_namespace.py 2008-12-28 22:29:51 UTC (rev 12362)
+++ main/trunk/pym/portage_compat_namespace.py 2008-12-29 02:44:38 UTC (rev 12363)
@@ -31,10 +31,15 @@
except (ImportError, AttributeError):
raise ImportError("No module named %s" % __oldname)
-def _formatwarning(message, category, filename, lineno):
- return "%s:%s: %s: %s\n" % (filename, lineno, category.__name__, message)
+def _showwarning(message, category, filename, lineno, file=None, line=None):
+ if file is None:
+ file = sys.stderr
+ try:
+ file.write("%s:%s: %s: %s\n" % (filename, lineno, category.__name__, message))
+ except IOError:
+ pass
-warnings.formatwarning = _formatwarning
+warnings.showwarning = _showwarning
warnings.warn("DEPRECATION NOTICE: The %s module was replaced by %s" % (__oldname, __newname), DeprecationWarning)
sys.modules[__oldname] = __realmodule
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2008-12-29 2:44 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-12-29 2:44 [gentoo-commits] portage r12363 - main/trunk/pym Zac Medico (zmedico)
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox