From: Zac Medico Date: Wed, 19 Jun 2013 03:42:33 +0000 (-0700) Subject: RepoConfigLoader: pass source arg to read_file X-Git-Tag: v2.2.0_alpha182~11 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=ed5d9c98a0ddea543590516cae7ce54b30bf2a94;p=portage.git 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. --- 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,