* [gentoo-portage-dev] [PATCH] checksum._open_file: fix BytesWarning
@ 2015-10-01 20:55 Zac Medico
2015-10-02 4:05 ` Brian Dolbec
0 siblings, 1 reply; 2+ messages in thread
From: Zac Medico @ 2015-10-01 20:55 UTC (permalink / raw
To: gentoo-portage-dev; +Cc: Zac Medico
Fix the following warning message:
pym/portage/checksum.py:25: BytesWarning: str() on a bytes instance
func_call = "open('%s')" % filename
---
pym/portage/checksum.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/pym/portage/checksum.py b/pym/portage/checksum.py
index 642602e..cdf4670 100644
--- a/pym/portage/checksum.py
+++ b/pym/portage/checksum.py
@@ -7,7 +7,7 @@ from portage.const import PRELINK_BINARY, HASHING_BLOCKSIZE
from portage.localization import _
from portage import os
from portage import _encodings
-from portage import _unicode_encode
+from portage import _unicode_decode, _unicode_encode
import errno
import stat
import subprocess
@@ -22,7 +22,7 @@ def _open_file(filename):
return open(_unicode_encode(filename,
encoding=_encodings['fs'], errors='strict'), 'rb')
except IOError as e:
- func_call = "open('%s')" % filename
+ func_call = "open('%s')" % _unicode_decode(filename)
if e.errno == errno.EPERM:
raise portage.exception.OperationNotPermitted(func_call)
elif e.errno == errno.EACCES:
--
2.4.6
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [gentoo-portage-dev] [PATCH] checksum._open_file: fix BytesWarning
2015-10-01 20:55 [gentoo-portage-dev] [PATCH] checksum._open_file: fix BytesWarning Zac Medico
@ 2015-10-02 4:05 ` Brian Dolbec
0 siblings, 0 replies; 2+ messages in thread
From: Brian Dolbec @ 2015-10-02 4:05 UTC (permalink / raw
To: gentoo-portage-dev
On Thu, 1 Oct 2015 13:55:42 -0700
Zac Medico <zmedico@gentoo.org> wrote:
> Fix the following warning message:
>
> pym/portage/checksum.py:25: BytesWarning: str() on a bytes instance
> func_call = "open('%s')" % filename
> ---
> pym/portage/checksum.py | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/pym/portage/checksum.py b/pym/portage/checksum.py
> index 642602e..cdf4670 100644
> --- a/pym/portage/checksum.py
> +++ b/pym/portage/checksum.py
> @@ -7,7 +7,7 @@ from portage.const import PRELINK_BINARY,
> HASHING_BLOCKSIZE from portage.localization import _
> from portage import os
> from portage import _encodings
> -from portage import _unicode_encode
> +from portage import _unicode_decode, _unicode_encode
> import errno
> import stat
> import subprocess
> @@ -22,7 +22,7 @@ def _open_file(filename):
> return open(_unicode_encode(filename,
> encoding=_encodings['fs'], errors='strict'),
> 'rb') except IOError as e:
> - func_call = "open('%s')" % filename
> + func_call = "open('%s')" % _unicode_decode(filename)
> if e.errno == errno.EPERM:
> raise
> portage.exception.OperationNotPermitted(func_call) elif e.errno ==
> errno.EACCES:
yeah,looks good.
Also for trivial patches like this, there is no need for review.
--
Brian Dolbec <dolsen>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-10-02 4:07 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-10-01 20:55 [gentoo-portage-dev] [PATCH] checksum._open_file: fix BytesWarning Zac Medico
2015-10-02 4:05 ` Brian Dolbec
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox