From ed5d9c98a0ddea543590516cae7ce54b30bf2a94 Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Tue, 18 Jun 2013 20:42:33 -0700 Subject: [PATCH] RepoConfigLoader: pass source arg to read_file The 'source' keyword argument is needed since otherwise ConfigParser may throw a TypeError because it assumes f.name is a native string rather than binary when constructing error messages. --- pym/portage/repository/config.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/pym/portage/repository/config.py b/pym/portage/repository/config.py index 1b15a398a..444e6a7f3 100644 --- a/pym/portage/repository/config.py +++ b/pym/portage/repository/config.py @@ -451,8 +451,10 @@ class RepoConfigLoader(object): try: # Python >=3.2 read_file = parser.read_file + source_kwarg = 'source' except AttributeError: read_file = parser.readfp + source_kwarg = 'filename' for p in paths: f = None @@ -464,8 +466,13 @@ class RepoConfigLoader(object): except EnvironmentError: pass else: + # The 'source' keyword argument is needed since + # otherwise ConfigParsier may throw a TypeError because + # it assumes that f.name is a native string rather + # than binary when constructing error messages. + kwargs = {source_kwarg: p} try: - read_file(f) + read_file(f, **portage._native_kwargs(kwargs)) except ParsingError as e: writemsg( _("!!! Error while reading repo config file: %s\n") % e, -- 2.26.2